@import "../shared/noharm-base.css";

* { box-sizing: border-box; }

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--focus-ring);
  outline: none;
}

input::placeholder,
textarea::placeholder {
  color: var(--text-muted);
  opacity: 0.82;
}

select {
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--text-muted) 50%),
    linear-gradient(135deg, var(--text-muted) 50%, transparent 50%);
  background-position:
    calc(100% - 16px) calc(50% - 1px),
    calc(100% - 11px) calc(50% - 1px);
  background-repeat: no-repeat;
  background-size: 5px 5px;
  cursor: pointer;
  padding-right: 36px;
}

input[type="checkbox"],
input[type="radio"] {
  accent-color: var(--accent);
  block-size: 16px;
  flex: 0 0 auto;
  inline-size: 16px;
  margin: 2px 0 0;
}

input[type="file"]:not([hidden]) {
  background: var(--bg-elev);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  color: var(--text-dim);
  font-size: 13px;
  max-width: 100%;
  min-height: 44px;
  padding: 5px 6px;
}

input[type="file"]::file-selector-button {
  appearance: none;
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  margin-right: 10px;
  min-height: 32px;
  padding: 6px 11px;
}

input[type="file"]:hover::file-selector-button {
  border-color: var(--accent);
}

input:disabled,
select:disabled,
textarea:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.app-shell {
  max-width: 1480px;
  margin: 0 auto;
  padding: 36px 24px 64px;
}

.builder-header {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
}

.eyebrow {
  color: var(--text-muted);
  font-size: 11px;
  letter-spacing: 0.12em;
  margin-bottom: 6px;
  text-transform: uppercase;
  font-family: var(--font-mono);
}

.wordmark {
  align-items: baseline;
  color: var(--text);
  display: inline-flex;
  gap: 0;
  margin-bottom: 6px;
}

.wordmark__arise {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.18em;
}

.wordmark__kit {
  font-family: var(--font-display);
  font-size: 15px;
  margin-left: -0.18em;
}

h1,
h2,
h3 {
  margin: 0;
}

h1 {
  font-size: 30px;
  font-weight: 680;
  letter-spacing: -0.02em;
}

h2 {
  font-size: 18px;
}

.subtitle {
  color: var(--text-dim);
  margin: 8px 0 0;
  max-width: 760px;
}

.header-actions {
  align-items: flex-end;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 230px;
}

.save-status {
  color: var(--text-muted);
  font-size: 12px;
}

.save-status.ok {
  color: var(--ok);
}

.save-status.warn {
  color: var(--warn);
}

.page-nav {
  display: flex;
  gap: 10px;
  margin-bottom: 28px;
}

.page-nav a {
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text-dim);
  padding: 7px 12px;
  text-decoration: none;
}

.page-nav a:hover {
  border-color: var(--border-strong);
  color: var(--text);
}

.mode-toggle {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 10px;
  display: inline-flex;
  padding: 4px;
}

.mode-button,
.ghost-button,
.primary-button,
.secondary-button {
  border-radius: 6px;
  border: 1px solid transparent;
  color: var(--text);
}

.mode-button,
.ghost-button,
.secondary-button {
  background: transparent;
}

.mode-button {
  color: var(--text-dim);
  padding: 7px 14px;
}

.mode-button.active {
  background: var(--accent);
  color: #ffffff;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.builder-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: 260px minmax(0, 1fr) minmax(360px, 430px);
  align-items: start;
}

.builder-grid.builder-grid--progress-collapsed {
  grid-template-columns: 0px minmax(0, 1fr) minmax(360px, 430px);
}

.landing-cards {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.submissions {
  margin-top: 48px;
}

.submissions-header {
  margin-bottom: 18px;
}

.submissions-header h2 {
  font-size: 22px;
  margin: 4px 0 8px;
}

.submissions-header .subtitle {
  margin: 0;
  max-width: 720px;
}

.submissions .landing-card {
  min-height: 0;
  opacity: 0.85;
}

.submissions .landing-card h2 {
  font-size: 20px;
}

.landing-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  min-height: 260px;
  padding: 24px;
  text-decoration: none;
}

.landing-card.primary {
  background: var(--brand-gradient);
  border-color: var(--brand-bright);
  color: var(--on-brand);
  grid-column: 1 / -1;
  padding: clamp(36px, 6vw, 72px);
}

.landing-card h2 {
  font-size: 24px;
  margin-bottom: 10px;
}

.landing-card.primary h2 {
  font-family: var(--font-display);
  font-size: clamp(34px, 5vw, 54px);
  font-weight: 400;
  letter-spacing: -0.035em;
  line-height: 1.04;
  max-width: 820px;
}

.landing-card.primary .panel-label,
.landing-card.primary p {
  color: var(--on-brand-muted);
}

.landing-card.primary p {
  line-height: 1.65;
  max-width: 760px;
}

.landing-card.primary .card-action--primary {
  background: var(--on-brand);
  border-color: var(--on-brand);
  color: var(--brand-deep);
}

.landing-card.primary .card-action--primary:hover {
  background: #f4f4f5;
  border-color: #f4f4f5;
}

.landing-card.primary .card-action--secondary {
  border-color: var(--on-brand-border);
  color: var(--on-brand);
}

.landing-card.primary .card-action--secondary:hover {
  border-color: var(--on-brand);
  color: var(--on-brand);
}

.landing-card p {
  color: var(--text-dim);
  margin: 0 0 32px;
}

