:root {
  color-scheme: light;
  --bg: #f6f4ef;
  --surface: #ffffff;
  --surface-2: #f0eee8;
  --ink: #202427;
  --muted: #657078;
  --line: #dcd6ca;
  --brand: #6f4bc2;
  --brand-ink: #ffffff;
  --surface-strong: #ffffff;
  --deep: #17161f;
  --purple: #7c3cff;
  --purple-2: #a06bff;
  --violet-soft: #ece4ff;
  --accent: #f4bf4f;
  --card-shadow: 0 18px 50px rgba(30, 24, 45, 0.12);
  --ok: #1f7a55;
  --warn: #b46912;
  --danger: #b13a3a;
  --focus: #2b7a9b;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
}

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

button {
  border: 0;
  border-radius: 6px;
  background: var(--brand);
  color: var(--brand-ink);
  cursor: pointer;
  min-height: 38px;
  padding: 0 14px;
  font-weight: 700;
}

button:hover {
  filter: brightness(0.96);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

button.secondary {
  background: #2d6f74;
}

button.ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  min-height: 38px;
  padding: 8px 10px;
}

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

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 28px;
  letter-spacing: 0;
}

h2 {
  font-size: 17px;
  letter-spacing: 0;
}

h3 {
  font-size: 15px;
  letter-spacing: 0;
}

.hidden {
  display: none !important;
}

.app-shell {
  min-height: 100vh;
}

.stack {
  display: grid;
  gap: 14px;
}

.status-line {
  min-height: 20px;
  color: var(--muted);
  margin-top: 14px;
}

.auth-shell {
  align-items: stretch;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--deep) 94%, var(--purple)), var(--deep) 58%),
    var(--deep);
  color: #f7f4ff;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(380px, 0.7fr);
  min-height: 100vh;
}

.auth-hero {
  align-content: center;
  display: grid;
  gap: 42px;
  padding: clamp(32px, 7vw, 88px);
}

.auth-brand-row {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  justify-content: space-between;
  max-width: 720px;
}

.auth-brand {
  align-items: center;
  color: #f7f4ff;
  display: flex;
  gap: 12px;
  font-size: 22px;
  font-weight: 900;
  text-decoration: none;
}

.auth-brand span {
  align-items: center;
  background: var(--purple);
  border-radius: 8px;
  display: inline-flex;
  font-size: 0;
  height: 52px;
  justify-content: center;
  overflow: hidden;
  position: relative;
  width: 52px;
}

.auth-brand span::before {
  content: "\1F9ED";
  font-size: 28px;
  line-height: 1;
}

.auth-home-link {
  align-items: center;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  color: #f7f4ff;
  display: inline-flex;
  font-weight: 900;
  gap: 8px;
  min-height: 44px;
  padding: 0 14px;
  text-decoration: none;
}

.auth-home-link:hover {
  background: rgba(255, 255, 255, 0.14);
}

.auth-visual {
  align-items: flex-end;
  display: flex;
  min-height: 320px;
  position: relative;
  width: min(340px, 76vw);
}

.auth-visual picture {
  display: block;
}

.auth-visual img {
  display: block;
  filter: drop-shadow(0 24px 44px rgba(0, 0, 0, 0.32));
  height: auto;
  max-height: 360px;
  object-fit: contain;
  width: min(320px, 76vw);
}

.auth-compass-badge {
  align-items: center;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 50%;
  color: var(--accent);
  display: inline-flex;
  font-size: 0;
  height: 44px;
  justify-content: center;
  position: absolute;
  right: 10px;
  top: 16px;
  width: 44px;
  z-index: 1;
}

.auth-compass-badge::before {
  content: "\1F9ED";
  font-size: 22px;
  line-height: 1;
}

.auth-hero h1 {
  color: #f7f4ff;
  font-size: clamp(40px, 7vw, 78px);
  line-height: 0.98;
  margin: 0;
  max-width: 920px;
}

.auth-hero p:not(.eyebrow) {
  color: #ddd6ee;
  font-size: 18px;
  line-height: 1.6;
  max-width: 680px;
}

