.companies-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.companies-main {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  flex: 1;
  min-height: 0;
}

.companies-sidebar {
  position: sticky;
  top: 60px;
  align-self: start;
  height: calc(100vh - 60px);
  overflow: auto;
  border-right: 1px solid var(--line);
  background: var(--surface);
  padding: 22px 18px;
}

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

.companies-sidebar-head h1 {
  margin: 2px 0 0;
  font-family: var(--font-display);
  font-size: 24px;
  letter-spacing: -0.02em;
}

.companies-sidebar-head p:last-child {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.companies-eyebrow,
.company-section-eyebrow {
  margin: 0;
  color: var(--accent-strong);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.icon-button {
  display: inline-grid;
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--muted);
}

.icon-button:hover {
  border-color: #cbd5e1;
  background: var(--surface-2);
  color: var(--text);
}

.icon-button.loading i {
  animation: companies-spin 0.8s linear infinite;
}

.companies-search {
  position: relative;
  display: block;
  margin: 18px 0 14px;
}

.companies-search i {
  position: absolute;
  top: 50%;
  left: 11px;
  z-index: 1;
  color: var(--muted);
  transform: translateY(-50%);
  pointer-events: none;
}

.companies-search input {
  min-height: 42px;
  padding-left: 35px;
  border-radius: 11px;
  background: var(--surface-3);
}

.companies-search input:focus {
  outline: 3px solid rgba(13, 148, 136, 0.12);
  border-color: var(--accent);
  background: var(--surface);
}

.companies-list {
  display: grid;
  gap: 8px;
}

.companies-list-loading,
.companies-list-empty,
.companies-list-error {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 118px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  padding: 18px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  text-align: center;
}

.companies-list-error {
  color: #92400e;
  background: #fffbeb;
}

.companies-spinner {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  border: 2px solid #cbd5e1;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: companies-spin 0.8s linear infinite;
}

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

.company-list-item {
  width: 100%;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 11px;
  background: transparent;
  color: var(--text);
  text-align: left;
  transition: border-color 0.15s var(--ease), background 0.15s var(--ease);
}

.company-list-item:hover {
  border-color: var(--line);
  background: var(--surface-3);
}

.company-list-item.active {
  border-color: rgba(13, 148, 136, 0.26);
  background: var(--accent-soft);
}

.company-list-monogram {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 10px;
  background: #e8eef8;
  color: #1d4ed8;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
}

.company-list-copy {
  min-width: 0;
}

.company-list-copy strong,
.company-list-copy span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.company-list-copy strong {
  font-size: 12.5px;
  line-height: 1.3;
}

.company-list-copy span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
}

.company-list-score {
  min-width: 38px;
  border-radius: 999px;
  padding: 4px 7px;
  background: #eef2f7;
  color: #475569;
  font-size: 10px;
  font-weight: 700;
  text-align: center;
}

.company-list-score.high-evidence {
  background: #fee2e2;
  color: #b91c1c;
}

.company-list-score.dismissed {
  background: #ecfdf5;
  color: #047857;
}

.companies-workspace {
  min-width: 0;
  padding: 24px clamp(18px, 3vw, 38px) 40px;
}

.companies-notice {
  position: sticky;
  top: 60px;
  z-index: 19;
  margin: 0;
  border-right: 0;
  border-left: 0;
  border-radius: 0;
}

.companies-empty,
.companies-error {
  max-width: 580px;
  min-height: 60vh;
  margin: 0 auto;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 12px;
  padding: 32px;
  color: var(--muted);
  text-align: center;
}

.companies-empty-icon {
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  border-radius: 18px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 28px;
}

.companies-empty h2,
.companies-error h2 {
  margin: 4px 0 0;
  color: var(--text);
  font-family: var(--font-display);
  font-size: 22px;
}

.companies-empty p,
.companies-error p {
  max-width: 500px;
  margin: 0;
  font-size: 13px;
  line-height: 1.6;
}

.companies-error .companies-empty-icon {
  background: #fffbeb;
  color: #b7791f;
}

.company-dossier {
  display: grid;
  gap: 18px;
  animation: pm-rise 0.45s var(--ease) both;
}

