:root {
  color-scheme: light;
  --bg: #fbfaf6;
  --panel: rgba(255, 255, 255, 0.84);
  --panel-strong: rgba(255, 255, 255, 0.94);
  --ink: #11172a;
  --muted: #66728a;
  --line: #e2dcff;
  --line-soft: rgba(226, 220, 255, 0.58);
  --accent: #4f46ff;
  --accent-soft: #ecebff;
  --good: #127a4b;
  --warn: #936300;
  --chip: #f0efff;
  --shadow: 0 20px 55px rgba(34, 27, 73, 0.08);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 8% 10%, rgba(247, 226, 255, 0.76), transparent 28%),
    radial-gradient(circle at 92% 12%, rgba(232, 255, 235, 0.72), transparent 29%),
    radial-gradient(circle at 42% 2%, rgba(255, 244, 226, 0.82), transparent 34%),
    linear-gradient(180deg, #fffaf7 0%, #f9faf5 100%);
  color: var(--ink);
  font-family:
    Inter, "Avenir Next", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-weight: 400;
}

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

.shell {
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 22px 26px 26px;
  gap: 18px;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: min(420px, 100%);
  display: grid;
  gap: 14px;
  border: 1px solid var(--line-soft);
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.76);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
  padding: 28px;
}

.login-card .brand-logo {
  width: 58px;
  height: 58px;
  border-radius: 17px;
}

.login-card h1 {
  font-size: 30px;
}

.login-card label span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 5px;
}

.login-error {
  color: #cf222e;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 0 2px;
}

.brand {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand-logo {
  width: 64px;
  height: 64px;
  flex: 0 0 auto;
  object-fit: cover;
  object-position: center;
  border-radius: 19px;
  box-shadow: 0 18px 34px rgba(22, 82, 170, 0.18);
}

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

h1 {
  margin: 0;
  font-size: 34px;
  line-height: 1;
  letter-spacing: 0;
  font-weight: 500;
}

p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 400;
  overflow-wrap: anywhere;
}

strong {
  font-weight: 450;
}

.metrics {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.metric,
.chip {
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  padding: 7px 12px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  font-size: 13px;
  font-weight: 450;
  box-shadow: 0 8px 24px rgba(34, 27, 73, 0.04);
}

.scan-picker {
  min-width: 260px;
}

.scan-picker span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 3px;
  font-weight: 450;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.topbar-button {
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.76);
  color: var(--ink);
  cursor: pointer;
  box-shadow: 0 12px 24px rgba(34, 27, 73, 0.05);
}

.topbar-button:hover {
  color: #fff;
  background: var(--ink);
}

.scan-form-panel {
  border: 1px solid var(--line-soft);
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
  padding: 16px;
}

.scan-form {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 12px;
  align-items: end;
}

.scan-form-heading {
  grid-column: 1 / -1;
}

.scan-form h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 500;
}

.scan-form label span,
.source-options legend {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 5px;
}

.scan-form .wide {
  grid-column: span 2;
}

.scan-form textarea {
  min-height: 92px;
  resize: vertical;
}

.source-options {
  min-width: 0;
  border: 1px solid #dfe5f0;
  border-radius: 16px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.62);
}

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

.source-options input {
  width: auto;
}

.scan-form-actions {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.scan-form-message {
  color: var(--muted);
  font-size: 13px;
}

.scan-form-message.error {
  color: #cf222e;
}

.workspace {
  min-height: 0;
  flex: 1;
  display: grid;
  grid-template-columns: minmax(360px, 42vw) 1fr;
  gap: 18px;
  overflow: hidden;
}

.actions-panel {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(300px, 1.3fr) minmax(180px, 0.8fr) minmax(180px, 0.8fr);
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line-soft);
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.62);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
  flex: 0 0 auto;
}

.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-content: flex-start;
  max-height: 86px;
  overflow: auto;
}

.action-button {
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.78);
  color: var(--ink);
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 400;
  line-height: 1.15;
  min-height: 34px;
  cursor: pointer;
  box-shadow: 0 12px 24px rgba(34, 27, 73, 0.05);
}

.action-button:hover {
  color: #fff;
  background: var(--ink);
  border-color: var(--ink);
}

.action-button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.action-button.confirm {
  border-color: #ffd889;
  background: #fff7df;
}

.action-output {
  height: 86px;
  overflow: auto;
  margin: 0;
  border: 1px solid rgba(17, 23, 42, 0.12);
  border-radius: 18px;
  background: #0f172a;
  color: #eef2ff;
  padding: 12px;
  white-space: pre-wrap;
  font-size: 12px;
  font-weight: 400;
}

.jobs,
.app-state {
  border: 1px solid var(--line-soft);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
  padding: 10px;
  height: 86px;
  overflow: auto;
  font-size: 12px;
  box-shadow: 0 12px 28px rgba(34, 27, 73, 0.04);
}

