:root {
  color-scheme: dark;
  --bg: #07090f;
  --panel: rgba(17, 23, 35, 0.86);
  --panel-strong: rgba(24, 32, 48, 0.96);
  --line: rgba(141, 154, 184, 0.18);
  --text: #eef3ff;
  --muted: #9da9bd;
  --soft: #c9d5ea;
  --accent: #7dd3fc;
  --accent-2: #a7f3d0;
  --warn: #facc15;
  --danger: #fb7185;
  --surface-hover: rgba(255, 255, 255, 0.065);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 22% 12%, rgba(125, 211, 252, 0.12), transparent 26%),
    radial-gradient(circle at 82% 18%, rgba(167, 243, 208, 0.10), transparent 28%),
    linear-gradient(135deg, #07090f 0%, #0d111c 52%, #080b12 100%);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 248px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 24px;
  background: rgba(6, 9, 15, 0.82);
  border-right: 1px solid var(--line);
  backdrop-filter: blur(22px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  font-size: 21px;
  font-weight: 800;
  text-decoration: none;
}

.brand__mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid rgba(125, 211, 252, 0.42);
  border-radius: 12px;
  background: linear-gradient(145deg, rgba(125, 211, 252, 0.24), rgba(167, 243, 208, 0.12));
}

.nav {
  display: grid;
  gap: 8px;
}

.nav a {
  color: var(--soft);
  padding: 11px 12px;
  border: 1px solid transparent;
  border-radius: 12px;
  text-decoration: none;
}

.nav a:hover {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.04);
}

.metric span,
.status,
p,
dt {
  color: var(--muted);
}

.workspace {
  width: min(1280px, calc(100% - 300px));
  margin-left: 248px;
  padding: 30px 32px 64px;
}

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

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  max-width: 820px;
  font-size: 34px;
  line-height: 1.08;
}

h2 {
  font-size: 22px;
}

p {
  margin: 8px 0 0;
  line-height: 1.5;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin: 16px 0;
}

.metric,
.panel,
.dropzone {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.22);
}

.metric {
  padding: 16px;
}

.metric span {
  display: block;
  font-size: 12px;
}

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 30px;
}

.dropzone {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
  align-items: center;
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(125, 211, 252, 0.10), rgba(167, 243, 208, 0.06)),
    var(--panel-strong);
}

.upload {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 12px;
}

input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.file-picker {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  max-width: 360px;
  padding: 0 18px;
  color: var(--soft);
  border: 1px dashed rgba(125, 211, 252, 0.42);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.045);
  cursor: pointer;
  overflow: hidden;
}

.file-picker span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

button {
  min-height: 42px;
  padding: 0 18px;
  color: #031018;
  border: 1px solid rgba(125, 211, 252, 0.9);
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

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

button:disabled {
  cursor: wait;
  opacity: 0.58;
}

.ghost {
  color: var(--soft);
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--line);
}

.grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
  gap: 16px;
  margin-top: 16px;
}

.panel {
  margin-top: 16px;
  padding: 20px;
}

.grid .panel {
  margin-top: 0;
}

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

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

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

.cards--compact {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.source-row,
.task-row,
.company-card,
.empty {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.035);
}

.source-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 14px;
}

.source-row strong,
.task-row strong,
.company-card strong {
  color: var(--text);
}

.source-row__meta,
.company-card__badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.task-row {
  padding: 14px;
}

.company-card {
  padding: 16px;
}

.company-card--compact {
  cursor: pointer;
}

.company-card--compact:hover,
.company-card--compact:focus {
  outline: none;
  background: var(--surface-hover);
  border-color: rgba(125, 211, 252, 0.35);
}

.company-card__top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.company-card dl {
  display: grid;
  grid-template-columns: 80px minmax(0, 1fr);
  gap: 8px 10px;
  margin: 16px 0;
}

.company-card dd {
  min-width: 0;
  margin: 0;
  color: var(--soft);
  overflow-wrap: anywhere;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 9px;
  color: var(--soft);
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  font-size: 12px;
  font-weight: 700;
}

.pill--good {
  color: #bbf7d0;
  border-color: rgba(74, 222, 128, 0.28);
}

.pill--warn {
  color: #fde68a;
  border-color: rgba(250, 204, 21, 0.28);
}

.empty {
  padding: 18px;
  color: var(--muted);
}

.company-detail {
  display: grid;
  gap: 16px;
}

.detail-hero {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(125, 211, 252, 0.08), rgba(255, 255, 255, 0.035));
}

.detail-hero h3 {
  margin: 0;
  font-size: 28px;
}

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

.detail-field {
  min-height: 76px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.035);
}

.detail-field span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 8px;
}

.detail-field strong {
  color: var(--soft);
  overflow-wrap: anywhere;
}

.detail-columns {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.8fr);
  gap: 14px;
}

.detail-columns section {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.035);
}

.detail-columns h4 {
  margin: 0 0 12px;
  font-size: 16px;
}

.detail-tasks,
.next-steps {
  display: grid;
  gap: 10px;
}

.step {
  padding: 12px;
  color: var(--soft);
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.035);
}

.status {
  min-height: 22px;
}

.status--error {
  color: var(--danger);
}

@media (max-width: 1040px) {
  .sidebar {
    position: static;
    width: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .workspace {
    width: min(100%, 100% - 24px);
    margin: 0 auto;
    padding: 20px 0 48px;
  }

  .metrics,
  .grid,
  .cards,
  .cards--compact,
  .dropzone,
  .detail-grid,
  .detail-columns {
    grid-template-columns: 1fr;
  }
}