.company-hero {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 22px 24px;
  background:
    radial-gradient(circle at 92% 0%, rgba(37, 99, 235, 0.11), transparent 34%),
    var(--surface);
  box-shadow: var(--shadow-card);
}

.company-hero::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: #2563eb;
  content: "";
}

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

.company-hero-logo {
  display: grid;
  width: 58px;
  height: 58px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 15px;
  background: #2563eb;
  color: white;
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 700;
  box-shadow: 0 8px 22px rgba(37, 99, 235, 0.22);
}

.company-hero h1 {
  margin: 4px 0 0;
  overflow-wrap: anywhere;
  font-family: var(--font-display);
  font-size: clamp(22px, 3.1vw, 32px);
  line-height: 1.12;
  letter-spacing: -0.025em;
}

.company-hero-meta,
.company-hero-actions,
.company-tag-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.company-hero-meta {
  margin-top: 9px;
  color: var(--muted);
  font-size: 12px;
}

.company-hero-meta span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.company-hero-actions {
  justify-content: flex-end;
}

.company-hero-actions a {
  text-decoration: none;
}

.company-hero-actions .primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}

.company-section {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

.company-section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid var(--line);
  padding: 15px 17px;
}

.company-section-head h2 {
  margin: 3px 0 0;
  font-family: var(--font-display);
  font-size: 17px;
}

.company-section-head p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.45;
}

.company-section-body {
  padding: 16px 17px;
}

.company-two-column {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.company-overview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}

.company-overview-item {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 11px 12px;
  background: var(--surface-3);
}

.company-overview-item dt {
  margin: 0;
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.045em;
  text-transform: uppercase;
}

.company-overview-item dd {
  margin: 5px 0 0;
  overflow-wrap: anywhere;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.45;
}

.company-decision-grid {
  display: grid;
  grid-template-columns: minmax(145px, 0.42fr) minmax(0, 1.58fr);
  gap: 16px;
  align-items: stretch;
}

.company-score-card {
  display: grid;
  align-content: center;
  justify-items: center;
  border: 1px solid #cbd5e1;
  border-radius: 13px;
  padding: 18px;
  background: #f8fafc;
  text-align: center;
}

.company-score-card.high-evidence {
  border-color: #fecaca;
  background: #fff7f7;
}

.company-score-card.dismissed {
  border-color: #a7f3d0;
  background: #f0fdf4;
}

.company-score-value {
  font-family: var(--font-display);
  color: #334155;
  font-size: 34px;
  font-weight: 700;
  line-height: 1;
}

.company-score-card.high-evidence .company-score-value {
  color: #b91c1c;
}

.company-score-card.dismissed .company-score-value {
  color: #047857;
}

.company-score-card span {
  margin-top: 7px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.company-decision-copy {
  display: grid;
  align-content: center;
  gap: 8px;
}

.company-decision-copy h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 16px;
}

.company-decision-copy p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.company-caution {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  border: 1px solid #dbeafe;
  border-radius: 10px;
  padding: 10px 11px;
  background: #eff6ff;
  color: #1e3a8a;
  font-size: 11px;
  line-height: 1.5;
}

.company-caution i {
  flex: 0 0 auto;
  margin-top: 1px;
  font-size: 16px;
}

.company-timeline {
  position: relative;
  display: grid;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.company-timeline::before {
  position: absolute;
  top: 10px;
  bottom: 10px;
  left: 80px;
  width: 1px;
  background: var(--line);
  content: "";
}

.company-timeline-item {
  position: relative;
  display: grid;
  grid-template-columns: 68px 12px minmax(0, 1fr);
  gap: 12px;
  padding: 5px 0 15px;
}

.company-timeline-date {
  padding-top: 2px;
  color: var(--muted);
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.company-timeline-dot {
  z-index: 1;
  width: 10px;
  height: 10px;
  margin-top: 3px;
  border: 2px solid var(--surface);
  border-radius: 50%;
  background: #64748b;
  box-shadow: 0 0 0 1px #94a3b8;
}

.company-timeline-copy strong {
  display: block;
  font-size: 12.5px;
  line-height: 1.35;
}

.company-timeline-copy p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.5;
}

.company-entity-list,
.company-finding-list,
.company-source-list,
.company-certificate-list,
.company-evidence-list {
  display: grid;
  gap: 8px;
}

.company-finding-row {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-left: 3px solid #94a3b8;
  border-radius: 10px;
  padding: 11px 12px;
  background: var(--surface-3);
}

.company-finding-row.explicit-indicator {
  border-left-color: #dc2626;
}

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

.company-finding-head strong,
.company-finding-head span {
  display: block;
}

.company-finding-head strong {
  font-size: 12.5px;
  line-height: 1.4;
}

.company-finding-head > div > span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10.5px;
}