.landing-card strong {
  color: var(--accent-strong);
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.card-action {
  border: 1px solid var(--border);
  border-radius: 8px;
  display: inline-flex;
  font-size: 14px;
  font-weight: 600;
  padding: 8px 14px;
  text-decoration: none;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
}

.card-action--primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

.card-action--primary:hover {
  background: var(--accent-hover, var(--accent));
  border-color: var(--accent-hover, var(--accent));
}

.card-action--secondary {
  background: transparent;
  color: var(--text);
}

.card-action--secondary:hover {
  border-color: var(--accent);
  color: var(--accent-strong, var(--accent));
}

/* ---------- Case Studio ---------- */

.target-picker {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 14px;
  padding: 12px 14px;
}

.target-picker__head {
  align-items: center;
  display: flex;
  gap: 12px;
}

.target-picker__select {
  background-color: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  padding: 6px 10px;
}

.target-picker__summary {
  color: var(--text-dim);
  font-size: 13px;
  margin: 8px 0 0;
}

.intake-section {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 18px;
  overflow: hidden;
}

.intake-section.is-collapsed {
  background: transparent;
}

.intake-section__head {
  background: var(--bg-elev);
}

.intake-section__toggle {
  align-items: center;
  background: transparent;
  border: 0;
  color: var(--text);
  cursor: pointer;
  display: flex;
  font: inherit;
  gap: 10px;
  padding: 12px 14px;
  text-align: left;
  width: 100%;
}

.intake-section__chev {
  color: var(--text-dim);
  font-size: 12px;
  width: 12px;
}

.intake-section__hint {
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 400;
  margin-left: auto;
}

.intake-section__body {
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
}

.intake-section__actions {
  align-items: center;
  display: flex;
  gap: 14px;
  justify-content: space-between;
}

.intake-section__check {
  align-items: center;
  color: var(--text-dim);
  display: flex;
  font-size: 13px;
  gap: 6px;
}

.intake-result {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
}

.intake-result__head {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
}

.intake-result__grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.intake-result__row {
  align-items: flex-start;
  display: grid;
  gap: 10px;
  grid-template-columns: 14px 90px 1fr;
}

.intake-result__row strong {
  font-size: 13px;
}

.intake-result__row > div {
  color: var(--text-dim);
  font-size: 13px;
}

.intake-result__gaps {
  border-top: 1px solid var(--border);
  margin-top: 12px;
  padding-top: 10px;
}

.intake-result__gaps ul {
  margin: 6px 0 0;
  padding-left: 18px;
}

.confidence-dot {
  border-radius: 999px;
  display: inline-block;
  height: 10px;
  margin-top: 4px;
  width: 10px;
}

.confidence-dot--high {
  background: rgb(80, 180, 120);
}

.confidence-dot--medium {
  background: rgb(220, 170, 80);
}

.confidence-dot--low {
  background: rgb(220, 100, 90);
}

.intake-refine {
  border-top: 1px solid var(--border);
  margin-top: 14px;
  padding-top: 12px;
}

.intake-refine__head {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
}

.intake-refine__thread {
  max-height: 220px;
}

.intake-refine__form textarea {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  padding: 10px 12px;
  width: 100%;
}

.chat-msg__applied {
  color: var(--text-dim);
  font-size: 12px;
  margin-top: 4px;
}

.chat-msg__applied code {
  background: var(--bg);
  border-radius: 4px;
  padding: 1px 6px;
}

.intake-files {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.intake-files__add {
  cursor: pointer;
  display: inline-flex;
  width: max-content;
}

.intake-files__list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  list-style: none;
  margin: 4px 0 0;
  padding: 0;
}

.intake-files__item {
  align-items: center;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr auto auto;
  padding: 6px 10px;
}

.intake-files__name {
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.intake-files__meta {
  color: var(--text-dim);
  font-size: 12px;
}

.field-pager {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}

.field-pager__pill {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-dim);
  cursor: pointer;
  font-size: 12px;
  padding: 5px 12px;
}

.field-pager__pill.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

.field-label {
  font-size: 20px;
  margin: 0 0 6px;
}

.field-prompt {
  color: var(--text-dim);
  margin: 0 0 6px;
}

.field-help {
  color: var(--text-muted, var(--text-dim));
  font-size: 13px;
  margin: 0 0 14px;
}

.field-input {
  background: var(--bg-elev);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  min-height: 42px;
  padding: 11px 13px;
  width: 100%;
}

textarea.field-input {
  line-height: 1.55;
  min-height: 96px;
  resize: vertical;
}

.muted-note {
  color: var(--text-dim);
  font-size: 13px;
  margin: 8px 0;
}

.upload-zone {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 18px;
  padding: 16px;
}

.upload-zone__actions {
  display: flex;
  justify-content: flex-end;
}

.quality-cards {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.quality-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px;
}

.quality-card__head {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin-bottom: 12px;
}

.quality-card__title {
  font-weight: 600;
}

.quality-card__row {
  margin-bottom: 12px;
}

.quality-card__row ul {
  margin: 6px 0 0;
  padding-left: 18px;
}

.phi-pill {
  border-radius: 999px;
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  margin-left: 8px;
  padding: 3px 10px;
}

.phi-pill.is-clear {
  background: rgba(80, 180, 120, 0.15);
  color: rgb(80, 180, 120);
}

.phi-pill.is-flagged {
  background: rgba(220, 100, 90, 0.15);
  color: rgb(220, 100, 90);
}

.phi-referral {
  background: rgba(220, 100, 90, 0.08);
  border: 1px solid rgba(220, 100, 90, 0.4);
  border-radius: 8px;
  color: var(--text);
  font-size: 13px;
  margin: 8px 0 0;
  padding: 8px 12px;
}

.match-toolbar {
  align-items: flex-start;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 18px;
}

.verdict-cards {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.verdict-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
}

.verdict-card--clean {
  border-color: rgba(80, 180, 120, 0.5);
}

.verdict-card--adjustable {
  border-color: rgba(220, 170, 80, 0.5);
}

.verdict-card--miss {
  border-color: rgba(220, 100, 90, 0.45);
  opacity: 0.85;
}

.verdict-card__head {
  align-items: flex-start;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin-bottom: 8px;
}

.verdict-card__title {
  font-weight: 600;
}

.verdict-card__reason {
  color: var(--text-dim);
  font-size: 14px;
  margin: 0 0 8px;
}

.verdict-card__rationale {
  background: var(--bg);
  border-radius: 6px;
  color: var(--text);
  font-size: 13px;
  margin: 8px 0 0;
  padding: 8px 12px;
}

.verdict-card__actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.verdict-pill {
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
  text-transform: uppercase;
}

.verdict-pill--clean {
  background: rgba(80, 180, 120, 0.18);
  color: rgb(80, 180, 120);
}

.verdict-pill--adjustable {
  background: rgba(220, 170, 80, 0.18);
  color: rgb(220, 170, 80);
}

.verdict-pill--miss {
  background: rgba(220, 100, 90, 0.18);
  color: rgb(220, 100, 90);
}

.verdict-pill--pending {
  background: var(--bg);
  color: var(--text-dim);
}

.novelty-card {
  background: var(--bg-elev);
  border: 1px dashed var(--border);
  border-radius: 10px;
  margin-top: 16px;
  padding: 12px 14px;
}

.chat-context {
  margin-bottom: 12px;
}

.chat-thread {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
  max-height: 360px;
  overflow-y: auto;
  padding: 12px;
}

.chat-msg {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.chat-msg__role {
  color: var(--text-dim);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.chat-msg__body {
  background: var(--bg-elev);
  border-radius: 6px;
  padding: 8px 12px;
  white-space: pre-wrap;
}

.chat-msg--user .chat-msg__body {
  background: rgba(80, 130, 200, 0.12);
}

.chat-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.phase-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  padding: 10px 12px;
  text-align: left;
  width: 100%;
}

.phase-card.active {
  border-color: var(--accent);
}

.phase-card__head {
  align-items: center;
  display: flex;
  gap: 8px;
  margin-bottom: 6px;
}

.phase-card__num {
  background: var(--bg-elev);
  border-radius: 999px;
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
}

.phase-card__title {
  font-weight: 600;
}

.phase-card__bar {
  background: var(--bg-elev);
  border-radius: 2px;
  height: 4px;
  margin-bottom: 4px;
  overflow: hidden;
}

.phase-card__bar span {
  background: var(--accent);
  display: block;
  height: 100%;
}

.phase-card__caption {
  color: var(--text-dim);
  font-size: 11px;
}

.step-context__phase {
  color: var(--text-dim);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.step-context__desc {
  margin: 6px 0 18px;
}

.progress-panel,
.work-panel,
.artifact-panel {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.progress-panel,
.artifact-panel {
  min-width: 0;
  padding: 18px;
  position: sticky;
  top: 18px;
}

.progress-panel.is-collapsed {
  background: transparent;
  border: 0;
  border-radius: 0;
  margin: 0;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
  padding: 0;
  visibility: hidden;
}

.progress-panel__header {
  margin-bottom: 12px;
}

.progress-panel .progress-panel__header .panel-label {
  margin-bottom: 0;
}

/* Viewport-edge rail: no outer padding/margin; flush to left, tab shape on the right only. */
.progress-panel__toggle {
  align-items: center;
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-left: 0;
  border-radius: 0 6px 6px 0;
  color: var(--text-dim);
  cursor: pointer;
  display: flex;
  flex-shrink: 0;
  height: 48px;
  justify-content: center;
  left: max(0px, env(safe-area-inset-left, 0px));
  margin: 0;
  padding: 0;
  position: fixed;
  top: 50%;
  transform: translateY(-50%);
  width: 22px;
  z-index: 200;
}

.progress-panel__toggle:hover {
  border-color: var(--accent);
  color: var(--text);
}

.progress-panel__toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.progress-panel__icon {
  flex-shrink: 0;
}

.progress-panel__icon--show {
  display: none;
}

.progress-panel__toggle[aria-expanded="false"] .progress-panel__icon--hide {
  display: none;
}

.progress-panel__toggle[aria-expanded="false"] .progress-panel__icon--show {
  display: block;
}

.progress-panel.is-collapsed .progress-panel__body {
  display: none;
}

.work-panel {
  min-height: 640px;
  padding: 22px;
}

.panel-label {
  color: var(--text-muted);
  font-size: 11px;
  letter-spacing: 0.11em;
  margin-bottom: 12px;
  text-transform: uppercase;
}

.phase-list {
  display: grid;
  gap: 12px;
}

.phase-card {
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  padding: 14px;
  text-align: left;
  width: 100%;
}

.phase-card.active {
  border-color: var(--accent);
}

.phase-card-title {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.phase-card small {
  color: var(--text-muted);
}

.progress-bar {
  background: var(--bg);
  border-radius: 10px;
  height: 8px;
  overflow: hidden;
}

.progress-bar span {
  background: var(--accent);
  display: block;
  height: 100%;
  width: 0;
}

.step-context {
  border-bottom: 1px solid var(--border);
  margin: -2px 0 20px;
  padding-bottom: 16px;
}

.step-kicker {
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.step-context h2 {
  font-size: 24px;
  margin-top: 4px;
}

.step-context p {
  color: var(--text-dim);
  margin: 8px 0 0;
}

.form-card {
  display: grid;
  gap: 14px;
}

.field-label {
  color: var(--text);
  display: block;
  font-weight: 650;
  margin-bottom: 6px;
}

.field-help {
  color: var(--text-muted);
  margin: 0 0 10px;
}

.text-input,
.textarea-input,
.select-input {
  background-color: var(--bg-elev);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  color: var(--text);
  outline: none;
  min-height: 42px;
  padding: 11px 13px;
  width: 100%;
}

.textarea-input {
  line-height: 1.55;
  min-height: 150px;
  resize: vertical;
}

.textarea-ai-wrap {
  position: relative;
}

.textarea-input-with-ai {
  padding-right: 42px;
}

.ai-improve-button {
  align-items: center;
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  border-radius: 6px;
  color: var(--accent-strong);
  display: inline-flex;
  font-size: 10px;
  font-weight: 700;
  height: 20px;
  justify-content: center;
  line-height: 1;
  padding: 0;
  position: absolute;
  right: 8px;
  top: 8px;
  width: 20px;
}

.ai-improve-button:hover,
.ai-improve-button:focus-visible {
  background: var(--accent-soft-strong);
  border-color: var(--accent);
  color: var(--text);
}

.ai-improve-button:disabled {
  cursor: wait;
  opacity: 0.72;
}

.text-input:focus,
.textarea-input:focus,
.select-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: space-between;
  margin-top: 20px;
}

.button-group {
  display: flex;
  gap: 10px;
}

.primary-button {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
  padding: 10px 16px;
}

.secondary-button,
.ghost-button {
  border-color: var(--border);
  color: var(--text-dim);
  padding: 10px 14px;
}

.ghost-button.active,
.secondary-button:hover,
.ghost-button:hover {
  border-color: var(--accent);
  color: var(--text);
}

/* Guided step footer: wider primary actions (~50% wider than default padding). */
.form-card .action-row .button-group .secondary-button {
  padding-left: 30px;
  padding-right: 30px;
}

.form-card .action-row .button-group .primary-button {
  padding-left: 32px;
  padding-right: 32px;
}

.form-card .action-row > .ghost-button {
  padding-left: 38px;
  padding-right: 38px;
}

.full-width {
  width: 100%;
}

.chat-shell {
  display: grid;
  gap: 14px;
}

.chat-log {
  background: linear-gradient(180deg, var(--accent-wash), transparent 38%);
  border: 1px solid var(--border);
  border-radius: 10px;
  display: grid;
  gap: 12px;
  max-height: 340px;
  min-height: 240px;
  overflow: auto;
  padding: 14px;
}

.chat-message {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  white-space: pre-wrap;
}

.chat-message.agent {
  background: var(--bg-elev-2);
  margin-right: 34px;
}

.chat-message.user {
  background: var(--accent-soft);
  border-color: var(--accent-border);
  margin-left: 32px;
}

.chat-message-label {
  color: var(--text-muted);
  font-size: 11px;
  letter-spacing: 0.08em;
  margin-bottom: 4px;
  text-transform: uppercase;
}

.draft-suggestion {
  align-items: flex-start;
  background: rgba(52, 211, 153, 0.08);
  border: 1px solid rgba(52, 211, 153, 0.28);
  border-radius: 10px;
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(0, 1fr) auto;
  padding: 14px;
}

.draft-suggestion p {
  color: var(--text);
  margin: 0;
  white-space: pre-wrap;
}

.draft-suggestion small {
  color: var(--text-dim);
  display: block;
  margin-top: 8px;
}

.chat-error {
  background: rgba(248, 113, 113, 0.1);
  border: 1px solid rgba(248, 113, 113, 0.32);
  border-radius: 10px;
  color: var(--danger);
  padding: 10px 12px;
}

.chat-prompts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.prompt-chip {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-dim);
  padding: 7px 10px;
}

.prompt-chip:hover,
.prompt-chip:focus-visible {
  border-color: var(--accent);
  color: var(--text);
}

.chat-composer {
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  display: grid;
  gap: 12px;
  padding: 14px;
  position: sticky;
  bottom: 12px;
}

.chat-input {
  min-height: 92px;
}

.artifact-answer {
  border-top: 1px solid var(--border);
  padding-top: 12px;
}

.artifact-draft-input {
  min-height: 96px;
}

.primary-button:disabled,
.secondary-button:disabled,
.ghost-button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

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

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

.artifact-actions .ghost-button {
  padding: 6px 10px;
}

.artifact-preview {
  background: #05070a;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: #dbeafe;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  line-height: 1.5;
  margin: 0 0 14px;
  max-height: 560px;
  overflow: auto;
  padding: 14px;
  white-space: pre-wrap;
}

@media (prefers-color-scheme: light) {
  .artifact-preview {
    background: #0f172a;
  }
}

.hidden {
  display: none !important;
}

.version-badge {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 10px;
  bottom: 12px;
  color: var(--text-muted);
  font-size: 11px;
  padding: 4px 8px;
  position: fixed;
  right: 12px;
}

@media (max-width: 1160px) {
  .builder-grid {
    grid-template-columns: 220px minmax(0, 1fr);
  }

  .builder-grid.builder-grid--progress-collapsed {
    grid-template-columns: 0px minmax(0, 1fr);
  }

  .artifact-panel {
    grid-column: 1 / -1;
    position: static;
  }
}

@media (max-width: 760px) {
  .app-shell {
    padding: 24px 14px 48px;
  }

  .builder-header,
  .header-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .builder-grid,
  .builder-grid.builder-grid--progress-collapsed {
    grid-template-columns: 1fr;
  }

  .landing-cards {
    grid-template-columns: 1fr;
  }

  .progress-panel {
    position: static;
  }

  .progress-panel.is-collapsed {
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: 10px;
    margin: 0;
    min-width: 0;
    overflow: visible;
    padding: 18px;
    visibility: visible;
  }

  .progress-panel.is-collapsed .progress-panel__header {
    margin-bottom: 12px;
  }

  .progress-panel.is-collapsed .progress-panel__header .panel-label {
    clip: auto;
    height: auto;
    margin: 0;
    overflow: visible;
    position: static;
    width: auto;
    white-space: normal;
  }

  .chat-message.agent,
  .chat-message.user {
    margin-left: 0;
    margin-right: 0;
  }

  .draft-suggestion {
    grid-template-columns: 1fr;
  }

  .chat-composer {
    bottom: 0;
    position: static;
  }
}

/* ---------- Annotation Studio ---------- */

.annotation-item-navigator {
  margin-top: 18px;
}

.annotation-item-navigator__label {
  margin-bottom: 8px;
}

.annotation-item-navigator__rows {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.annotation-item-row {
  align-items: center;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  display: flex;
  gap: 8px;
  justify-content: space-between;
  padding: 8px 10px;
  text-align: left;
  width: 100%;
}

.annotation-item-row:hover {
  border-color: var(--border-strong);
}

.annotation-item-row.is-current {
  border-color: var(--accent);
}

.annotation-item-row__title {
  font-size: 12px;
  font-weight: 600;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.annotation-item-row__status {
  border-radius: 999px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 2px 8px;
  text-transform: uppercase;
  white-space: nowrap;
}

.annotation-item-row__status--todo {
  background: rgba(108, 116, 134, 0.15);
  color: var(--text-muted);
}

.annotation-item-row__status--in_progress {
  background: rgba(245, 158, 11, 0.18);
  color: var(--warn);
}

.annotation-item-row__status--done {
  background: rgba(52, 211, 153, 0.18);
  color: var(--ok);
}

.annotation-banner {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text-dim);
  margin-bottom: 16px;
  padding: 12px 14px;
}

.annotation-banner--danger {
  border-color: var(--danger);
  color: var(--danger);
}

.annotation-field {
  margin-bottom: 18px;
}

.annotation-select {
  background-color: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  margin-top: 8px;
  padding: 8px 10px;
  width: 100%;
}

.annotation-source-fields {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.annotation-source-upload {
  align-items: center;
  display: flex;
  gap: 10px;
  margin: 0 0 18px;
}

.annotation-dataset-summary {
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin: 12px 0 18px;
  padding: 12px 14px;
}

.annotation-dataset-summary ul {
  margin: 8px 0 0;
  padding-left: 18px;
}

.annotation-source-actions {
  margin-top: 8px;
}

.annotation-item-header {
  align-items: flex-start;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin-bottom: 14px;
}

.annotation-item-title {
  font-size: 20px;
  margin: 4px 0 0;
}

.annotation-stem {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 18px;
  padding: 12px 14px;
}

.annotation-stem summary {
  cursor: pointer;
  font-weight: 600;
  margin-bottom: 6px;
}

.annotation-stem__body {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin: 8px 0 0;
  max-height: 320px;
  overflow: auto;
  padding: 10px 12px;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.annotation-reference {
  border-top: 1px dashed var(--border);
  margin-top: 12px;
  padding-top: 10px;
}

.annotation-reference > div {
  color: var(--text-dim);
  margin-top: 4px;
}

.annotation-label-body,
.annotation-grade-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.annotation-output-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
}

.annotation-output-card__head {
  align-items: center;
  display: flex;
  gap: 8px;
  justify-content: space-between;
  margin-bottom: 8px;
}

.annotation-output-card__id {
  color: var(--text-muted);
  font-size: 11px;
  margin-left: 8px;
}

.annotation-output-card__content {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin: 0 0 14px;
  max-height: 260px;
  overflow: auto;
  padding: 10px 12px;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.annotation-rubric {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.annotation-rubric-row {
  border-top: 1px dashed var(--border);
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(120px, 1fr) minmax(0, 2fr);
  padding-top: 12px;
}

.annotation-rubric-row:first-child {
  border-top: 0;
  padding-top: 0;
}

.annotation-rubric-row__meta strong {
  display: block;
  margin-bottom: 4px;
}

.annotation-score-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.annotation-score-btn {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-weight: 600;
  min-width: 36px;
  padding: 6px 10px;
}

.annotation-score-btn:hover {
  border-color: var(--border-strong);
}

.annotation-score-btn.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

.annotation-rationale {
  min-height: 56px;
}

.annotation-others {
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-top: 14px;
  padding: 10px 12px;
}

.annotation-others__toggle {
  align-items: center;
  background: transparent;
  border: 0;
  color: var(--text);
  display: flex;
  gap: 8px;
  padding: 0;
  text-align: left;
  width: 100%;
}

.annotation-others__body {
  margin-top: 10px;
}

.annotation-rater-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 8px;
  padding: 10px 12px;
}

.annotation-rater-card header {
  display: flex;
  gap: 8px;
  margin-bottom: 6px;
}

.annotation-rater-card__name {
  font-weight: 600;
}

.annotation-rater-card__role {
  color: var(--text-muted);
  font-size: 11px;
}

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

.annotation-panel-table th,
.annotation-panel-table td {
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  padding: 6px 8px;
  text-align: left;
  vertical-align: top;
}

.annotation-panel-table th {
  color: var(--text-dim);
  font-weight: 600;
}

.annotation-item-nav {
  align-items: center;
  display: flex;
  gap: 10px;
  justify-content: space-between;
  margin-top: 18px;
}

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

.annotation-concordance-summary {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 10px;
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 18px;
  padding: 14px;
}

.annotation-concordance-summary strong {
  display: block;
  font-size: 22px;
  margin-top: 4px;
}

.annotation-concordance-table {
  border-collapse: collapse;
  margin-bottom: 18px;
  width: 100%;
}

.annotation-concordance-table th,
.annotation-concordance-table td {
  border-bottom: 1px solid var(--border);
  padding: 8px 10px;
  text-align: left;
}

.annotation-concordance-table th {
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.annotation-disagreements {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.annotation-disagreement-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
}

.annotation-disagreement-card header {
  align-items: center;
  display: flex;
  gap: 10px;
  justify-content: space-between;
}

.annotation-disagreement-card__severity {
  align-items: center;
  display: flex;
  gap: 8px;
}

.annotation-disagreement-card__severity > span {
  background: rgba(248, 113, 113, 0.15);
  border-radius: 999px;
  color: var(--danger);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 2px 8px;
  text-transform: uppercase;
}

.annotation-disagreement-card__body {
  display: none;
  margin-top: 12px;
}

.annotation-disagreement-card.is-open .annotation-disagreement-card__body {
  display: block;
}

.annotation-consensus-editor {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 12px;
}

.annotation-consensus-score {
  max-width: 160px;
}

.annotation-consensus-actions {
  align-items: center;
  display: flex;
  gap: 10px;
  margin-top: 8px;
}

@media (max-width: 1080px) {
  .annotation-rubric-row {
    grid-template-columns: 1fr;
  }

  .annotation-concordance-summary {
    grid-template-columns: 1fr;
  }
}

/* ---------- Annotation Studio v2 (Argilla-style) ---------- */

.annotation-stage {
  align-items: start;
  display: grid;
  gap: 18px;
  grid-template-columns: 300px minmax(0, 1fr) minmax(320px, 380px);
}

.annotation-stage[data-phase="annotate"] {
  grid-template-columns: 320px minmax(0, 1fr) 360px;
}

.annotation-queue,
.annotation-record,
.annotation-meta {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
}

.annotation-record {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 620px;
}

.annotation-meta {
  padding: 0;
  position: sticky;
  top: 16px;
}

kbd,
.kbd-inline {
  background: var(--bg-elev-2);
  border: 1px solid var(--border-strong);
  border-radius: 5px;
  color: var(--text-dim);
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 1px 5px;
}

.kbd-inline {
  margin-left: 4px;
}

/* ---- Queue rail ---- */

.annotation-queue-rail {
  margin-top: 14px;
}

.annotation-queue__header {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
}

.annotation-queue__progress {
  align-items: center;
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  display: flex;
  gap: 12px;
  padding: 8px 10px;
}

.annotation-queue__progress strong {
  display: block;
  font-size: 14px;
  margin-top: 2px;
}

.annotation-queue__progressbar {
  background: var(--border);
  border-radius: 999px;
  flex: 1;
  height: 6px;
  overflow: hidden;
}

.annotation-queue__progressbar span {
  background: var(--accent);
  display: block;
  height: 100%;
  transition: width 0.2s ease;
}

.annotation-queue__search {
  align-items: center;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  display: flex;
  gap: 6px;
  padding: 6px 10px;
}

.annotation-queue__search input {
  background: transparent;
  border: 0;
  color: var(--text);
  flex: 1;
  outline: none;
}

.annotation-queue__filters {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.annotation-queue__chip {
  align-items: center;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-dim);
  display: inline-flex;
  font-size: 11px;
  font-weight: 600;
  gap: 6px;
  padding: 4px 8px;
}

.annotation-queue__chip:hover {
  border-color: var(--border-strong);
  color: var(--text);
}

.annotation-queue__chip.is-active {
  background: var(--bg-elev-2);
  border-color: var(--accent);
  color: var(--text);
}

.annotation-queue__count {
  background: var(--bg-elev-2);
  border-radius: 999px;
  color: var(--text-muted);
  font-size: 10px;
  padding: 1px 6px;
}

.annotation-queue__chip.is-active .annotation-queue__count {
  background: var(--accent);
  color: #ffffff;
}

.annotation-queue__rows {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 540px;
  overflow-y: auto;
}

.annotation-queue__row {
  align-items: center;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  cursor: pointer;
  display: grid;
  gap: 8px;
  grid-template-columns: 6px 1fr auto;
  padding: 10px 12px;
  text-align: left;
}

.annotation-queue__row:hover {
  border-color: var(--border-strong);
}

.annotation-queue__row.is-current {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.annotation-queue__status-dot {
  background: var(--text-muted);
  border-radius: 999px;
  height: 8px;
  width: 8px;
}

.annotation-queue__status-dot--pending {
  background: var(--text-muted);
}

.annotation-queue__status-dot--draft {
  background: var(--warn);
}

.annotation-queue__status-dot--submitted {
  background: var(--ok);
}

.annotation-queue__status-dot--discarded {
  background: var(--danger);
}

.annotation-queue__row-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.annotation-queue__row-title {
  font-size: 13px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.annotation-queue__row-meta {
  color: var(--text-muted);
  font-size: 11px;
}

.annotation-queue__row-status {
  border-radius: 999px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 2px 8px;
  text-transform: uppercase;
  white-space: nowrap;
}

.annotation-queue__row-status--pending {
  background: rgba(108, 116, 134, 0.15);
  color: var(--text-muted);
}

.annotation-queue__row-status--draft {
  background: rgba(245, 158, 11, 0.18);
  color: var(--warn);
}

.annotation-queue__row-status--submitted {
  background: rgba(52, 211, 153, 0.18);
  color: var(--ok);
}

.annotation-queue__row-status--discarded {
  background: rgba(248, 113, 113, 0.18);
  color: var(--danger);
}

/* ---- Status chip (header / record / metadata) ---- */

.annotation-status-chip {
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 3px 10px;
  text-transform: uppercase;
}

.annotation-status-chip--pending {
  background: rgba(108, 116, 134, 0.15);
  color: var(--text-muted);
}

.annotation-status-chip--draft {
  background: rgba(245, 158, 11, 0.18);
  color: var(--warn);
}

.annotation-status-chip--submitted {
  background: rgba(52, 211, 153, 0.18);
  color: var(--ok);
}

.annotation-status-chip--discarded {
  background: rgba(248, 113, 113, 0.18);
  color: var(--danger);
}

/* ---- Setup card (Phase 1) ---- */

.annotation-setup-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  max-width: 760px;
  padding: 24px;
}

.annotation-setup-card__head {
  border-bottom: 1px solid var(--border);
  margin-bottom: 18px;
  padding-bottom: 14px;
}

.annotation-setup-card__head h2 {
  margin: 4px 0 6px;
}

/* ---- Record view (Phase 2) ---- */

.annotation-record-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 18px;
}

.annotation-record-card__head {
  align-items: flex-start;
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.annotation-record-card__title {
  font-size: 20px;
  margin: 4px 0 0;
}

.annotation-stem-block {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
}

.annotation-stem-block summary {
  cursor: pointer;
  font-weight: 600;
  margin-bottom: 6px;
}

.annotation-stem-block__body {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin: 8px 0 0;
  max-height: 280px;
  overflow: auto;
  padding: 10px 12px;
  white-space: pre-wrap;
  word-wrap: break-word;
}

/* Label-mode record body */

.annotation-label-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Grade-mode record body */

.annotation-grade-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.annotation-output-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.annotation-output-tab {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-dim);
  display: inline-flex;
  font-size: 12px;
  font-weight: 600;
  gap: 6px;
  padding: 5px 12px;
}

.annotation-output-tab:hover {
  border-color: var(--border-strong);
  color: var(--text);
}

.annotation-output-tab.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

.annotation-output-tab__badge {
  background: var(--bg-elev-2);
  border-radius: 999px;
  color: var(--text-muted);
  font-size: 10px;
  padding: 1px 6px;
}

.annotation-output-tab.is-active .annotation-output-tab__badge {
  background: rgba(255, 255, 255, 0.2);
  color: #ffffff;
}

.annotation-output-content {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
}

.annotation-output-content__head {
  align-items: center;
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.annotation-output-content__id {
  color: var(--text-muted);
  font-size: 11px;
}

.annotation-output-content__body {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin: 0;
  max-height: 240px;
  overflow: auto;
  padding: 10px 12px;
  white-space: pre-wrap;
  word-wrap: break-word;
}

/* Rubric rows (inline within Grade view) */

.annotation-rubric--inline {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 4px 0;
}

.annotation-rubric--inline .annotation-rubric-row {
  border-top: 1px dashed var(--border);
  margin: 0;
  outline: none;
  padding: 14px;
  transition: background 0.12s ease, border-color 0.12s ease;
}

.annotation-rubric--inline .annotation-rubric-row:first-child {
  border-top: 0;
}

.annotation-rubric-row.is-focused {
  background: var(--bg-elev-2);
  box-shadow: inset 3px 0 0 var(--accent);
}

.annotation-rubric-row__title {
  align-items: center;
  display: flex;
  gap: 8px;
  margin-bottom: 4px;
}

.annotation-rubric-row__hint {
  color: var(--text-muted);
  font-size: 11px;
}

.annotation-rubric-row__anchors {
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  font-size: 11px;
  gap: 2px;
  margin-top: 6px;
}

.annotation-rubric-row__anchors span {
  align-items: baseline;
  display: flex;
  gap: 6px;
}

/* ---- Sticky action bar ---- */

.annotation-action-bar {
  align-items: center;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  bottom: 12px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin-top: 8px;
  padding: 10px 14px;
  position: sticky;
  z-index: 4;
}

.annotation-action-bar__group {
  align-items: center;
  display: flex;
  gap: 8px;
}

.annotation-action-bar__group--primary {
  flex: 1;
  justify-content: flex-end;
}

.annotation-action-bar__hint {
  color: var(--text-muted);
  font-size: 11px;
}

/* Primary submit button gets a stronger emphasis in the action bar */
.annotation-action-bar .primary-button {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
  font-weight: 600;
  padding: 8px 16px;
}

.annotation-action-bar .ghost-button {
  border: 1px solid var(--border);
  padding: 6px 12px;
}

/* ---- Right-rail metadata ---- */

.annotation-meta-tabs {
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  padding: 12px 12px 0;
}

.annotation-meta-tab {
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 600;
  padding: 8px 12px;
}

.annotation-meta-tab:hover {
  color: var(--text);
}

.annotation-meta-tab.is-active {
  border-bottom-color: var(--accent);
  color: var(--text);
}

.annotation-meta-body {
  padding: 14px 16px 16px;
}

.annotation-meta-section {
  margin-bottom: 16px;
}

.annotation-meta-section:last-child {
  margin-bottom: 0;
}

.annotation-meta-dl {
  display: grid;
  gap: 4px 12px;
  grid-template-columns: minmax(0, max-content) minmax(0, 1fr);
  margin: 10px 0 0;
}

.annotation-meta-dl dt {
  color: var(--text-muted);
  font-size: 11px;
}

.annotation-meta-dl dd {
  font-size: 13px;
  margin: 0;
  word-break: break-word;
}

.annotation-meta-rubric-row {
  border-top: 1px dashed var(--border);
  margin-top: 10px;
  padding-top: 10px;
}

.annotation-meta-rubric-row:first-child {
  border-top: 0;
  margin-top: 0;
  padding-top: 0;
}

.annotation-meta-anchors {
  color: var(--text-dim);
  font-size: 12px;
  list-style: none;
  margin: 6px 0 0;
  padding: 0;
}

.annotation-meta-anchors li {
  margin: 2px 0;
}

.annotation-meta-preview__head {
  align-items: center;
  display: flex;
  gap: 10px;
  justify-content: space-between;
  margin-bottom: 8px;
}

/* ---- Help dialog ---- */

.annotation-help-dialog {
  align-items: center;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  inset: 0;
  justify-content: center;
  position: fixed;
  z-index: 60;
}

.annotation-help-dialog[hidden] {
  display: none;
}

.annotation-help-dialog__panel {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
  max-width: 460px;
  padding: 18px 20px;
  width: calc(100% - 40px);
}

.annotation-help-dialog__panel header {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin-bottom: 14px;
}

.annotation-help-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.annotation-help-list li {
  align-items: center;
  display: grid;
  gap: 12px;
  grid-template-columns: 130px 1fr;
}

.annotation-help-list span {
  color: var(--text-dim);
}

/* ---- Responsive ---- */

@media (max-width: 1200px) {
  .annotation-stage,
  .annotation-stage[data-phase="annotate"] {
    grid-template-columns: 280px minmax(0, 1fr);
  }
  .annotation-meta {
    display: none;
  }
}

@media (max-width: 880px) {
  .annotation-stage,
  .annotation-stage[data-phase="annotate"] {
    grid-template-columns: 1fr;
  }
  .annotation-action-bar {
    flex-wrap: wrap;
  }
}


/* ---------- PHI Removal ---------- */

.phi-upload,
.phi-scan,
.phi-resolve,
.phi-redact,
.phi-handoff,
.phi-export {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.phi-upload__actions,
.phi-upload__next,
.phi-scan__actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.phi-files-list {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
}

.phi-files-list__item {
  border: 1px solid var(--border, rgba(255, 255, 255, 0.1));
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 8px;
}

.phi-files-list__row {
  align-items: center;
  display: flex;
  gap: 10px;
}

.phi-files-list__name {
  font-weight: 600;
}

.phi-files-list__meta {
  color: var(--text-muted);
  font-size: 13px;
  flex: 1;
}

.phi-upload__paste {
  border-top: 1px solid var(--border, rgba(255, 255, 255, 0.08));
  padding-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.phi-scan__cards {
  display: grid;
  gap: 12px;
}

.phi-card {
  border: 1px solid var(--border, rgba(255, 255, 255, 0.1));
  border-radius: 12px;
  padding: 12px 14px;
}

.phi-card--high {
  border-color: rgba(220, 100, 90, 0.6);
  background: rgba(220, 100, 90, 0.05);
}

.phi-card--medium {
  border-color: rgba(220, 170, 80, 0.6);
  background: rgba(220, 170, 80, 0.05);
}

.phi-card--low {
  border-color: rgba(140, 170, 220, 0.5);
  background: rgba(140, 170, 220, 0.04);
}

.phi-card--clear {
  border-color: rgba(80, 180, 120, 0.5);
  background: rgba(80, 180, 120, 0.04);
}

.phi-card--binary {
  border-style: dashed;
}

.phi-card__head {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
}

.phi-card__title {
  font-weight: 600;
}

.phi-pill--high {
  background: rgba(220, 100, 90, 0.15);
  color: rgb(220, 100, 90);
}

.phi-pill--medium {
  background: rgba(220, 170, 80, 0.15);
  color: rgb(200, 150, 60);
}

.phi-pill--low {
  background: rgba(140, 170, 220, 0.15);
  color: rgb(140, 170, 220);
}

.phi-pill--clear {
  background: rgba(80, 180, 120, 0.15);
  color: rgb(80, 180, 120);
}

.phi-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.phi-chip {
  background: rgba(255, 255, 255, 0.06);
  border-radius: 999px;
  font-size: 12px;
  padding: 3px 10px;
}

.phi-chip--high {
  background: rgba(220, 100, 90, 0.18);
}

.phi-chip--medium {
  background: rgba(220, 170, 80, 0.18);
}

.phi-chip--low {
  background: rgba(140, 170, 220, 0.16);
}

.phi-paths {
  display: grid;
  gap: 14px;
  grid-template-columns: 1fr 1fr;
}

@media (max-width: 900px) {
  .phi-paths {
    grid-template-columns: 1fr;
  }
}

.phi-path-card {
  background: transparent;
  border: 1px solid var(--border, rgba(255, 255, 255, 0.12));
  border-radius: 14px;
  color: inherit;
  cursor: pointer;
  padding: 16px;
  text-align: left;
  transition: border-color 120ms ease, background 120ms ease;
}

.phi-path-card:hover {
  background: rgba(255, 255, 255, 0.03);
  border-color: var(--accent, rgba(140, 170, 220, 0.6));
}

.phi-path-card__head {
  margin-bottom: 8px;
}

.phi-path-card h3 {
  margin: 4px 0 0;
}

.phi-resolve__disclaimer {
  margin-top: 12px;
}

.phi-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.phi-tab {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border, rgba(255, 255, 255, 0.1));
  border-radius: 999px;
  color: inherit;
  cursor: pointer;
  font-size: 13px;
  padding: 6px 12px;
}

.phi-tab.active {
  background: rgba(140, 170, 220, 0.18);
  border-color: rgba(140, 170, 220, 0.6);
}

.phi-tab__count {
  color: var(--text-muted);
  margin-left: 6px;
}

.phi-redact__viewer {
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid var(--border, rgba(255, 255, 255, 0.08));
  border-radius: 10px;
  max-height: 320px;
  overflow: auto;
  padding: 12px 14px;
}

.phi-viewer__text {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 13px;
  line-height: 1.55;
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
}

.phi-span {
  border-radius: 4px;
  cursor: pointer;
  padding: 1px 3px;
}

.phi-span--pending {
  background: rgba(220, 170, 80, 0.22);
  outline: 1px dashed rgba(220, 170, 80, 0.6);
}

.phi-span--accept,
.phi-span--edit {
  background: rgba(80, 180, 120, 0.22);
  outline: 1px solid rgba(80, 180, 120, 0.5);
}

.phi-span--reject {
  background: rgba(140, 170, 220, 0.15);
  outline: 1px dashed rgba(140, 170, 220, 0.5);
  text-decoration: line-through dotted;
}

.phi-span--active {
  box-shadow: 0 0 0 2px var(--accent, rgba(140, 170, 220, 0.85));
}

.phi-controls {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border, rgba(255, 255, 255, 0.08));
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 14px;
}

.phi-controls__meta {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.phi-controls__text {
  background: rgba(0, 0, 0, 0.18);
  border-radius: 6px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 13px;
  margin: 0;
  padding: 8px 10px;
}

.phi-controls__row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.phi-controls__label {
  color: var(--text-muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.phi-controls__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.phi-redact__footer {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: space-between;
  margin-top: 4px;
}

.phi-handoff__summary {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(3, 1fr);
}

.phi-handoff__summary > div {
  background: rgba(255, 255, 255, 0.03);
  border-radius: 10px;
  padding: 10px 12px;
}

.phi-handoff__form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.phi-checklist {
  list-style: none;
  margin: 0;
  padding: 0;
}

.phi-checklist__item {
  align-items: flex-start;
  border-top: 1px solid var(--border, rgba(255, 255, 255, 0.06));
  display: flex;
  gap: 12px;
  padding: 8px 0;
}

.phi-checklist__item--flagged {
  background: rgba(220, 100, 90, 0.05);
}

.phi-checklist__icon {
  align-items: center;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 999px;
  display: inline-flex;
  font-weight: 700;
  height: 22px;
  justify-content: center;
  width: 22px;
}

.phi-checklist__item--flagged .phi-checklist__icon {
  background: rgba(220, 100, 90, 0.2);
  color: rgb(220, 100, 90);
}

.phi-handoff__footer,
.phi-export-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.phi-export-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.phi-export-file {
  align-items: center;
  border: 1px solid var(--border, rgba(255, 255, 255, 0.08));
  border-radius: 10px;
  display: flex;
  gap: 10px;
  justify-content: space-between;
  padding: 8px 12px;
}

.phi-export__summary {
  border-top: 1px solid var(--border, rgba(255, 255, 255, 0.08));
  padding-top: 12px;
}

/* ---------- PHI Removal: configure phase ---------- */

.phi-configure {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.phi-engine-cards,
.phi-strictness-cards {
  display: grid;
  gap: 12px;
}

.phi-engine-cards {
  grid-template-columns: 1fr 1fr;
}

.phi-strictness-cards {
  grid-template-columns: 1fr 1fr 1fr;
}

@media (max-width: 980px) {
  .phi-engine-cards,
  .phi-strictness-cards {
    grid-template-columns: 1fr;
  }
}

.phi-engine-card,
.phi-strictness-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border, rgba(255, 255, 255, 0.1));
  border-radius: 12px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px;
  transition: border-color 120ms ease, background 120ms ease;
}

.phi-engine-card:hover,
.phi-strictness-card:hover {
  background: rgba(255, 255, 255, 0.04);
}

.phi-engine-card.active,
.phi-strictness-card.active {
  border-color: var(--accent, rgba(140, 170, 220, 0.85));
  background: rgba(140, 170, 220, 0.07);
}

.phi-engine-card__head {
  align-items: flex-start;
  display: flex;
  gap: 10px;
}

.phi-engine-card__head h3 {
  margin: 0 0 4px;
}

.phi-engine-card__detail {
  color: var(--text-muted);
  font-size: 13px;
  margin: 0;
}

.phi-strictness-card {
  align-items: flex-start;
  display: grid;
  gap: 8px;
  grid-template-columns: auto 1fr;
}

.phi-strictness-card h3 {
  margin: 0 0 4px;
}

.phi-tag {
  background: rgba(80, 180, 120, 0.18);
  border-radius: 999px;
  color: rgb(80, 180, 120);
  font-size: 11px;
  padding: 2px 8px;
  text-transform: uppercase;
}

.phi-engine-metric {
  align-items: center;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 8px;
  display: flex;
  flex-wrap: wrap;
  font-size: 13px;
  gap: 8px;
  margin: 0;
  padding: 8px 10px;
}

.phi-engine-metric--target {
  background: rgba(80, 180, 120, 0.12);
}

.phi-engine-metric--below {
  background: rgba(220, 170, 80, 0.12);
}

.phi-engine-metric--empty {
  background: transparent;
  font-style: italic;
}

.phi-configure__footer {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

/* ---------- PHI Removal: run phase ---------- */

.phi-run__head {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: space-between;
}

.phi-run__actions {
  display: flex;
  gap: 10px;
}

.phi-run__files {
  display: grid;
  gap: 14px;
}

.phi-card__body {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.phi-redacted-preview {
  background: rgba(0, 0, 0, 0.18);
  border-radius: 8px;
  max-height: 200px;
  overflow: auto;
  padding: 10px 12px;
}

.phi-spans-toggle {
  border-top: 1px solid var(--border, rgba(255, 255, 255, 0.08));
  padding-top: 8px;
}

.phi-spans-toggle summary {
  cursor: pointer;
  font-weight: 600;
}

.phi-spans-review {
  display: flex;
  flex-direction: column;
  gap: 8px;
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
}

.phi-span-row {
  background: rgba(255, 255, 255, 0.03);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 10px;
}

.phi-span-row--restored {
  background: rgba(220, 170, 80, 0.1);
}

.phi-span-row__main {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.phi-span-row__main code {
  background: rgba(0, 0, 0, 0.25);
  border-radius: 4px;
  font-size: 12px;
  padding: 2px 6px;
}

.phi-span-row__rationale {
  margin: 0;
}

.phi-run__footer {
  display: flex;
  justify-content: flex-end;
}

/* ---------- PHI Removal: validation panel ---------- */

.phi-validation {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.phi-validation__head {
  align-items: flex-start;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: space-between;
}

.phi-validation__target {
  align-items: center;
  background: rgba(140, 170, 220, 0.08);
  border-radius: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px 12px;
}

.phi-validation__table {
  border-collapse: collapse;
  font-size: 13px;
  width: 100%;
}

.phi-validation__table th,
.phi-validation__table td {
  border-bottom: 1px solid var(--border, rgba(255, 255, 255, 0.06));
  padding: 8px 10px;
  text-align: left;
  vertical-align: top;
}

.phi-validation__table th {
  background: rgba(255, 255, 255, 0.03);
  font-weight: 600;
}

.phi-validation__table tr.is-current {
  background: rgba(140, 170, 220, 0.06);
}

.phi-export__accuracy {
  align-items: center;
  background: rgba(80, 180, 120, 0.08);
  border-radius: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 10px 12px;
}

.phi-validation-link.active {
  border-color: var(--accent, rgba(140, 170, 220, 0.85));
  background: rgba(140, 170, 220, 0.07);
}
