:root {
  --bg: #f4f2ed;
  --surface: #ffffff;
  --surface-2: #fbfaf7;
  --ink: #1b1a17;
  --muted: #8a867d;
  --muted-2: #a8a498;
  --line: #e6e3dc;
  --rail: #ffffff;
  --rail-2: #fbfaf7;
  --accent: #3257e8;
  --accent-strong: #2442c0;
  --accent-soft: #eceffe;
  --accent-line: #c9d3fa;
  --success: #3fa06b;
  --danger: #b42318;
  --shadow: 0 1px 2px rgba(27, 26, 23, 0.04), 0 12px 30px rgba(27, 26, 23, 0.08);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  overflow: hidden;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

.shell {
  height: 100vh;
  min-height: 0;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 20px;
  color: #eef5f7;
  background:
    linear-gradient(180deg, rgba(15, 139, 141, 0.2), transparent 38%),
    linear-gradient(160deg, var(--rail), var(--rail-2));
  overflow: hidden;
}

.brand {
  min-height: 60px;
}

.brand-logo {
  width: 100%;
  height: 60px;
  display: block;
  background: transparent url("/codify_logo_transparent.svg") center / 190px 190px no-repeat;
}

.field span,
.metric span,
.muted {
  color: #9fb0c1;
  font-size: 13px;
}

.file-command {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  width: 100%;
  min-height: 44px;
  padding: 9px 10px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  color: #eef5f7;
  background: rgba(255, 255, 255, 0.07);
  cursor: pointer;
  text-align: left;
}

.file-command > span {
  font-weight: 800;
}

.file-command small {
  overflow: hidden;
  color: #9fb0c1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-command b {
  color: #79d7d5;
  letter-spacing: 1px;
}

.file-command:hover {
  border-color: rgba(15, 139, 141, 0.78);
  background: rgba(15, 139, 141, 0.18);
}

.field {
  display: grid;
  gap: 8px;
}

.field select,
.cell-control {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  color: var(--ink);
  background: #fff;
  outline: none;
}

.field select {
  border-color: rgba(255, 255, 255, 0.16);
  color: #eef5f7;
  background: rgba(255, 255, 255, 0.08);
}

.field option {
  color: var(--ink);
}

.sidebar-section {
  display: grid;
  gap: 10px;
  padding-top: 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.sidebar-section h2,
.panel-heading h2 {
  margin: 0;
  font-size: 15px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.section-heading > span {
  color: #9fb0c1;
  font-size: 12px;
  font-weight: 800;
}

.project-list {
  display: grid;
  gap: 8px;
  max-height: 27vh;
  overflow-y: auto;
}

.project {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 5px 10px;
  width: 100%;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  color: #e5eef5;
  background: rgba(255, 255, 255, 0.06);
  cursor: pointer;
  text-align: left;
}

.project > span {
  overflow: hidden;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project small,
.project strong {
  color: #9fb0c1;
  font-size: 11px;
  text-transform: capitalize;
}

.project strong {
  text-align: right;
}

.project-progress {
  align-self: center;
  height: 4px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
}

.project-progress i,
.card-progress i {
  display: block;
  height: 100%;
  background: var(--accent);
}

.project.active {
  border-color: rgba(15, 139, 141, 0.78);
  background: rgba(15, 139, 141, 0.22);
}

.metric {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
}

.metric strong {
  font-size: 22px;
}

.user-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.user-chip {
  padding: 7px 9px;
  border-radius: 8px;
  color: #d9fbfa;
  background: rgba(15, 139, 141, 0.24);
}

.question-section {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
}

.question-heading {
  display: grid;
  gap: 9px;
}

.question-heading > div:first-child {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.question-heading > div:first-child > strong {
  color: #d9fbfa;
  font-size: 13px;
}

.question-search {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 7px;
  padding: 7px 9px;
  color: #ecfeff;
  background: rgba(255, 255, 255, 0.06);
  outline: none;
  font: inherit;
  font-size: 12px;
}

.question-search::placeholder {
  color: #8fa2b5;
}

.question-search:focus {
  border-color: rgba(15, 139, 141, 0.85);
  box-shadow: 0 0 0 2px rgba(15, 139, 141, 0.18);
}

.compact-metrics {
  display: flex;
  gap: 8px;
}

.compact-metrics span {
  flex: 1;
  padding: 7px 8px;
  border-radius: 7px;
  color: #8fa2b5;
  background: rgba(255, 255, 255, 0.05);
  font-size: 10px;
  text-transform: uppercase;
}

.compact-metrics b {
  display: block;
  margin-top: 2px;
  color: #eef5f7;
  font-size: 14px;
}

.question-list {
  display: grid;
  gap: 7px;
  flex: 1;
  overflow: auto;
}

.online-section {
  flex: 0 0 auto;
  margin-top: auto;
}

.account-strip {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  gap: 9px;
  align-items: center;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.account-strip > span {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #d9fbfa;
  background: rgba(15, 139, 141, 0.28);
  font-size: 11px;
  font-weight: 800;
}

.account-strip div {
  min-width: 0;
}

.account-strip strong,
.account-strip small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-strip strong {
  font-size: 12px;
}

.account-strip small {
  color: #8fa2b5;
  font-size: 10px;
}

.account-strip button {
  border: 0;
  padding: 0;
  color: #9fb0c1;
  background: transparent;
  cursor: pointer;
  font-size: 10px;
}

.question {
  width: 100%;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 8px 9px;
  color: #d8e5ee;
  background: rgba(255, 255, 255, 0.06);
  cursor: pointer;
  text-align: left;
}

.question span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.question input {
  width: 14px;
  height: 14px;
  margin: 0;
  accent-color: var(--accent, #0f8b8d);
}

.question strong {
  color: #9fb0c1;
  font-size: 12px;
}

.question.active {
  border-color: rgba(15, 139, 141, 0.78);
  color: #ecfeff;
  background: rgba(15, 139, 141, 0.22);
}

.question-empty {
  padding: 8px 4px;
  color: #8fa2b5;
  font-size: 12px;
}

.file-input {
  display: none;
}

.import-button {
  width: 100%;
  min-height: 38px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  color: #ecfeff;
  background: rgba(15, 139, 141, 0.24);
  cursor: pointer;
  font-weight: 800;
}

.import-button:disabled {
  cursor: wait;
  opacity: 0.7;
}

.workspace {
  height: 100vh;
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 24px;
  overflow: hidden;
}

.topbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
}

.project-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.action-menu {
  position: relative;
}

.action-menu > button::after {
  content: "";
  display: inline-block;
  margin-left: 8px;
  border-top: 5px solid currentColor;
  border-right: 4px solid transparent;
  border-left: 4px solid transparent;
  vertical-align: middle;
}

.action-menu-panel {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 25;
  display: none;
  min-width: 150px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  box-shadow: var(--shadow);
}

.action-menu.open .action-menu-panel {
  display: grid;
  gap: 4px;
}

.action-menu-panel button {
  justify-content: flex-start;
  width: 100%;
  min-height: 34px;
  border: 0;
  background: transparent;
  box-shadow: none;
  text-align: left;
}

.action-menu-panel button:hover {
  background: var(--surface-2);
}

.audit-icon-button {
  width: 42px;
  min-width: 42px;
  height: 42px;
  border-radius: 10px;
  font-family: Georgia, serif;
  font-style: italic;
  font-weight: 900;
}

.project-actions select,
.project-actions button,
.project-create-form input,
.project-create-form select,
.study-fields input,
.study-fields select {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  color: var(--ink);
  background: #fff;
}

.project-actions button,
.project-create-form button {
  min-height: 38px;
  border: 0;
  border-radius: 8px;
  padding: 8px 12px;
  color: #fff;
  background: var(--accent);
  cursor: pointer;
  font-weight: 800;
}

.project-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.project-actions .remove-study-button {
  border: 1px solid #fecaca;
  color: #b91c1c;
  background: #fff;
}

.project-actions .remove-study-button:hover:not(:disabled) {
  background: #fff1f2;
}

.project-create-form input:disabled,
.project-create-form select:disabled,
.project-create-form button:disabled {
  cursor: wait;
  opacity: 0.68;
}

.project-create-form button.is-loading {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
}

.button-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.38);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.project-create-form input.required-input:required,
.study-fields input.required-input:required {
  border-color: #ef4444;
}

.project-create-form input.required-input:required:valid,
.study-fields input.required-input:required:valid {
  border-color: #16a34a;
}

.project-create-form input.required-input:disabled {
  border-color: #16a34a;
}

.project-create-form input.required-input:focus,
.study-fields input.required-input:focus {
  outline: 3px solid rgba(20, 184, 166, 0.14);
}

.project-create-form input.required-input:required:invalid:focus,
.study-fields input.required-input:required:invalid:focus {
  outline-color: rgba(239, 68, 68, 0.14);
}

.project-create-form input.required-input:required:valid:focus,
.study-fields input.required-input:required:valid:focus {
  outline-color: rgba(22, 163, 74, 0.14);
}

.project-setup {
  flex: 1;
  display: grid;
  place-content: center;
  justify-items: center;
  padding: 30px;
  border: 1px dashed #bdc9d6;
  border-radius: 10px;
  text-align: center;
}

.project-setup h2,
.project-setup > p:not(.kicker) {
  margin: 0 0 9px;
}

.project-setup > p:not(.kicker) {
  color: var(--muted);
}

.project-setup > div {
  display: grid;
  grid-template-columns: 1fr;
  width: min(100%, 380px);
  justify-content: center;
  gap: 12px;
  margin-top: 18px;
}

.project-setup button {
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  background: #fff;
  cursor: pointer;
  text-align: center;
  width: 100%;
}

.project-setup button:hover {
  border-color: var(--accent);
  background: #f0fdfa;
}

.project-setup button span {
  color: var(--muted);
  font-size: 12px;
}

.project-loading {
  gap: 4px;
}

.empty-workspace {
  min-height: calc(100vh - 136px);
  display: grid;
  place-content: center;
  justify-items: center;
  padding: 32px;
  border: 1px dashed #c6d0dc;
  border-radius: 8px;
  text-align: center;
}

.empty-workspace > .empty-mark {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  margin-bottom: 14px;
  border-radius: 12px;
  color: #fff;
  background: var(--accent);
  font-weight: 800;
}

.empty-workspace h2,
.empty-workspace p {
  margin: 0 0 9px;
}

.empty-workspace p {
  color: var(--muted);
}

.empty-workspace button,
.auth-card button {
  margin-top: 12px;
  border: 0;
  border-radius: 8px;
  padding: 11px 16px;
  color: #fff;
  background: var(--accent);
  cursor: pointer;
  font-weight: 800;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(7, 18, 27, 0.64);
  backdrop-filter: blur(6px);
}

.file-modal {
  width: min(720px, 100%);
  max-height: min(760px, calc(100vh - 40px));
  overflow-y: auto;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 30px 90px rgba(7, 18, 27, 0.32);
}

.file-modal > header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.file-modal h2 {
  margin: 0;
  font-size: 24px;
}

.modal-close {
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 7px 10px;
  color: var(--muted);
  background: #fff;
  cursor: pointer;
}

.modal-project-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  max-height: 310px;
  overflow-y: auto;
}

.archived-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.modal-project {
  position: relative;
  display: grid;
  gap: 8px;
  overflow: hidden;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--surface-2);
  text-align: left;
}

.modal-project.status-updating {
  border-color: rgba(15, 139, 141, 0.42);
  animation: cardPulse 1.1s ease-in-out infinite;
}

.modal-project.archived {
  opacity: 0.72;
}

.modal-project-open {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 12px;
  width: 100%;
  padding: 0;
  border: 0;
  color: inherit;
  background: transparent;
  cursor: pointer;
  text-align: left;
}

.modal-project-open > div:first-child {
  min-width: 0;
}

.modal-project strong,
.modal-project small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.modal-project small,
.modal-project-open > span {
  color: var(--muted);
  font-size: 11px;
  text-transform: capitalize;
}

.modal-project-status {
  justify-self: end;
  align-self: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 10px;
  background: #fff;
  font-size: 10px;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
}

.modal-project-status.completed {
  border-color: #bbf7d0;
  color: #166534;
  background: #dcfce7;
}

.modal-project-status.in_progress {
  border-color: #fed7aa;
  color: #9a3412;
  background: #ffedd5;
}

.modal-project-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.modal-project-actions button,
.modal-project-convert {
  justify-self: start;
  padding: 0;
  border: 0;
  color: var(--accent);
  background: transparent;
  cursor: pointer;
  font-size: 11px;
  font-weight: 800;
}

.modal-project-progress {
  align-self: center;
  height: 5px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--line);
}

.modal-project-progress i {
  display: block;
  height: 100%;
  background: var(--accent);
}

.modal-project.active,
.modal-project:hover {
  border-color: var(--accent);
  background: #f0fdfa;
}

.modal-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.modal-divider::before,
.modal-divider::after {
  height: 1px;
  flex: 1;
  background: var(--line);
  content: "";
}

.autocode-notice {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 12px;
  padding: 10px 12px;
  border: 1px solid rgba(15, 139, 141, 0.28);
  border-radius: 10px;
  color: var(--ink);
  background: #ecfeff;
}

.autocode-notice > div {
  min-width: 0;
  display: grid;
  gap: 2px;
  margin-right: auto;
}

.autocode-notice span {
  color: var(--muted);
  font-size: 12px;
}

.autocode-review-button,
.autocode-dismiss {
  border: 1px solid rgba(15, 139, 141, 0.32);
  border-radius: 8px;
  color: var(--accent-strong);
  background: #fff;
  cursor: pointer;
  font-weight: 800;
}

.autocode-review-button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 10px;
}

.autocode-dismiss {
  width: 32px;
  height: 32px;
}

.eye-icon {
  position: relative;
  width: 16px;
  height: 10px;
  color: inherit;
  border: 2px solid currentColor;
  border-radius: 999px / 700px;
}

.eye-icon::after {
  position: absolute;
  inset: 2px 5px;
  border-radius: 50%;
  background: currentColor;
  content: "";
}

.autocode-review-button .eye-icon {
  color: inherit;
}

.autocode-modal {
  width: min(1180px, 100%);
}

.autocode-table-wrap {
  max-height: min(560px, calc(100vh - 180px));
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.autocode-table {
  width: 100%;
  border-collapse: collapse;
}

.autocode-table td {
  vertical-align: middle;
}

.autocode-table td:nth-child(3) {
  min-width: 260px;
  max-width: 420px;
  overflow-wrap: anywhere;
}

.autocode-table small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.autocode-table button {
  border: 1px solid #fecaca;
  border-radius: 8px;
  padding: 7px 10px;
  color: #991b1b;
  background: #fff5f5;
  cursor: pointer;
  font-weight: 800;
}

.autocode-table button:disabled {
  opacity: 0.6;
  cursor: wait;
}

.drop-zone {
  width: 100%;
  display: grid;
  gap: 5px;
  padding: 26px;
  border: 1px dashed #9aa9b9;
  border-radius: 10px;
  color: var(--ink);
  background: #f8fafc;
  cursor: pointer;
}

.drop-zone strong {
  display: inline-flex;
  gap: 9px;
  align-items: center;
  justify-content: center;
}

.drop-zone .loading-spinner {
  width: 18px;
  height: 18px;
  border-width: 2px;
}

.drop-zone span {
  color: var(--muted);
  font-size: 12px;
}

.drop-zone.dragging,
.drop-zone:hover {
  border-color: var(--accent);
  background: #ecfeff;
}

.drop-zone:disabled {
  cursor: wait;
  opacity: 0.7;
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
  background:
    radial-gradient(circle at 20% 20%, rgba(15, 139, 141, 0.24), transparent 32%),
    linear-gradient(145deg, #0d1922, #152a37);
}

.auth-card {
  width: min(430px, 100%);
  padding: 38px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  color: #eef5f7;
  background: rgba(16, 24, 32, 0.76);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.3);
}

.auth-mark {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  margin-bottom: 28px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  color: #79d7d5;
  font-weight: 800;
}

.auth-card h1 {
  margin-bottom: 10px;
}

.auth-card > p:not(.kicker) {
  margin: 0;
  color: #9fb0c1;
}

.auth-loader {
  width: 28px;
  height: 28px;
  margin-top: 22px;
  border: 3px solid rgba(255, 255, 255, 0.14);
  border-top-color: #79d7d5;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.loading-host {
  position: relative;
}

.loading-overlay {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 8px;
  color: var(--muted);
  background: rgba(248, 250, 252, 0.74);
  backdrop-filter: blur(2px);
  font-size: 12px;
  font-weight: 800;
}

.loading-overlay.dark {
  color: #d9fbfa;
  background: rgba(16, 35, 49, 0.76);
}

.loading-spinner {
  width: 22px;
  height: 22px;
  display: inline-block;
  border: 3px solid rgba(100, 112, 132, 0.2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.inline-loader {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.inline-loader .loading-spinner {
  width: 18px;
  height: 18px;
  border-width: 2px;
}

.modal-project-list.loading-host {
  min-height: 120px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes cardPulse {
  50% { box-shadow: 0 0 0 3px rgba(15, 139, 141, 0.12); }
}

.kicker {
  margin: 0 0 7px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: 34px;
  line-height: 1.1;
}

.session-card {
  min-width: 210px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
  box-shadow: var(--shadow);
}

.session-card span,
.session-card strong {
  display: block;
}

.session-card span,
.panel-heading span,
.audit-item span,
.audit-item p,
.date-cell {
  color: var(--muted);
  font-size: 13px;
}

.content-grid {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  gap: 0;
  align-items: stretch;
}

.coding-panels {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
}

.project-board {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.project-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
  padding: 16px;
}

.project-card {
  display: grid;
  gap: 12px;
  min-height: 210px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background:
    linear-gradient(145deg, rgba(15, 139, 141, 0.08), transparent 58%),
    #fff;
  cursor: pointer;
  text-align: left;
}

.project-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.project-card > div:first-child {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--muted);
  font-size: 12px;
}

.project-card h2,
.project-card p {
  margin: 0;
}

.project-card p,
.project-card > strong {
  color: var(--muted);
  font-size: 13px;
}

.project-card > b {
  color: var(--accent);
  font-size: 13px;
}

.status-tag {
  padding: 5px 8px;
  border-radius: 999px;
  color: #0f766e;
  background: #ccfbf1;
  font-weight: 800;
  text-transform: capitalize;
}

.status-tag.completed {
  color: #3f6212;
  background: #ecfccb;
}

.status-tag.in_progress {
  color: #92400e;
  background: #fef3c7;
}

.card-progress {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--line);
}

.empty-state {
  margin: 0;
  color: var(--muted);
}

.table-panel,
.codeframe-panel,
.audit-panel {
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.codeframe-panel {
  min-width: 0;
}

.codeframe-panel .panel-heading div {
  min-width: 0;
}

.codeframe-panel .panel-heading small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
}

.codeframe-apply-selected {
  min-height: 30px;
  border: 1px solid var(--accent);
  border-radius: 7px;
  padding: 5px 9px;
  color: #fff;
  background: var(--accent);
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
}

.codeframe-apply-selected:disabled {
  border-color: var(--line);
  color: #9aa9b9;
  background: #f1f5f9;
  cursor: not-allowed;
}

.codeframe-scroll {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: auto;
}

.codeframe-table {
  min-width: 0;
}

.codeframe-table th,
.codeframe-table td {
  padding: 9px 8px;
}

.codeframe-table th:first-child,
.codeframe-table td:first-child {
  width: 34%;
}

.codeframe-table th:last-child,
.codeframe-table td:last-child {
  width: 120px;
}

.codeframe-table .count-cell {
  width: 70px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.count-link {
  border: 0;
  padding: 0;
  color: var(--accent);
  background: transparent;
  cursor: pointer;
  font: inherit;
  font-weight: 800;
}

.count-link:disabled {
  color: var(--muted);
  cursor: default;
}

.codeframe-table .serial-cell {
  width: 150px;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.apply-cell {
  text-align: right;
  white-space: nowrap;
}

.apply-cell .row-checkbox {
  margin-right: 6px;
  vertical-align: middle;
}

.apply-cell button {
  border: 1px solid var(--accent);
  border-radius: 7px;
  margin-left: 5px;
  padding: 5px 9px;
  color: #fff;
  background: var(--accent);
  cursor: pointer;
  font-size: 11px;
  font-weight: 800;
}

.apply-cell button:disabled {
  border-color: var(--line);
  color: #9aa9b9;
  background: #f1f5f9;
  cursor: not-allowed;
}

.apply-cell .secondary-action {
  color: var(--accent);
  background: #fff;
}

.codeframe-table code {
  color: var(--accent);
  font-weight: 800;
}

.codeframe-meta {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.codeframe-empty {
  position: absolute;
  inset: 70px 20px auto;
  text-align: center;
}

.codeframe-empty p {
  margin: 0 0 5px;
  font-weight: 800;
}

.codeframe-empty span,
.import-note {
  color: var(--muted);
  font-size: 12px;
}

.project-create-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 190px auto;
  gap: 8px;
}

.study-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.import-modal.has-preview,
.import-modal.is-codeframe-import {
  width: min(1180px, 100%);
  max-height: min(820px, calc(100vh - 32px));
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
}

.import-modal-body {
  display: grid;
  gap: 12px;
}

.import-workspace {
  display: contents;
}

.import-modal.has-preview .import-modal-body {
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.codeframe-import-body,
.import-modal.has-preview .codeframe-import-body {
  min-height: min(620px, calc(100vh - 180px));
  display: grid;
  grid-template-columns: minmax(340px, 390px) minmax(0, 1fr);
  align-items: stretch;
  gap: 14px;
  overflow: hidden;
}

.codeframe-import-sidebar,
.codeframe-import-main {
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: hidden;
}

.codeframe-import-main .drop-zone {
  flex: 1 1 auto;
  min-height: 280px;
}

.codeframe-import-main .verbatim-preview {
  flex: 1 1 auto;
}

.codeframe-import-main .import-role-picker label {
  padding: 12px;
}

.codeframe-import-main .import-role-picker select {
  min-height: 40px;
}

.codeframe-import-main .import-table-preview {
  min-height: 260px;
}

.verbatim-preview {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-rows: auto auto auto minmax(0, 1fr) auto;
  gap: 10px;
  overflow: hidden;
}

.codeframe-preview {
  grid-template-rows: auto auto minmax(0, 1fr) auto;
}

.import-preview-summary,
.import-column-picker > header,
.import-preview-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.import-preview-summary {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.csv-file-options {
  margin-bottom: 10px;
}

.import-preview-summary.csv-separator-error {
  border-color: #ef4444;
  background: #fff1f2;
}

.csv-separator-picker.has-error span {
  color: #b91c1c;
}

.csv-separator-picker.has-error select {
  border-color: #ef4444;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.12);
}

.csv-separator-warning {
  display: grid;
  gap: 2px;
  margin-top: -2px;
  padding: 8px 10px;
  border: 1px solid #fecaca;
  border-radius: 7px;
  color: #991b1b;
  background: #fff1f2;
  font-size: 12px;
}

.csv-separator-warning strong,
.csv-separator-warning span {
  display: block;
}

.csv-separator-warning strong {
  font-size: 11px;
  letter-spacing: 0;
  text-transform: uppercase;
}

.import-preview-summary strong,
.import-preview-summary span,
.import-column-picker header strong,
.import-column-picker header span {
  display: block;
}

.import-preview-summary span,
.import-column-picker header span,
.import-preview-footer span {
  color: var(--muted);
  font-size: 12px;
}

.import-progress-copy {
  min-width: 190px;
}

.import-progress-copy > span,
.question-import-progress span {
  display: block;
}

.question-import-progress {
  display: grid;
  gap: 5px;
  margin-top: 6px;
}

.question-import-progress i {
  display: block;
  width: min(220px, 100%);
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--line);
}

.question-import-progress b {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 0.2s ease;
}

.import-preview-summary button,
.import-preview-footer button {
  min-height: 34px;
  border: 0;
  border-radius: 7px;
  padding: 7px 11px;
  color: #fff;
  background: var(--accent);
  cursor: pointer;
  font-weight: 800;
}

.import-preview-summary button {
  border: 1px solid var(--line);
  color: var(--ink);
  background: #fff;
}

.sheet-picker {
  display: grid;
  gap: 4px;
  min-width: 180px;
}

.sheet-picker span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.sheet-picker select {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 6px 8px;
  background: #fff;
}

.import-role-picker {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.import-role-picker label {
  display: grid;
  gap: 5px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.import-role-picker span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.import-role-picker select {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 6px 8px;
  background: #fff;
}

.import-column-picker {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.import-column-picker > header {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}

.import-column-picker > header label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 800;
}

.import-column-options {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 7px;
  max-height: 112px;
  overflow-y: auto;
  padding: 9px;
}

.import-column-options > label {
  min-width: 0;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  cursor: pointer;
}

.import-column-options > label.selected {
  border-color: var(--accent);
  background: #ecfeff;
}

.import-column-options > label.id-column {
  opacity: 0.65;
  cursor: not-allowed;
}

.import-column-options span {
  min-width: 0;
}

.import-column-options strong,
.import-column-options small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.import-column-options small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.import-table-preview {
  min-height: 0;
  max-height: none;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.import-table-preview table {
  width: max-content;
  min-width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.import-table-preview th,
.import-table-preview td {
  min-width: 150px;
  max-width: 260px;
  padding: 8px 10px;
  overflow: hidden;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.import-table-preview th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface-2);
  font-size: 11px;
  text-transform: uppercase;
}

.import-preview-footer {
  position: sticky;
  bottom: 0;
  z-index: 2;
  min-height: 46px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  background: #fff;
}

.import-preview-footer button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.import-note {
  margin: 0 0 12px;
}

.codeframe-scope-picker {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-2);
}

.codeframe-scope-picker strong {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.codeframe-scope-picker label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-size: 13px;
}

.codeframe-scope-picker label:has(input:disabled) {
  color: var(--muted);
}

.scope-warning {
  color: var(--danger);
  font-size: 12px;
  font-weight: 700;
}

.codeframe-file-list {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.codeframe-import-sidebar .codeframe-file-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  margin-bottom: 0;
  padding-right: 2px;
}

.codeframe-file-list header,
.codeframe-file-list article {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.codeframe-file-list article {
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.codeframe-import-sidebar .codeframe-file-list header {
  position: sticky;
  top: 0;
  z-index: 1;
  padding-bottom: 2px;
  background: #fff;
}

.codeframe-import-sidebar .codeframe-file-list article {
  align-items: stretch;
  flex-direction: column;
  gap: 8px;
}

.codeframe-import-sidebar .codeframe-file-list article > div:first-of-type {
  min-width: 0;
}

.codeframe-import-sidebar .codeframe-file-list article strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.codeframe-file-list article.is-processing {
  border-color: rgba(15, 139, 141, 0.42);
  animation: cardPulse 1.1s ease-in-out infinite;
}

.codeframe-file-list small,
.codeframe-file-list span,
.codeframe-file-list p {
  color: var(--muted);
  font-size: 12px;
}

.codeframe-file-list p {
  margin: 0;
}

.codeframe-file-actions {
  display: flex;
  gap: 6px;
}

.codeframe-import-sidebar .codeframe-file-actions {
  flex-wrap: wrap;
}

.codeframe-file-list button {
  border: 1px solid #fecaca;
  border-radius: 7px;
  padding: 6px 10px;
  color: #b91c1c;
  background: #fff;
  cursor: pointer;
  font-weight: 800;
  white-space: nowrap;
}

.codeframe-import-sidebar .codeframe-file-list button {
  min-height: 30px;
  padding: 5px 8px;
  font-size: 12px;
}

.import-preview-footer button.is-loading {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
}

.codeframe-file-list button.assign-scope {
  border-color: var(--accent);
  color: var(--accent);
}

.codeframe-file-list button.replace-codeframe {
  border-color: #60a5fa;
  color: #1d4ed8;
}

.codeframe-file-list button:disabled {
  border-color: var(--line);
  color: var(--muted);
  cursor: not-allowed;
  opacity: 0.7;
}

.codeframe-file-list article.is-processing button:disabled {
  cursor: wait;
}

.panel-heading {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 56px;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}

.table-scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
  max-height: none;
}

.records-heading-tools {
  width: auto;
  display: flex;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
}

.segment-action {
  min-height: 30px;
  border: 1px solid var(--accent);
  border-radius: 7px;
  padding: 5px 9px;
  color: var(--accent);
  background: #fff;
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
}

.segment-action:disabled {
  border-color: var(--line);
  color: #9aa9b9;
  cursor: not-allowed;
}

.rollback-action:not(:disabled) {
  border-color: #f59e0b;
  color: #b45309;
}

.records-heading-tools > span {
  min-width: 120px;
  text-align: right;
}

.records-heading-tools label {
  display: flex;
  gap: 6px;
  align-items: center;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
}

.records-heading-tools input {
  accent-color: var(--accent);
}

table {
  width: 100%;
  min-width: 900px;
  border-collapse: separate;
  border-spacing: 0;
}

.records-table {
  min-width: 820px;
  table-layout: fixed;
}

.records-table .record-id-column {
  width: 70px;
}

.records-table .selection-column {
  width: 38px;
}

.records-table .serial-column {
  width: 116px;
}

.records-table .label-column {
  width: 24%;
}

.records-table .code-column {
  width: 100px;
}

.records-table .info-column {
  width: 44px;
}

.records-table th,
.records-table td {
  padding: 9px 8px;
  vertical-align: middle;
}

.selection-cell {
  text-align: center;
}

.row-checkbox {
  accent-color: var(--accent);
  cursor: pointer;
}

.row-checkbox:disabled {
  cursor: not-allowed;
}

.records-table .response-cell,
.records-table .readonly-code-cell {
  min-width: 0;
  max-width: none;
  overflow-wrap: anywhere;
}

.column-search {
  display: flex;
  gap: 7px;
  align-items: center;
}

.column-search input {
  width: min(120px, 55%);
  min-width: 70px;
  height: 27px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 4px 7px;
  color: var(--ink);
  background: #fff;
  font-size: 11px;
  outline: none;
  text-transform: none;
}

.column-search input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(15, 139, 141, 0.1);
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 12px 14px;
  text-align: left;
  vertical-align: top;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: var(--muted);
  background: #fbfcfe;
  font-size: 12px;
  text-transform: uppercase;
}

tr:hover td {
  background: #fbfcfe;
}

.record-id-cell,
.serial-cell {
  color: var(--muted);
  font-weight: 800;
  vertical-align: middle;
}

.record-id-cell {
  width: 70px;
}

.serial-cell {
  width: 116px;
  max-width: 116px;
  overflow: hidden;
  color: var(--accent-strong);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.response-cell {
  min-width: 330px;
  max-width: 430px;
  line-height: 1.45;
}

.segment-row td {
  background: #f4fbfb;
}

.segment-start td {
  border-top: 2px solid rgba(15, 139, 141, 0.45);
}

.segment-end td {
  border-bottom: 2px solid rgba(15, 139, 141, 0.45);
}

.segment-row .selection-cell {
  box-shadow: inset 3px 0 0 var(--accent);
}

.segment-row .id-cell small,
.segment-label {
  display: block;
  color: var(--accent);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.segment-label {
  margin-bottom: 3px;
}

.readonly-code-cell {
  min-width: 138px;
  cursor: default;
}

.readonly-code-cell span {
  display: block;
  min-height: 20px;
}

.readonly-code-cell small {
  display: inline-block;
  margin-top: 6px;
  padding: 3px 6px;
  border-radius: 6px;
  color: #7c2d12;
  background: #ffedd5;
  font-size: 11px;
}

.readonly-code-cell.locked {
  background: #fff7ed;
}

.date-cell {
  min-width: 170px;
}

.editor-cell {
  min-width: 150px;
  color: var(--muted);
  font-weight: 700;
}

.info-cell {
  width: 58px;
  text-align: center;
}

.status-cell {
  min-width: 170px;
}

.status-pill {
  display: inline-block;
  border-radius: 999px;
  padding: 5px 8px;
  font-size: 11px;
  font-weight: 800;
  text-transform: capitalize;
  white-space: nowrap;
}

.status-pill.coded {
  color: #166534;
  background: #dcfce7;
}

.status-pill.uncoded {
  color: #9a3412;
  background: #ffedd5;
}

.status-pill.incomplete {
  color: #991b1b;
  background: #fee2e2;
}

.info-button {
  width: 27px;
  height: 27px;
  display: inline-grid;
  place-items: center;
  border: 1px solid #9aa9b9;
  border-radius: 50%;
  padding: 0;
  color: var(--accent);
  background: #fff;
  cursor: pointer;
  font-family: Georgia, serif;
  font-size: 15px;
  font-style: italic;
  font-weight: 800;
}

.info-button:hover {
  border-color: var(--accent);
  background: #ecfeff;
}

.record-info-modal {
  width: min(460px, 100%);
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 30px 90px rgba(7, 18, 27, 0.32);
}

.record-info-modal > header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}

.record-info-modal h2 {
  margin: 0;
  font-size: 24px;
}

.record-info-modal dl {
  display: grid;
  gap: 10px;
  margin: 0;
}

.record-info-modal dl > div {
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr);
  gap: 14px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.record-info-modal dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.record-info-modal dd {
  margin: 0;
  font-weight: 700;
}

.codeframe-assignments-modal {
  width: min(920px, 100%);
  max-height: min(760px, calc(100vh - 32px));
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
}

.assignment-tools {
  display: grid;
  grid-template-columns: auto minmax(220px, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding-bottom: 12px;
}

.assignment-select-all {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.assignment-search {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 12px;
  background: #fff;
}

.assignment-list {
  min-height: 180px;
  overflow: auto;
  display: grid;
  gap: 10px;
}

.assignment-count {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.assignment-item {
  display: grid;
  grid-template-columns: 22px 150px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-2);
}

.assignment-check {
  display: grid;
  place-items: center;
}

.assignment-item small,
.assignment-empty {
  color: var(--muted);
}

.assignment-item p {
  margin: 0;
}

.assignment-item button,
.assignment-remove-selected {
  border: 1px solid #fecaca;
  border-radius: 8px;
  padding: 7px 10px;
  color: #b42318;
  background: #fff;
  cursor: pointer;
  font-weight: 800;
}

.assignment-item button:disabled,
.assignment-remove-selected:disabled {
  opacity: 0.6;
  cursor: wait;
}

.load-more-assignments {
  justify-self: center;
  border: 1px solid var(--accent);
  border-radius: 9px;
  padding: 9px 14px;
  color: var(--accent);
  background: #fff;
  cursor: pointer;
  font-weight: 800;
}

.load-more-assignments:disabled {
  opacity: 0.6;
  cursor: wait;
}

.codeframe-edit-modal form {
  display: grid;
  gap: 18px;
}

.codeframe-rename-modal {
  width: min(440px, 100%);
}

.codeframe-rename-modal form {
  display: grid;
  gap: 18px;
}

.codeframe-rename-modal header p {
  margin: 6px 0 0;
  color: var(--muted);
}

.codeframe-edit-modal form > header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.codeframe-rename-modal form > header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.codeframe-edit-fields {
  display: grid;
  gap: 12px;
}

.codeframe-edit-fields label {
  display: grid;
  gap: 6px;
}

.codeframe-edit-fields span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.codeframe-edit-fields input {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  color: var(--ink);
  font: inherit;
  outline: none;
}

.codeframe-edit-fields input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 139, 141, 0.12);
}

.field-error {
  margin: 0;
  color: #b91c1c;
  font-size: 13px;
  font-weight: 800;
}

.codeframe-edit-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.codeframe-edit-actions button {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 7px 12px;
  color: var(--ink);
  background: #fff;
  cursor: pointer;
  font-weight: 800;
}

.codeframe-edit-actions button[type="submit"] {
  border-color: var(--accent);
  color: #fff;
  background: var(--accent);
}

.codeframe-edit-actions .danger-action {
  margin-right: auto;
  border-color: #fecaca;
  color: #b91c1c;
  background: #fff1f2;
}

.codeframe-edit-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.segmentation-modal {
  width: min(1000px, 100%);
}

.segmentation-help {
  margin: -8px 0 12px;
  color: var(--muted);
  font-size: 13px;
}

.segmentation-modal blockquote {
  margin: 0 0 14px;
  padding: 12px 14px;
  border-left: 3px solid var(--accent);
  color: var(--ink);
  background: var(--surface-2);
}

.segment-drafts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  max-height: min(480px, 55vh);
  overflow-y: auto;
}

.segment-draft {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
}

.segment-draft > header,
.segmentation-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.segment-draft > header button {
  border: 0;
  color: #b42318;
  background: transparent;
  cursor: pointer;
  font-size: 11px;
  font-weight: 800;
}

.segment-tokens {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin: 10px 0;
}

.segment-tokens button {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 5px 7px;
  cursor: pointer;
  font: inherit;
}

.segment-tokens button.included {
  border-color: rgba(15, 139, 141, 0.45);
  color: #075f61;
  background: #ecfeff;
}

.segment-tokens button.excluded {
  color: #9aa9b9;
  background: #f1f5f9;
  text-decoration: line-through;
}

.segment-draft > p {
  min-height: 38px;
  margin: 0;
  padding-top: 9px;
  border-top: 1px solid var(--line);
  line-height: 1.45;
}

.segment-text-entry {
  display: grid;
  gap: 6px;
  padding-top: 9px;
  border-top: 1px solid var(--line);
}

.segment-text-entry span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.segment-text-entry textarea {
  width: 100%;
  min-height: 74px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
  color: var(--ink);
  background: #fff;
  font: inherit;
  line-height: 1.4;
}

.segment-text-entry textarea:focus {
  outline: 2px solid rgba(49, 91, 255, 0.18);
  border-color: var(--primary);
}

.segmentation-actions {
  margin-top: 14px;
}

.segmentation-actions button {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 7px 12px;
  color: var(--ink);
  background: #fff;
  cursor: pointer;
  font-weight: 800;
}

.segmentation-actions button:last-child {
  border-color: var(--accent);
  color: #fff;
  background: var(--accent);
}

.segmentation-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.audit-panel {
  position: static;
}

.audit-heading {
  gap: 14px;
}

.audit-heading input {
  width: min(360px, 40vw);
  min-height: 34px;
  margin-left: auto;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 7px 10px;
  color: var(--ink);
  background: #fff;
  outline: none;
}

.audit-modal {
  width: min(1100px, 100%);
  height: min(720px, calc(100vh - 40px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.audit-modal-toolbar {
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 0 0 14px;
}

.audit-modal-toolbar input {
  width: min(440px, 70%);
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 7px 10px;
  color: var(--ink);
  background: #fff;
  outline: none;
}

.audit-modal-toolbar input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 139, 141, 0.12);
}

.audit-modal-toolbar span {
  margin-left: auto;
  color: var(--muted);
  font-size: 13px;
}

.audit-modal .audit-list {
  border-top: 1px solid var(--line);
}

.audit-heading input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 139, 141, 0.12);
}

.audit-list {
  flex: 1;
  min-height: 0;
  display: block;
  max-height: none;
  overflow: auto;
  padding: 0 16px;
}

.audit-item {
  display: grid;
  grid-template-columns: minmax(150px, 0.8fr) 190px 180px minmax(220px, 1.5fr);
  gap: 14px;
  align-items: center;
  min-height: 42px;
  border-bottom: 1px solid var(--line);
}

.audit-item p {
  margin: 0;
}

.audit-item code {
  white-space: normal;
  word-break: break-word;
  color: var(--accent);
}

.confirm-backdrop {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(7, 18, 27, 0.42);
  backdrop-filter: blur(4px);
}

.confirm-modal {
  width: min(460px, 100%);
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 14px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 26px 80px rgba(7, 18, 27, 0.28);
}

.confirm-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  color: #fff;
  background: #f59e0b;
  font-weight: 900;
}

.confirm-modal.danger .confirm-icon {
  background: #dc2626;
}

.confirm-modal.info .confirm-icon {
  background: var(--accent);
}

.confirm-modal h2 {
  margin: 0 0 6px;
  font-size: 20px;
}

.confirm-modal p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
  white-space: pre-line;
}

.confirm-modal footer {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 6px;
}

.confirm-modal button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 8px 13px;
  color: var(--ink);
  background: #fff;
  cursor: pointer;
  font-weight: 800;
}

.confirm-modal .confirm-primary {
  border-color: var(--accent);
  color: #fff;
  background: var(--accent);
}

.confirm-modal.danger .confirm-primary {
  border-color: #dc2626;
  background: #dc2626;
}

.confirm-modal.warning .confirm-primary {
  border-color: #f59e0b;
  background: #f59e0b;
}

.toast-stack {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 90;
  display: grid;
  gap: 10px;
  max-width: min(420px, calc(100vw - 44px));
}

.toast {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 3px 10px;
  padding: 13px 14px;
  border: 1px solid #bbf7d0;
  border-left: 5px solid #16a34a;
  border-radius: 12px;
  color: var(--ink);
  background: #f0fdf4;
  box-shadow: 0 18px 50px rgba(7, 18, 27, 0.18);
}

.toast.error {
  border-color: #fecaca;
  border-left-color: #dc2626;
  background: #fef2f2;
}

.toast strong {
  font-size: 12px;
}

.toast span {
  grid-column: 1;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.toast button {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: start;
  border: 0;
  padding: 0 2px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-weight: 900;
}

/* Codify light redesign */
.shell {
  grid-template-columns: 284px minmax(0, 1fr);
  background: var(--bg);
}

.sidebar {
  gap: 20px;
  padding: 18px 16px 14px;
  color: var(--ink);
  background: var(--rail);
  border-right: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  min-height: 42px;
  padding: 2px 4px;
}

.sidebar-logo {
  width: 124px;
  height: auto;
  display: block;
}

.brand-mark,
.auth-mark,
.empty-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  color: #fff;
  background: var(--accent);
  font-weight: 800;
}

.brand strong {
  font-size: 18px;
}

.file-command {
  min-height: 46px;
  border-color: var(--line);
  border-radius: 10px;
  color: var(--ink);
  background: #fff;
}

.file-command > span,
.kicker,
.station-kicker {
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.file-command small,
.field span,
.metric span,
.muted,
.panel-heading span,
.audit-item span,
.audit-item p,
.date-cell {
  color: var(--muted);
}

.file-command b {
  color: var(--muted);
  letter-spacing: 0;
}

.file-command:hover {
  border-color: var(--accent-line);
  background: var(--surface-2);
}

.sidebar-section {
  gap: 12px;
  padding-top: 0;
  border-top: 0;
}

.sidebar-section h2 {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.question-heading {
  gap: 12px;
}

.question-heading > div:first-child > strong {
  color: var(--muted);
}

.question-search {
  border-color: var(--line);
  color: var(--ink);
  background: #fff;
}

.question-search::placeholder {
  color: var(--muted-2);
}

.question-search:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(50, 87, 232, 0.12);
}

.question-group-row {
  display: grid;
  gap: 8px;
  border: 1px solid var(--accent-line);
  border-radius: 10px;
  padding: 8px 9px;
  color: var(--ink);
  background: var(--accent-soft);
  cursor: pointer;
}

.question-group-row.active {
  box-shadow: inset 3px 0 0 var(--accent);
}

.question-group-row header {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr) auto;
  gap: 7px;
  align-items: center;
}

.question-group-row header > strong {
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.question-group-row header > input[type="checkbox"] {
  width: 14px;
  height: 14px;
  margin: 0;
  accent-color: var(--accent);
}

.group-arrow {
  width: 20px;
  height: 20px;
  border: 0;
  border-radius: 5px;
  color: var(--accent-strong);
  background: transparent;
  cursor: pointer;
  font-size: 14px;
  font-weight: 900;
  line-height: 1;
  transform: rotate(0deg);
}

.group-arrow.expanded {
  transform: rotate(90deg);
}

.group-name-input {
  min-width: 0;
  border: 0;
  padding: 2px 4px;
  color: var(--accent-strong);
  background: transparent;
  font: inherit;
  font-weight: 900;
  outline: none;
}

.group-name-input:focus {
  border-radius: 5px;
  background: #fff;
  box-shadow: 0 0 0 2px rgba(50, 87, 232, 0.12);
}

.question-group-members {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding-left: 41px;
}

.question-group-members span {
  max-width: 100%;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--accent-line);
  border-radius: 999px;
  padding: 3px 6px 3px 8px;
  color: var(--accent-strong);
  background: #fff;
  font-size: 12px;
  font-weight: 800;
}

.question-group-members button {
  width: 17px;
  height: 17px;
  border: 0;
  border-radius: 999px;
  color: var(--muted);
  background: var(--surface-2);
  cursor: pointer;
  font-size: 10px;
  font-weight: 900;
  line-height: 1;
}

.compact-metrics {
  gap: 8px;
}

.compact-metrics span {
  min-height: 64px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--muted);
  background: #fff;
  letter-spacing: 0.08em;
}

.compact-metrics b {
  margin-top: 5px;
  color: var(--ink);
  font-size: 20px;
  letter-spacing: 0;
}

.compact-metrics span:last-child b {
  color: var(--accent);
}

.question-list {
  gap: 10px;
}

.question {
  gap: 8px;
  border: 1px solid transparent;
  border-bottom-color: var(--line);
  border-radius: 10px;
  color: var(--ink);
  background: transparent;
}

.question strong {
  color: var(--muted);
  font-size: 11px;
}

.question.active {
  border-color: var(--accent-line);
  color: var(--ink);
  background: var(--accent-soft);
  box-shadow: inset 3px 0 0 var(--accent);
}

.question.primary span {
  font-weight: 900;
}

.question-empty {
  color: var(--muted);
}

.online-section {
  padding-bottom: 10px;
}

.user-stack {
  display: flex;
  align-items: center;
  min-height: 34px;
  padding-left: 2px;
}

.user-chip {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: -8px;
  border: 2px solid #fff;
  border-radius: 999px;
  color: #fff;
  background: var(--accent);
  font-size: 10px;
  font-weight: 800;
  box-shadow: 0 1px 2px rgba(27, 26, 23, 0.12);
}

.user-chip > span {
  display: block;
  line-height: 1;
  text-align: center;
}

.user-chip:first-of-type {
  margin-left: 0;
}

.user-chip:hover {
  z-index: 2;
  transform: translateY(-1px);
}

.account-strip {
  margin: 0 -16px -14px;
  padding: 14px 16px;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
}

.account-strip > span {
  border-radius: 10px;
  color: #fff;
  background: var(--accent-strong);
}

.account-strip strong {
  color: var(--ink);
}

.account-strip small,
.account-strip button {
  color: var(--muted);
}

.workspace {
  padding: 0;
  background: var(--bg);
}

.topbar {
  min-height: 92px;
  margin: 0;
  padding: 18px 26px;
  border-bottom: 1px solid var(--line);
}

.topbar h1 {
  margin-top: 6px;
  font-size: 30px;
  letter-spacing: 0;
}

.project-actions {
  gap: 10px;
}

.project-actions .action-menu {
  flex: 0 0 auto;
}

.project-actions select,
.project-actions button,
.project-create-form input,
.project-create-form select,
.study-fields input,
.study-fields select {
  min-height: 42px;
  border-color: var(--line);
  border-radius: 10px;
  color: var(--ink);
  background: #fff;
  box-shadow: 0 1px 2px rgba(27, 26, 23, 0.03);
}

.project-actions button,
.project-create-form button,
.empty-workspace button,
.auth-card button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  background: #fff;
}

.project-actions > button:last-child {
  border-color: var(--accent);
  color: #fff;
  background: var(--accent);
}

.project-actions .action-menu-panel button {
  min-height: 36px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  box-shadow: none;
}

.project-actions .action-menu-panel button:hover {
  background: var(--surface-2);
}

.project-actions .audit-icon-button {
  display: inline-grid;
  place-items: center;
  width: 42px;
  min-width: 42px;
  min-height: 42px;
  height: 42px;
  padding: 0;
  border-color: var(--accent);
  border-radius: 10px;
  color: #fff;
  background: var(--accent);
}

.content-grid {
  padding: 20px 22px;
}

.coding-panels {
  grid-template-columns: minmax(0, 1fr) minmax(340px, 39%);
  gap: 18px;
}

.records-column {
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 14px;
}

.coding-station,
.table-panel,
.codeframe-panel,
.audit-panel,
.file-modal,
.record-info-modal,
.empty-workspace,
.project-setup {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.coding-station {
  overflow: hidden;
  border-left: 3px solid var(--accent);
}

.coding-station > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 53px;
  padding: 0 20px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}

.coding-station > header div {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.coding-station > header span {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.station-response {
  display: grid;
  gap: 8px;
  padding: 18px 22px 10px;
}

.station-response span {
  color: var(--muted-2);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.station-response strong {
  font-size: 24px;
  line-height: 1.25;
}

.station-response-multi {
  padding-bottom: 14px;
}

.selected-response-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 6px;
  max-height: 132px;
  overflow: auto;
}

.selected-response-list article {
  display: grid;
  gap: 2px;
  min-width: 0;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.selected-response-list small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.modal-project-open:disabled,
.modal-project-actions button:disabled {
  cursor: wait;
  opacity: 0.52;
}

.selected-response-list strong {
  overflow: hidden;
  font-size: 12px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.station-multi-hint {
  margin: 0;
  padding: 0 22px 18px;
  color: var(--muted);
  font-size: 13px;
}

.station-codes {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 22px 10px;
}

.code-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  padding: 7px 12px;
  border: 1px solid var(--accent-line);
  border-radius: 8px;
  color: var(--accent-strong);
  background: var(--accent-soft);
  font-size: 13px;
  font-weight: 700;
}

.code-chip.empty {
  color: var(--muted);
  background: #fff;
  border-color: var(--line);
}

.station-actions {
  display: grid;
  grid-template-columns: minmax(120px, 0.35fr) minmax(0, 1fr) auto auto;
  gap: 10px;
  padding: 8px 22px 8px;
}

.multi-station-actions {
  grid-template-columns: minmax(110px, 0.45fr) minmax(150px, 1fr) auto;
  padding-top: 0;
}

.station-field {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-2);
}

.station-field span {
  padding-left: 14px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.station-field input {
  width: 100%;
  border: 0;
  padding: 0 14px 0 8px;
  color: var(--ink);
  background: transparent;
  outline: none;
}

.station-field:focus-within {
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(50, 87, 232, 0.12);
}

.station-field.invalid {
  border-color: #ef4444;
  background: #fff;
}

.station-field.invalid:focus-within {
  border-color: #ef4444;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.14);
}

.station-field.invalid span {
  color: #b91c1c;
}

.station-field-warning {
  grid-column: 1 / -1;
  margin-top: -7px;
  padding: 0 12px 5px;
  color: #dc2626;
  font-size: 9px;
  font-weight: 800;
  line-height: 1.1;
}

.station-field input:disabled {
  cursor: not-allowed;
  opacity: 0.65;
}

.suggest-action,
.skip-action {
  min-height: 46px;
  border-radius: 10px;
  padding: 0 16px;
  cursor: pointer;
  font-weight: 800;
}

.suggest-action {
  border: 1px solid var(--accent-line);
  color: var(--accent-strong);
  background: var(--accent-soft);
}

.skip-action {
  border: 1px solid var(--line);
  color: var(--ink);
  background: #fff;
}

.suggest-action:disabled,
.skip-action:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.quick-match {
  display: block;
  padding: 0 22px 4px;
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 700;
}

.station-shortcuts {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 2px 22px 16px;
  color: var(--muted);
  font-size: 11px;
}

.station-shortcuts kbd {
  min-width: 24px;
  display: inline-flex;
  justify-content: center;
  margin-right: 4px;
  padding: 2px 6px;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--muted);
  background: var(--surface-2);
  font: inherit;
  font-weight: 800;
}

.station-empty {
  margin: 0;
  padding: 28px 22px;
  color: var(--muted);
}

.table-panel,
.codeframe-panel {
  border-radius: 14px;
}

.panel-heading {
  min-height: 66px;
  gap: 12px;
  padding: 0 20px;
  background: var(--surface);
}

.panel-heading h2 {
  font-size: 16px;
}

.panel-search {
  min-width: 180px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-2);
}

.panel-search span {
  padding-left: 11px;
  color: var(--muted-2);
}

.panel-search input {
  width: 100%;
  min-height: 34px;
  border: 0;
  padding: 0 11px 0 6px;
  color: var(--ink);
  background: transparent;
  outline: none;
}

.panel-search:focus-within {
  border-color: var(--accent);
  background: #fff;
}

.records-heading-tools {
  flex: 1;
  gap: 12px;
  justify-content: flex-end;
}

.records-heading-tools > .panel-search {
  max-width: 280px;
  margin-right: auto;
}

.records-heading-tools > span {
  min-width: 78px;
  color: var(--muted);
}

.records-heading-tools label:not(.panel-search) {
  color: var(--ink);
}

.segment-action,
.codeframe-apply-selected {
  min-height: 34px;
  border-color: var(--line);
  border-radius: 9px;
  color: var(--accent-strong);
  background: #fff;
}

.codeframe-apply-selected:not(:disabled) {
  border-color: var(--accent-line);
  background: var(--accent-soft);
}

.table-scroll,
.codeframe-scroll {
  background: #fff;
}

table {
  min-width: 760px;
}

th,
td {
  border-bottom-color: #f3f1ec;
}

th {
  color: var(--muted-2);
  background: var(--surface-2);
  font-size: 11px;
  letter-spacing: 0.08em;
}

.records-table th,
.records-table td,
.codeframe-table th,
.codeframe-table td {
  padding: 10px 12px;
}

.records-table tr {
  cursor: pointer;
}

.records-table tr:hover td,
.codeframe-table tr:hover td {
  background: var(--surface-2);
}

.records-table tr.focused-record td {
  background: var(--accent-soft);
}

.records-table tr.focused-record td:first-child {
  box-shadow: inset 3px 0 0 var(--accent);
}

.records-table tr.coded-record .selection-cell::before {
  background: var(--accent);
}

.selection-cell {
  position: relative;
  text-align: center;
}

.selection-cell::before {
  width: 9px;
  height: 9px;
  position: absolute;
  top: 50%;
  left: 50%;
  display: block;
  transform: translate(-50%, -50%);
  border-radius: 999px;
  background: #dcd8cf;
  content: "";
}

.selection-cell .row-checkbox {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 14px;
  height: 14px;
  margin: 0;
  transform: translate(-50%, -50%);
  opacity: 0;
}

.records-table th:first-child {
  text-align: center;
}

.records-table th:first-child .row-checkbox {
  width: 14px;
  height: 14px;
  margin: 0;
}

.records-table tr:hover .selection-cell .row-checkbox,
.selection-cell .row-checkbox:checked {
  opacity: 1;
}

.row-checkbox {
  accent-color: var(--accent);
}

.id-cell {
  color: var(--accent-strong);
  font-size: 13px;
}

.id-cell small {
  color: var(--muted);
}

.response-cell {
  color: var(--ink);
}

.readonly-code-cell {
  color: var(--accent-strong);
}

.readonly-code-cell span {
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  border-radius: 8px;
  color: inherit;
  font-weight: 700;
}

.readonly-code-cell span {
  width: 100%;
  min-height: 30px;
  padding: 5px 10px;
  border: 1px solid rgba(201, 211, 250, 0.7);
  background: rgba(236, 239, 254, 0.38);
}

.readonly-code-cell span:not(:empty) {
  border: 1px solid var(--accent-line);
  background: var(--accent-soft);
}

.records-table tr.focused-record .readonly-code-cell span {
  border-color: var(--accent-line);
  background: rgba(236, 239, 254, 0.72);
}

.readonly-code-cell small.editing-pill {
  width: 24px;
  height: 24px;
  display: inline-grid;
  box-sizing: border-box;
  place-items: center;
  margin-top: 6px;
  padding: 0;
  border: 1px solid #f5d09a;
  border-radius: 999px;
  color: #fff;
  background: #c97711;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1;
  overflow: hidden;
  white-space: nowrap;
}

.cell-control,
.codeframe-edit-fields input,
.audit-modal-toolbar input,
.audit-heading input {
  border-color: var(--line);
  border-radius: 9px;
}

.cell-control:focus,
.codeframe-edit-fields input:focus,
.audit-modal-toolbar input:focus,
.audit-heading input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(50, 87, 232, 0.12);
}

.info-button {
  border-color: var(--line);
  color: var(--muted);
}

.info-button:hover {
  border-color: var(--accent-line);
  background: var(--accent-soft);
}

.codeframe-panel .panel-heading {
  flex-wrap: wrap;
}

.codeframe-panel .panel-heading .panel-search {
  flex: 1;
  min-width: 180px;
}

.codeframe-table {
  min-width: 440px;
}

.codeframe-table th:first-child,
.codeframe-table td:first-child {
  width: 58px;
}

.codeframe-table th:last-child,
.codeframe-table td:last-child {
  width: 98px;
}

.codeframe-table code {
  color: var(--accent-strong);
  font-family: inherit;
  font-size: 15px;
}

.codeframe-table tr.active-code td {
  background: var(--accent-soft);
}

.apply-cell {
  color: var(--muted);
}

.apply-cell button {
  min-width: 28px;
  min-height: 28px;
  border: 0;
  border-radius: 7px;
  margin-left: 5px;
  padding: 0 8px;
  color: #b9c5ff;
  background: transparent;
  font-size: 20px;
  line-height: 1;
}

.apply-cell button:hover:not(:disabled) {
  color: var(--accent);
  background: var(--accent-soft);
}

.apply-cell .secondary-action {
  border: 1px solid var(--line);
  color: var(--accent-strong);
  background: #fff;
  font-size: 11px;
}

.modal-backdrop {
  background: rgba(27, 26, 23, 0.42);
}

.modal-close,
.codeframe-edit-actions button,
.segmentation-actions button {
  border-color: var(--line);
  border-radius: 9px;
}

.drop-zone,
.modal-project,
.project-setup button,
.import-preview-summary,
.import-column-picker,
.import-table-preview,
.codeframe-file-list article,
.segment-draft {
  border-color: var(--line);
  border-radius: 10px;
  background: var(--surface-2);
}

.modal-project.active,
.modal-project:hover,
.drop-zone.dragging,
.drop-zone:hover,
.import-column-options > label.selected {
  border-color: var(--accent-line);
  background: var(--accent-soft);
}

.auth-shell {
  background: var(--bg);
}

.auth-card {
  color: var(--ink);
  background: #fff;
  border-color: var(--line);
  box-shadow: var(--shadow);
}

.auth-card > p:not(.kicker) {
  color: var(--muted);
}

.auth-card button,
.empty-workspace button {
  border-color: var(--accent);
  color: #fff;
  background: var(--accent);
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--bg);
}

.auth-card {
  width: min(420px, 100%);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--ink);
  background: #fff;
  box-shadow: var(--shadow);
  text-align: center;
}

.auth-logo {
  width: 168px;
  height: auto;
  display: block;
  margin: 0 auto 24px;
}

.auth-copy {
  display: grid;
  gap: 8px;
  margin-bottom: 22px;
}

.auth-copy .kicker {
  margin: 0;
}

.auth-copy h1 {
  margin: 0;
  font-size: 28px;
}

.auth-copy p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.auth-primary {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--accent);
  border-radius: 10px;
  color: #fff;
  background: var(--accent);
  cursor: pointer;
  font-weight: 800;
}