.job-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 3px 0;
  border-bottom: 1px solid #eef1f4;
}

.job-row:last-child {
  border-bottom: 0;
}

.job-stages {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}

.job-stage {
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  padding: 2px 6px;
  background: rgba(255, 255, 255, 0.68);
  color: var(--muted);
  font-size: 11px;
}

.job-stage.failed {
  color: #cf222e;
  border-color: rgba(207, 34, 46, 0.24);
}

.job-stage.running {
  color: var(--accent);
  border-color: rgba(79, 70, 255, 0.24);
}

.job-stage.pending {
  opacity: 0.7;
}

.state-block {
  margin-bottom: 7px;
}

.state-block strong {
  display: block;
  margin-bottom: 2px;
}

.risk-clear {
  color: var(--good);
}

.risk-caution {
  color: var(--warn);
}

.risk-needs_review {
  color: #cf222e;
}

.lead-list {
  border: 1px solid var(--line-soft);
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.68);
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.toolbar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
  padding: 14px;
  border-bottom: 1px solid var(--line-soft);
  flex: 0 0 auto;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #dfe5f0;
  border-radius: 14px;
  padding: 10px 12px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.84);
  font-weight: 400;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85);
}

input:focus,
select:focus,
textarea:focus {
  border-color: #b8b2ff;
  box-shadow: 0 0 0 4px rgba(79, 70, 255, 0.1);
  outline: none;
}

.rows {
  overflow: auto;
  min-height: 0;
  flex: 1;
}

.row {
  width: 100%;
  border: 0;
  border-bottom: 1px solid rgba(226, 220, 255, 0.58);
  background: transparent;
  padding: 16px 18px;
  text-align: left;
  cursor: pointer;
  color: var(--ink);
}

.row:hover,
.row.active {
  background: rgba(240, 238, 255, 0.86);
}

.row-title {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-weight: 450;
}

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

.status-pill {
  border-radius: 999px;
  background: var(--accent-soft);
  border: 1px solid #dedbff;
  color: var(--accent);
  padding: 3px 8px;
  font-weight: 400;
}

.score {
  min-width: 54px;
  color: var(--accent);
  text-align: right;
}

.detail {
  min-width: 0;
  overflow: auto;
  padding: 22px 26px 34px;
  min-height: 0;
  border: 1px solid var(--line-soft);
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.68);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.detail-card {
  max-width: 980px;
}

.detail h2 {
  margin: 0;
  font-size: 30px;
  line-height: 1.08;
  font-weight: 500;
  overflow-wrap: anywhere;
}

.detail h3 {
  margin: 28px 0 10px;
  font-size: 16px;
  font-weight: 450;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 18px;
}

.status-control {
  margin-top: 18px;
  max-width: 280px;
}

.summary-item {
  border: 1px solid var(--line-soft);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.78);
  padding: 14px;
}

.summary-item span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 5px;
}

.section {
  border: 1px solid var(--line-soft);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.76);
  padding: 18px;
  margin-top: 16px;
}

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

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

.fact-block {
  border-left: 4px solid var(--accent);
  border-radius: 14px;
  background: rgba(248, 248, 255, 0.76);
  padding: 12px 14px;
}

.fact-block strong {
  display: block;
  margin-bottom: 6px;
}

.social-links {
  margin-top: 18px;
}

.social-links h3 {
  margin-top: 18px;
}

ul {
  margin: 8px 0 0;
  padding-left: 20px;
}

a {
  color: var(--accent);
}

.empty {
  color: var(--muted);
  padding: 24px;
  font-weight: 400;
}

@media (max-width: 900px) {
  .shell {
    padding: 18px 18px 20px;
    gap: 12px;
  }

  h1 {
    font-size: 30px;
  }

  .actions-panel {
    grid-template-columns: 1fr;
    max-height: 218px;
    overflow: auto;
    padding: 12px;
  }

  .actions {
    flex-wrap: nowrap;
    max-height: none;
    min-height: 38px;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .action-button {
    flex: 0 0 auto;
  }

  .action-output,
  .jobs,
  .app-state {
    height: 62px;
  }

  .workspace {
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: stretch;
    flex-direction: column;
    gap: 10px;
  }

  .brand {
    align-items: center;
    gap: 12px;
  }

  .brand-logo {
    width: 56px;
    height: 56px;
    border-radius: 17px;
  }

  .metrics {
    justify-content: flex-start;
  }

  .scan-picker {
    min-width: 0;
  }

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

  .scan-form .wide {
    grid-column: span 1;
  }

  .lead-list {
    border-right: 0;
    max-height: 40vh;
  }

  .summary-grid,
  .facts {
    grid-template-columns: 1fr;
  }

  .toolbar {
    grid-template-columns: 1fr;
  }
}
