:root {
  color-scheme: dark;

  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --gray-900: #111827;
  --gray-950: #030712;

  --bg: var(--gray-950);
  --card: #090e1a;
  --card-border: var(--gray-900);
  --text: var(--gray-50);
  --text-muted: var(--gray-400);
  --text-faint: var(--gray-500);
  --border: var(--gray-800);
  --input-bg: var(--gray-950);
  --surface: var(--gray-900);
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --accent-muted: rgba(59, 130, 246, 0.1);
  --danger: #ef4444;
  --danger-bg: rgba(248, 113, 113, 0.1);
  --shadow-xs: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.3), 0 2px 4px -2px rgba(0, 0, 0, 0.3);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top, rgba(59, 130, 246, 0.12), transparent 34%),
    radial-gradient(circle at bottom right, rgba(34, 197, 94, 0.08), transparent 30%),
    var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 0.875rem;
  font-weight: 500;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  box-shadow: var(--shadow-xs);
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease, opacity 120ms ease;
}

button:hover {
  background: var(--accent-hover);
}

button.secondary {
  background: var(--gray-950);
  color: var(--gray-50);
  border-color: var(--border);
}

button.secondary:hover {
  background: rgba(17, 24, 39, 0.6);
}

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

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 12px;
  background: var(--input-bg);
  color: var(--text);
  font-size: 0.875rem;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

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

input::placeholder,
textarea::placeholder {
  color: var(--text-faint);
}

select {
  cursor: pointer;
}

select option {
  background: var(--card);
  color: var(--text);
}

textarea {
  resize: vertical;
  min-height: 100px;
}

.layout {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px 16px 48px;
}

.panel {
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 8px;
  box-shadow: var(--shadow-xs);
}

.gate-panel {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: end;
  padding: 20px 24px;
  margin-bottom: 12px;
}

.gate-panel h1,
.section-heading h1,
.job-header h3 {
  margin: 0;
  font-weight: 500;
  letter-spacing: -0.01em;
}

.gate-panel h1 {
  font-size: clamp(1.5rem, 3vw, 2rem);
  line-height: 1.1;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

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

.status {
  margin: 0;
  color: var(--accent);
  font-size: 0.875rem;
  font-weight: 500;
}

.status-bar {
  min-height: 1.25rem;
  margin: 0 0 12px;
  padding: 0 4px;
}

.status[data-error='true'] {
  color: var(--danger);
}

.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  margin-bottom: 16px;
  font-size: 0.875rem;
}

.topbar-progress {
  font-size: 0.875rem;
  font-weight: 500;
}

.topbar-stat {
  color: var(--text-muted);
  font-size: 0.8125rem;
}

.topbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-left: auto;
}

.two-column {
  display: grid;
  grid-template-columns: 1fr 440px;
  gap: 16px;
  align-items: start;
}

.column-main,
.column-sidebar {
  min-width: 0;
}

.job-panel,
.annotation-panel,
.empty-state {
  padding: 24px;
}

.gate-copy {
  min-width: 0;
}

.gate-copy p {
  max-width: 720px;
}

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

.job-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
}

.job-header h3 {
  font-size: 1rem;
}

.neutral-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 0;
}

.neutral-meta span {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 6px;
  background: rgba(156, 163, 175, 0.1);
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 500;
  box-shadow: inset 0 0 0 1px rgba(156, 163, 175, 0.2);
}

.separator {
  border: none;
  border-top: 1px solid var(--border);
  margin: 16px 0;
}

.job-description {
  min-height: 200px;
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.7;
  font-size: 1rem;
  color: var(--gray-300);
}

.section-heading.compact {
  margin-bottom: 16px;
}

.section-heading h1 {
  font-size: 1.125rem;
}

.sidebar-hint {
  font-size: 0.8125rem;
  margin: 4px 0 0;
}

.form-section + .form-section {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.form-section h4 {
  margin: 0;
  font-size: 0.9375rem;
  font-weight: 600;
}

.step-label {
  margin: 0 0 2px;
  font-size: 0.6875rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-faint);
}

.field-group {
  margin-top: 16px;
}

.field-group label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.875rem;
  font-weight: 500;
}

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

.field-help {
  margin: 6px 0 0;
  color: var(--text-muted);
  font-size: 0.75rem;
}

.checkbox-field {
  margin-top: 14px;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
}

.checkbox-label input {
  width: auto;
  margin: 0;
}

.label-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.label-grid.two-up {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.label-button {
  padding: 10px 12px;
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  text-align: left;
  font-size: 0.875rem;
  font-weight: 500;
  border: 1px solid transparent;
  box-shadow: none;
}

.label-button:hover {
  background: rgba(31, 41, 55, 0.8);
}

.label-button.selected {
  background: var(--accent-muted);
  color: #60a5fa;
  box-shadow: inset 0 0 0 1px rgba(59, 130, 246, 0.3);
}

.label-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.label-button:disabled:hover {
  background: var(--surface);
}

.info-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  margin-left: 4px;
  border-radius: 50%;
  background: var(--gray-800);
  color: var(--text-muted);
  font-size: 0.625rem;
  font-weight: 700;
  font-style: normal;
  cursor: help;
  position: relative;
  vertical-align: middle;
  flex-shrink: 0;
}

.info-icon:hover {
  background: var(--gray-700);
  color: var(--text);
}

.info-icon:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  right: -8px;
  width: 260px;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--gray-800);
  color: var(--gray-200);
  font-size: 0.8125rem;
  font-weight: 400;
  line-height: 1.5;
  box-shadow: var(--shadow-md);
  z-index: 100;
  pointer-events: none;
}

.sidebar-buttons {
  margin-top: 20px;
}

.sidebar-buttons button {
  width: 100%;
}

.final-call-section {
  padding: 16px;
  border-radius: 8px;
  background: rgba(59, 130, 246, 0.04);
  border: 1px solid rgba(59, 130, 246, 0.12);
}

.hidden-signals {
  margin-top: 16px;
  padding: 16px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  background: rgba(17, 24, 39, 0.4);
}

.hidden-signals pre {
  margin: 6px 0 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.8125rem;
  color: var(--gray-300);
}

.hidden-signals p {
  margin: 0;
}

.empty-state h2 {
  margin: 0 0 8px;
  font-size: 1.25rem;
}

.hidden {
  display: none;
}

@media (max-width: 960px) {
  .gate-panel,
  .topbar {
    flex-wrap: wrap;
  }

  .gate-actions,
  .topbar-actions {
    width: 100%;
    margin-left: 0;
  }

  .two-column {
    grid-template-columns: 1fr;
  }

  .field-grid,
  .label-grid.two-up {
    grid-template-columns: 1fr;
  }
}