.auth-primary:hover {
  background: var(--accent-strong);
}

.auth-note {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.auth-loader {
  margin: 2px auto 0;
  border-color: rgba(50, 87, 232, 0.16);
  border-top-color: var(--accent);
}

@media (max-width: 1100px) {
  .content-grid {
    grid-template-columns: 1fr;
  }

  .audit-panel {
    position: static;
  }
}

@media (max-width: 720px) {
  body {
    overflow: auto;
  }

  .shell {
    height: auto;
    min-height: 100vh;
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    overflow: visible;
  }

  .workspace {
    height: auto;
    overflow: visible;
  }

  .content-grid {
    grid-template-rows: auto;
  }

  .coding-panels {
    grid-template-columns: 1fr;
    grid-template-rows: repeat(2, minmax(420px, 65vh));
  }

  .station-actions {
    grid-template-columns: 1fr 1fr;
  }

  .project-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .project-setup > div,
  .project-create-form,
  .study-fields {
    grid-template-columns: 1fr;
  }

  .workspace,
  .sidebar {
    padding: 16px;
  }

  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  h1 {
    font-size: 26px;
  }

  .question-list {
    max-height: 360px;
  }

  .modal-project-list {
    grid-template-columns: 1fr;
  }

  .audit-list {
    padding: 0 12px;
  }

  .audit-heading {
    align-items: stretch;
    flex-wrap: wrap;
    padding: 10px 12px;
  }

  .records-heading-tools {
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .segment-drafts {
    grid-template-columns: 1fr;
  }

  .audit-heading input {
    width: 100%;
    margin-left: 0;
    order: 3;
  }

  .audit-item {
    grid-template-columns: 1fr 1fr;
    gap: 5px 10px;
    padding: 9px 0;
  }

  .file-modal {
    padding: 17px;
  }

  .import-preview-summary,
  .import-column-picker > header,
  .import-preview-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .codeframe-import-body,
  .import-modal.has-preview .codeframe-import-body {
    min-height: 0;
    grid-template-columns: 1fr;
    overflow: auto;
  }

  .codeframe-import-sidebar,
  .codeframe-import-main {
    overflow: visible;
  }

  .codeframe-import-sidebar .codeframe-file-list {
    max-height: 260px;
  }

  .codeframe-import-main .drop-zone {
    min-height: 180px;
  }
}