.company-finding-row p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.company-finding-row p b {
  color: var(--text);
}

.company-entity-row,
.company-source-row,
.company-certificate-row,
.company-evidence-row {
  min-width: 0;
  display: grid;
  align-items: start;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 11px;
  background: var(--surface-3);
}

.company-entity-row {
  grid-template-columns: 30px minmax(0, 1fr) auto;
}

.company-entity-index {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 50%;
  background: #64748b;
  color: white;
  font-size: 10.5px;
  font-weight: 700;
}

.company-entity-row.explicit-indicator .company-entity-index {
  background: #dc2626;
}

.company-entity-copy,
.company-source-copy,
.company-certificate-copy,
.company-evidence-copy {
  min-width: 0;
}

.company-entity-copy strong,
.company-source-copy strong,
.company-certificate-copy strong,
.company-evidence-copy strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: 12px;
  line-height: 1.4;
}

.company-entity-copy span,
.company-source-copy span,
.company-certificate-copy span,
.company-evidence-copy span {
  display: block;
  margin-top: 3px;
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.45;
}

.company-tag,
.company-state-badge,
.company-source-use {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  gap: 5px;
  border: 1px solid #dce3e9;
  border-radius: 999px;
  padding: 4px 8px;
  background: #f8fafc;
  color: #475569;
  font-size: 9.5px;
  font-weight: 700;
  line-height: 1.2;
}

.company-tag.high-evidence,
.company-state-badge.high-evidence {
  border-color: #fecaca;
  background: #fef2f2;
  color: #b91c1c;
}

.company-tag.dismissed,
.company-state-badge.valid {
  border-color: #a7f3d0;
  background: #ecfdf5;
  color: #047857;
}

.company-state-badge.pending,
.company-state-badge.warning {
  border-color: #fde68a;
  background: #fffbeb;
  color: #92400e;
}