.auth-panel {
  align-self: center;
  background: var(--surface-strong);
  border: 1px solid rgba(27, 24, 37, 0.14);
  border-radius: 8px;
  box-shadow: var(--card-shadow);
  color: var(--ink);
  display: grid;
  gap: 16px;
  margin: 32px;
  padding: 24px;
}

.auth-panel h2 {
  font-size: 30px;
  margin: 0;
}

.auth-tabs {
  background: #f8f6ff;
  border: 1px solid rgba(27, 24, 37, 0.14);
  border-radius: 8px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 3px;
}

.auth-tabs.single {
  grid-template-columns: 1fr;
}

.auth-tabs button {
  background: transparent;
  border: 0;
  border-radius: 7px;
  color: var(--muted);
  font-weight: 900;
  min-height: 38px;
}

.auth-tabs button.active {
  background: var(--purple);
  color: #ffffff;
}

.auth-form {
  margin-top: 4px;
}

.auth-panel .primary-action {
  align-items: center;
  display: inline-flex;
  justify-content: center;
  min-height: 42px;
  width: 100%;
}

.auth-panel .status-line {
  color: var(--muted);
  font-size: 13px;
  margin: 0;
}

.workbench {
  min-height: 100vh;
  padding: 22px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

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

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: #e7e0f7;
  color: #493073;
  font-size: 12px;
  font-weight: 800;
}

.pill.muted {
  background: var(--surface-2);
  color: var(--muted);
  border-color: var(--line);
}

.pill.ok {
  background: #dcefe6;
  color: var(--ok);
}

.pill.warn {
  background: #f5e8ce;
  color: var(--warn);
}

.pill.danger {
  background: #f2dede;
  color: var(--danger);
}

.tabs {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 18px;
  overflow-x: auto;
}

.tab {
  background: transparent;
  color: var(--muted);
  border-radius: 0;
  min-height: 42px;
  border-bottom: 3px solid transparent;
}

.tab.active {
  color: var(--ink);
  border-bottom-color: var(--brand);
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.grid {
  display: grid;
  gap: 16px;
}

.grid.two {
  grid-template-columns: minmax(280px, 420px) minmax(0, 1fr);
}

.review-grid {
  grid-template-columns: minmax(300px, 460px) minmax(0, 1fr);
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  min-width: 0;
}

.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.table-list {
  display: grid;
  gap: 10px;
}

.row-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fffefa;
  display: grid;
  gap: 8px;
}

.row-card.clickable {
  cursor: pointer;
}

.row-card.active {
  outline: 2px solid var(--focus);
}

.row-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.row-meta {
  color: var(--muted);
  font-size: 12px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.detail-empty {
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 8px;
  min-height: 260px;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 20px;
}

.candidate-detail {
  min-height: 640px;
}

.detail-stack {
  display: grid;
  gap: 14px;
}

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

.markdown-preview {
  max-height: 360px;
  overflow: auto;
  white-space: pre-wrap;
  background: #172026;
  color: #f4f1e9;
  border-radius: 8px;
  padding: 14px;
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  line-height: 1.55;
}

.facts-grid,
.controls-grid {
  display: grid;
  gap: 10px;
}

.fact-row,
.control-row {
  display: grid;
  grid-template-columns: minmax(120px, 220px) 1fr auto;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: min(420px, calc(100vw - 36px));
  background: #202427;
  color: #fff;
  border-radius: 8px;
  padding: 12px 14px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.24);
}

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

  .auth-panel {
    margin: 0 18px 24px;
  }

  .auth-visual {
    min-height: 240px;
    width: min(260px, 72vw);
  }

  .auth-visual img {
    max-height: 260px;
    width: min(240px, 72vw);
  }

  .auth-brand-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .auth-home-link {
    min-height: 40px;
  }

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

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

  .fact-row,
  .control-row {
    grid-template-columns: 1fr;
  }

  .form-row {
    grid-template-columns: 1fr;
  }
}
