:root {
  color-scheme: dark;
  --bg: #0b1030;
  --bg-deep: #070b22;
  --panel: #111836;
  --panel-2: #0f1732;
  --panel-3: #141d3f;
  --line: #2f3d6a;
  --line-soft: #243158;
  --ink: #ecf0ff;
  --muted: #9aa5cb;
  --accent: #58c6b9;
  --accent-dark: #27a69a;
  --focus: #67d2c7;
  --success: #4fe28c;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at top left, rgba(42, 56, 108, 0.4), transparent 34%),
    linear-gradient(180deg, #0a1028 0%, #0a1028 42%, #060a1a 100%);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.page-shell {
  max-width: 1600px;
  margin: 0 auto;
  padding: 28px 30px 32px;
}

.page-header {
  margin-bottom: 16px;
}

.page-header h1 {
  font-size: clamp(34px, 3vw, 42px);
  margin: 0 0 8px;
}

.page-header p {
  color: var(--muted);
  font-size: 15px;
  margin: 0;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(560px, 1.05fr) minmax(360px, 0.78fr);
  gap: 18px;
  align-items: start;
}

.panel {
  background: linear-gradient(180deg, rgba(20, 29, 63, 0.98), rgba(11, 17, 44, 0.98));
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.01) inset;
  padding: 16px 16px 18px;
}

.intake-panel {
  min-height: calc(100vh - 110px);
}

.workflow-panel,
.checklist-panel,
.status-panel {
  margin-bottom: 18px;
}

.intake-panel h2,
.workflow-panel h2,
.checklist-panel h2,
.status-panel h2 {
  font-size: 20px;
  margin: 0 0 14px;
}

.intake-panel h2 {
  font-size: 21px;
}

form {
  display: grid;
  gap: 13px;
}

.field-grid {
  display: grid;
  gap: 12px;
}

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

label,
.field-head h3,
legend {
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

label {
  display: grid;
  gap: 6px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: #0b1230;
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  padding: 10px 11px;
}

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

input::placeholder,
textarea::placeholder {
  color: #8090bc;
}

input[readonly] {
  background: #0d1536;
  color: #dfe6ff;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--focus);
  box-shadow: 0 0 0 3px rgba(103, 210, 199, 0.12);
  outline: none;
}

.selection-group {
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: rgba(8, 13, 33, 0.32);
  display: grid;
  gap: 10px;
  padding: 12px;
}

.field-head {
  align-items: center;
  display: flex;
  gap: 10px;
  justify-content: space-between;
}

.field-head h3 {
  margin: 0;
  font-size: 14px;
  color: var(--ink);
}

.segmented {
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  overflow: hidden;
  background: #0b1230;
}

.segmented label {
  align-items: center;
  color: var(--ink);
  cursor: pointer;
  display: flex;
  font-size: 12px;
  font-weight: 700;
  gap: 6px;
  justify-content: center;
  min-width: 62px;
  padding: 7px 10px;
}

.segmented label + label {
  border-left: 1px solid var(--line-soft);
}

.segmented input {
  height: 13px;
  width: 13px;
  margin: 0;
}

.picker-grid {
  display: grid;
  gap: 6px;
  max-height: 252px;
  overflow: auto;
  padding-right: 2px;
}

.compact-picker {
  grid-template-columns: repeat(auto-fill, minmax(54px, 1fr));
}

.office-picker {
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
}

.pick-option {
  align-items: center;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  color: var(--ink);
  cursor: pointer;
  display: grid;
  font-size: 12px;
  font-weight: 700;
  gap: 5px;
  grid-template-columns: auto minmax(0, auto) minmax(0, 1fr);
  min-height: 34px;
  padding: 6px 7px;
  background: rgba(8, 12, 30, 0.6);
}

.pick-option:has(input:checked) {
  background: rgba(88, 198, 185, 0.12);
  border-color: var(--accent);
}

.pick-option input {
  height: 14px;
  width: 14px;
  margin: 0;
}

.pick-code {
  font-weight: 800;
}

.pick-label {
  color: var(--muted);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-fieldset {
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  margin: 0;
  padding: 12px;
  background: rgba(8, 13, 33, 0.32);
}

.status-fieldset legend {
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
  padding: 0 5px;
}

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

.check {
  align-items: center;
  color: var(--ink);
  display: flex;
  font-weight: 550;
  gap: 8px;
}

.check input {
  width: auto;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 2px;
}

button,
.open-link {
  align-items: center;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  font-weight: 750;
  gap: 8px;
  justify-content: center;
  min-height: 44px;
  padding: 10px 14px;
  text-decoration: none;
}

button {
  background: var(--accent-dark);
  color: #08131a;
  color: #f2fffd;
}

button.secondary-action,
.open-link {
  background: rgba(255, 255, 255, 0.03);
  color: var(--ink);
  border-color: var(--line);
}

button.primary-action {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
  color: #f2fffd;
}

button:hover,
.open-link:hover {
  filter: brightness(1.04);
}

button.is-running {
  background: #0c6f67;
  border-color: #0c6f67;
  cursor: progress;
}

button.is-running::after {
  animation: spin 0.8s linear infinite;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  content: "";
  flex: 0 0 auto;
  height: 12px;
  width: 12px;
}

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

.workflow-summary {
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: rgba(7, 12, 33, 0.7);
  color: #dfe7ff;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.38;
  margin-bottom: 14px;
  padding: 12px;
  white-space: pre-line;
}

.searches {
  display: grid;
  gap: 12px;
}

.search-card {
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: rgba(7, 12, 33, 0.54);
  padding: 12px;
}

.search-card h3 {
  font-size: 15px;
  margin: 0 0 6px;
}

.search-card p {
  color: var(--muted);
  margin: 0 0 10px;
}

.search-card p:last-of-type {
  margin-bottom: 0;
}

.summary {
  background: #0b1230;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  color: #dfe7ff;
  margin-bottom: 14px;
  padding: 12px;
}

.open-link {
  margin-top: 10px;
}

.checklist-panel ol {
  margin: 0;
  padding-left: 22px;
}

.checklist-panel li {
  color: #d8def5;
  list-style: none;
  position: relative;
  padding-left: 4px;
}

.checklist-panel li + li {
  margin-top: 8px;
}

.check-state {
  color: var(--success);
  display: inline-block;
  margin-right: 6px;
}

.run-status {
  background: rgba(7, 12, 33, 0.7);
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  color: #dfe7ff;
  line-height: 1.5;
  margin: 0;
  min-height: 52px;
  padding: 12px;
  white-space: pre-line;
}

.url-box {
  background: #0a1028;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  color: #a7b7e0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  line-height: 1.45;
  margin-top: 10px;
  max-height: 84px;
  overflow: auto;
  padding: 10px;
  word-break: break-all;
}

ol {
  margin: 0;
}

@media (max-width: 1180px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .intake-panel {
    min-height: auto;
  }
}

@media (max-width: 800px) {
  .page-shell {
    padding: 18px;
  }

  .contact-grid,
  .pair-grid,
  .status-grid {
    grid-template-columns: 1fr;
  }

  .field-head {
    align-items: start;
    flex-direction: column;
  }

  .segmented {
    width: 100%;
  }
}