.company-source-use.used {
  border-color: rgba(13, 148, 136, 0.28);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.company-source-use.not-used {
  color: #64748b;
}

.company-source-use i {
  font-size: 12px;
}

.company-pipeline-table {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 11px;
}

.company-pipeline-table-head,
.company-pipeline-table-row {
  display: grid;
  grid-template-columns:
    minmax(150px, 0.95fr)
    minmax(130px, 0.8fr)
    minmax(130px, 0.85fr)
    105px
    minmax(180px, 1.2fr);
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
}

.company-pipeline-table-head {
  background: #f8fafc;
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.company-pipeline-table-row {
  border-top: 1px solid var(--line);
  font-size: 11.5px;
}

.company-pipeline-table-row > span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.company-pipeline-stage {
  font-weight: 700;
}

.company-pipeline-company {
  display: grid;
  gap: 2px;
}

.company-pipeline-company strong {
  font-size: 11.5px;
}

.company-pipeline-company small {
  color: var(--muted);
  font-size: 9.5px;
}

.company-network-wrap {
  overflow-x: auto;
}

.company-network {
  width: 100%;
  min-width: 620px;
  min-height: 350px;
  display: block;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 12px;
  background:
    linear-gradient(rgba(94, 202, 165, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(94, 202, 165, 0.07) 1px, transparent 1px),
    linear-gradient(160deg, var(--graph-bg-1), var(--graph-bg-2));
  background-size: 32px 32px, 32px 32px, auto;
}

.company-network-edge {
  stroke: rgba(203, 213, 225, 0.38);
  stroke-width: 1.4;
}

.company-network-edge.explicit-indicator {
  stroke: rgba(220, 38, 38, 0.7);
  stroke-width: 2;
}

.company-network-node circle {
  stroke: rgba(255, 255, 255, 0.85);
  stroke-width: 2;
}

.company-network-node.target circle {
  fill: #2563eb;
}

.company-network-node.context circle {
  fill: #64748b;
}

.company-network-node.explicit-indicator circle {
  fill: #dc2626;
}

.company-network-number {
  fill: white;
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
  text-anchor: middle;
  dominant-baseline: central;
  pointer-events: none;
}

.company-network-label {
  fill: var(--graph-ink);
  stroke: var(--graph-halo);
  stroke-width: 4px;
  paint-order: stroke;
  font-size: 10px;
  font-weight: 600;
  text-anchor: middle;
  pointer-events: none;
}

.company-network-legend {
  display: grid;
  gap: 7px;
  margin: 13px 0 0;
  padding: 0;
  list-style: none;
}

.company-network-legend li {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr) auto;
  gap: 9px;
  align-items: center;
  color: var(--muted);
  font-size: 10.5px;
}

.company-network-legend-number {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 50%;
  background: #64748b;
  color: white;
  font-weight: 700;
}

.company-network-legend-number.target {
  background: #2563eb;
}

.company-network-legend-number.explicit-indicator {
  background: #dc2626;
}

.company-network-legend strong {
  color: var(--text);
  font-size: 11px;
}

.company-network-color-key {
  display: flex;
  flex-wrap: wrap;
  gap: 9px 14px;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 10.5px;
}

.company-network-color-key span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.company-network-color-key i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #64748b;
}

.company-network-color-key .target {
  background: #2563eb;
}

.company-network-color-key .indicator {
  background: #dc2626;
}

.company-evidence-row {
  grid-template-columns: minmax(0, 1fr) auto;
}

.company-evidence-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.company-evidence-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 8px;
  background: var(--surface);
  color: var(--accent-strong);
  font-size: 10px;
  font-weight: 700;
  text-decoration: none;
}

.company-evidence-link:hover {
  border-color: rgba(13, 148, 136, 0.35);
  background: var(--accent-soft);
}

.company-section-empty {
  border: 1px dashed var(--line);
  border-radius: 10px;
  padding: 18px;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.5;
  text-align: center;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  clip-path: inset(50%);
}

@media (max-width: 980px) {
  .companies-main {
    grid-template-columns: 270px minmax(0, 1fr);
  }

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

  .company-score-card {
    justify-items: start;
    text-align: left;
  }

  .company-pipeline-table {
    overflow-x: auto;
  }

  .company-pipeline-table-head,
  .company-pipeline-table-row {
    min-width: 860px;
  }
}

@media (max-width: 760px) {
  .topnav {
    height: auto;
    min-height: 60px;
    flex-wrap: wrap;
    padding: 10px 14px;
  }

  .topnav-modules {
    order: 3;
    width: 100%;
    overflow-x: auto;
  }

  .topnav-module {
    flex: 0 0 auto;
  }

  .topnav-user {
    display: none;
  }

  .companies-main {
    display: block;
  }

  .companies-sidebar {
    position: static;
    height: auto;
    max-height: 390px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .companies-list {
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  }

  .companies-workspace {
    padding: 17px 13px 30px;
  }

  .company-hero {
    grid-template-columns: 1fr;
    padding: 18px;
  }

  .company-hero-actions {
    justify-content: flex-start;
  }

  .company-hero-identity {
    align-items: flex-start;
  }

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

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

  .company-evidence-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 480px) {
  .company-overview-grid {
    grid-template-columns: 1fr;
  }

  .company-hero-logo {
    width: 46px;
    height: 46px;
    border-radius: 12px;
    font-size: 15px;
  }

  .company-section-head,
  .company-section-body {
    padding-right: 13px;
    padding-left: 13px;
  }

  .company-timeline::before {
    left: 58px;
  }

  .company-timeline-item {
    grid-template-columns: 46px 12px minmax(0, 1fr);
    gap: 8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .company-dossier,
  .companies-spinner,
  .icon-button.loading i {
    animation: none;
  }
}
