:root {
  --navy: #073763;
  --blue: #005aa8;
  --sky: #dff1ff;
  --green: #059669;
  --green-soft: #e7f7ef;
  --amber: #d97706;
  --amber-soft: #fff4dc;
  --red: #dc2626;
  --red-soft: #fee7e7;
  --purple: #6d28d9;
  --ink: #061a35;
  --muted: #63748d;
  --line: #dbe5f1;
  --panel: #ffffff;
  --bg: #f4f7fb;
  --shadow: 0 14px 34px rgba(7, 55, 99, 0.10);
  --radius: 8px;
  font-family: Inter, "Segoe UI", Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background:
    linear-gradient(180deg, rgba(0, 90, 168, 0.06), transparent 260px),
    var(--bg);
  color: var(--ink);
}

button, input, select { font: inherit; }
button { cursor: pointer; }

.shell { width: min(1880px, calc(100vw - 18px)); margin: 0 auto 32px; }
.topbar {
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.brand-lockup { display: flex; align-items: center; gap: 12px; }
.brand-lockup strong { display: block; color: var(--navy); font-size: 17px; line-height: 1; }
.brand-lockup span { display: block; color: var(--muted); font-size: 11px; margin-top: 3px; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center;
  background: radial-gradient(circle at 34% 28%, #fff 0 18%, #d71920 19% 30%, #005aa8 31% 100%);
  color: #fff; font-weight: 900; font-size: 18px;
  box-shadow: 0 8px 18px rgba(0, 90, 168, .24);
}
.topbar-meta { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }

.ghost-btn, .primary-btn {
  border: 1px solid #b9c9dd;
  border-radius: var(--radius);
  min-height: 34px;
  padding: 0 12px;
  background: #fff;
  color: var(--blue);
  font-weight: 800;
}
.primary-btn { background: var(--blue); color: #fff; border-color: var(--blue); }

.hero {
  min-height: 172px;
  display: flex;
  justify-content: space-between;
  align-items: stretch;
  gap: 20px;
  padding: 26px;
  color: #fff;
  background:
    linear-gradient(135deg, rgba(5, 150, 105, .86), rgba(0, 90, 168, .95) 44%, #073763 100%);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border-bottom: 5px solid #d71920;
}
.compact-hero {
  min-height: 68px;
  padding: 10px 14px;
  border-bottom-width: 3px;
}
.compact-hero h1 {
  font-size: clamp(22px, 2.4vw, 32px);
}
.compact-hero p {
  display: none;
}
.hero h1 { max-width: 920px; margin: 0; font-size: clamp(30px, 4vw, 54px); line-height: .98; letter-spacing: 0; }
.hero p { max-width: 760px; margin: 12px 0 0; color: rgba(255,255,255,.86); font-size: 16px; }
.hero.compact-hero h1 { font-size: clamp(22px, 2.4vw, 32px); }
.hero.compact-hero p { display: none; }
.eyebrow { margin: 0 0 5px; text-transform: uppercase; letter-spacing: .06em; font-size: 10px; font-weight: 900; }
.hero-score {
  min-width: 166px;
  padding: 8px 10px;
  border: 1px solid rgba(255,255,255,.25);
  background: rgba(255,255,255,.12);
  display: flex; flex-direction: column; justify-content: center;
  border-radius: var(--radius);
}
.hero-score span, .hero-score small { color: rgba(255,255,255,.82); font-weight: 700; }
.hero-score strong { font-size: 22px; line-height: 1.1; margin: 2px 0; }
.compact-hero .hero-score small { display: none; }
.compact-hero .hero-score span { font-size: 10px; }

.filters {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: 150px 150px minmax(190px, 1fr) minmax(170px, .7fr) minmax(260px, 1.2fr) 100px;
  gap: 8px;
  align-items: end;
  margin: 8px 0;
  padding: 10px;
  background: rgba(255,255,255,.96);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 10px 26px rgba(7,55,99,.08);
  backdrop-filter: blur(8px);
}
label { display: grid; gap: 4px; color: #23405f; font-size: 11px; font-weight: 900; text-transform: uppercase; }
select, input {
  width: 100%;
  min-height: 36px;
  border: 1px solid #b9c9dd;
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  padding: 0 12px;
  outline: none;
}
select:focus, input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(0,90,168,.12); }

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 8px;
  padding: 0;
}
.tabs button {
  min-height: 36px;
  border: 1px solid #b9c9dd;
  border-radius: var(--radius);
  background: #fff;
  color: var(--blue);
  padding: 0 12px;
  font-weight: 900;
  font-size: 13px;
}
.tabs button.active { background: var(--blue); border-color: var(--blue); color: #fff; }

.tab-pane { display: none; }
.tab-pane.active { display: block; }

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 8px;
}
.kpi-grid.overview-only { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.kpi-grid.slim { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.kpi-card {
  position: relative;
  min-height: 92px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 10px 24px rgba(7,55,99,.07);
  overflow: hidden;
}
.kpi-card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 4px; background: var(--blue); }
.kpi-card.good { background: linear-gradient(180deg, #fff, var(--green-soft)); }
.kpi-card.good::before { background: var(--green); }
.kpi-card.warn { background: linear-gradient(180deg, #fff, var(--amber-soft)); }
.kpi-card.warn::before { background: var(--amber); }
.kpi-card.bad { background: linear-gradient(180deg, #fff, var(--red-soft)); }
.kpi-card.bad::before { background: var(--red); }
.kpi-card.base { background: linear-gradient(180deg, #fff, var(--sky)); }
.kpi-card.base::before { background: var(--blue); }
.kpi-card label { display: block; color: #6d7d96; font-size: 11px; margin-bottom: 8px; }
.kpi-card strong { display: block; font-size: clamp(21px, 2.4vw, 30px); line-height: 1; color: #061a35; letter-spacing: 0; }
.kpi-card small { display: block; color: #63748d; margin-top: 7px; font-size: 12px; }

.layout-2 { display: grid; grid-template-columns: 1.25fr .75fr; gap: 14px; margin-bottom: 14px; }
.layout-2 .span-2 { grid-column: auto; }
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  box-shadow: 0 10px 24px rgba(7,55,99,.07);
  margin-bottom: 8px;
}
.panel-head, .section-tools {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
h2 { margin: 0; font-size: 15px; color: #052d5c; letter-spacing: 0; }
.panel-head span, .section-tools p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.section-tools { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; box-shadow: var(--shadow); margin-bottom: 8px; }
.section-tools label { width: 130px; }

.subtabs {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  margin: 0 0 8px;
  background: #e9f1fb;
  border: 1px solid #cbdbea;
  border-radius: var(--radius);
}
.subtabs button {
  min-height: 32px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #0a3b67;
  padding: 0 14px;
  font-weight: 900;
  font-size: 13px;
}
.subtabs button.active { background: #fff; color: var(--blue); box-shadow: 0 2px 8px rgba(7,55,99,.12); }
.impact-pane { display: none; }
.impact-pane.active { display: block; }

.chart { min-height: 260px; width: 100%; }
.chart.horizontal { min-height: 380px; }
.svg-chart { width: 100%; height: 100%; min-height: inherit; display: block; }
.axis-label { fill: #52657d; font-size: 11px; }
.value-label { fill: #061a35; font-size: 11px; font-weight: 800; }
.legend { display: flex; flex-wrap: wrap; gap: 8px 14px; margin-top: 12px; color: var(--muted); font-size: 12px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; }

.data-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.data-table th, .data-table td {
  border-bottom: 1px solid #e3ebf5;
  padding: 6px 7px;
  vertical-align: middle;
  font-size: 11.5px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}
.data-table th {
  color: #fff;
  background: #073763;
  text-align: left;
  user-select: none;
  cursor: pointer;
  position: sticky;
  top: 0;
  z-index: 1;
  height: 34px;
}
.data-table tr:nth-child(even) td { background: #f8fbff; }
.data-table td.num, .data-table th.num { text-align: right; overflow-wrap: normal; white-space: nowrap; }
.data-table td.rank, .data-table th.rank { width: 46px; text-align: center; }
.table-wrap { width: 100%; max-height: min(62vh, 640px); overflow-y: auto; overflow-x: hidden; border-radius: var(--radius); border: 1px solid #e3ebf5; scrollbar-gutter: stable; }
.table-footer { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 7px; color: var(--muted); font-size: 11px; }
.pager { display: flex; gap: 6px; }
.pager button { border: 1px solid #b9c9dd; background: #fff; border-radius: 6px; padding: 5px 9px; color: var(--blue); font-weight: 800; }
.badge { display: inline-flex; align-items: center; min-height: 20px; padding: 1px 7px; border-radius: 999px; font-weight: 900; font-size: 10px; }
.badge.good { background: var(--green-soft); color: #047857; }
.badge.bad { background: var(--red-soft); color: #b91c1c; }
.badge.warn { background: var(--amber-soft); color: #92400e; }
.badge.base { background: var(--sky); color: var(--blue); }
.link-btn { border: 0; color: var(--blue); background: transparent; font-weight: 900; padding: 0; }

.table-supplierTypeSummary .data-table th:nth-child(1),
.table-supplierTypeSummary .data-table td:nth-child(1) { width: 22%; }
.table-supplierTypeSummary .data-table th:nth-child(2),
.table-supplierTypeSummary .data-table td:nth-child(2) { width: 8%; }
.table-supplierTypeSummary .data-table th:nth-child(3),
.table-supplierTypeSummary .data-table td:nth-child(3),
.table-supplierTypeSummary .data-table th:nth-child(4),
.table-supplierTypeSummary .data-table td:nth-child(4),
.table-supplierTypeSummary .data-table th:nth-child(6),
.table-supplierTypeSummary .data-table td:nth-child(6),
.table-supplierTypeSummary .data-table th:nth-child(7),
.table-supplierTypeSummary .data-table td:nth-child(7) { width: 11%; }
.table-supplierTypeSummary .data-table th:nth-child(5),
.table-supplierTypeSummary .data-table td:nth-child(5),
.table-supplierTypeSummary .data-table th:nth-child(8),
.table-supplierTypeSummary .data-table td:nth-child(8) { width: 9%; text-align: center; }

.table-growthTable .data-table th:nth-child(1),
.table-growthTable .data-table td:nth-child(1),
.table-dropTable .data-table th:nth-child(1),
.table-dropTable .data-table td:nth-child(1) { width: 7%; }
.table-growthTable .data-table th:nth-child(2),
.table-growthTable .data-table td:nth-child(2),
.table-dropTable .data-table th:nth-child(2),
.table-dropTable .data-table td:nth-child(2) { width: 20%; }
.table-growthTable .data-table th:nth-child(3),
.table-growthTable .data-table td:nth-child(3),
.table-dropTable .data-table th:nth-child(3),
.table-dropTable .data-table td:nth-child(3) { width: 16%; }
.table-growthTable .data-table th:nth-child(n+4),
.table-growthTable .data-table td:nth-child(n+4),
.table-dropTable .data-table th:nth-child(n+4),
.table-dropTable .data-table td:nth-child(n+4) { width: 9.5%; }

.table-impactTable .data-table th:nth-child(1),
.table-impactTable .data-table td:nth-child(1),
.table-techImpactTable .data-table th:nth-child(1),
.table-techImpactTable .data-table td:nth-child(1) { width: 4%; }
.table-impactTable .data-table th:nth-child(2),
.table-impactTable .data-table td:nth-child(2),
.table-techImpactTable .data-table th:nth-child(2),
.table-techImpactTable .data-table td:nth-child(2) { width: 8%; }
.table-impactTable .data-table th:nth-child(3),
.table-impactTable .data-table td:nth-child(3),
.table-techImpactTable .data-table th:nth-child(3),
.table-techImpactTable .data-table td:nth-child(3) { width: 17%; }
.table-impactTable .data-table th:nth-child(4),
.table-impactTable .data-table td:nth-child(4),
.table-techImpactTable .data-table th:nth-child(4),
.table-techImpactTable .data-table td:nth-child(4) { width: 17%; }
.table-impactTable .data-table th:nth-child(n+5),
.table-impactTable .data-table td:nth-child(n+5),
.table-techImpactTable .data-table th:nth-child(n+5),
.table-techImpactTable .data-table td:nth-child(n+5) { width: 13.5%; }

.table-topTable .data-table th:nth-child(1),
.table-topTable .data-table td:nth-child(1) { width: 4%; }
.table-topTable .data-table th:nth-child(2),
.table-topTable .data-table td:nth-child(2) { width: 7%; }
.table-topTable .data-table th:nth-child(3),
.table-topTable .data-table td:nth-child(3) { width: 16%; }
.table-topTable .data-table th:nth-child(4),
.table-topTable .data-table td:nth-child(4) { width: 14%; }
.table-topTable .data-table th:nth-child(5),
.table-topTable .data-table td:nth-child(5),
.table-topTable .data-table th:nth-child(6),
.table-topTable .data-table td:nth-child(6) { width: 10%; }
.table-topTable .data-table th:nth-child(n+7),
.table-topTable .data-table td:nth-child(n+7) { width: 7%; }

.table-newTable .data-table th:nth-child(1),
.table-newTable .data-table td:nth-child(1),
.table-zeroTable .data-table th:nth-child(1),
.table-zeroTable .data-table td:nth-child(1),
.table-alertsTable .data-table th:nth-child(2),
.table-alertsTable .data-table td:nth-child(2) { width: 8%; }
.table-newTable .data-table th:nth-child(2),
.table-newTable .data-table td:nth-child(2),
.table-zeroTable .data-table th:nth-child(2),
.table-zeroTable .data-table td:nth-child(2) { width: 22%; }
.table-newTable .data-table th:nth-child(3),
.table-newTable .data-table td:nth-child(3),
.table-zeroTable .data-table th:nth-child(3),
.table-zeroTable .data-table td:nth-child(3) { width: 18%; }
.table-newTable .data-table th:nth-child(n+4),
.table-newTable .data-table td:nth-child(n+4),
.table-zeroTable .data-table th:nth-child(n+4),
.table-zeroTable .data-table td:nth-child(n+4) { width: 13%; }

.table-alertsTable .data-table th:nth-child(1),
.table-alertsTable .data-table td:nth-child(1) { width: 13%; }
.table-alertsTable .data-table th:nth-child(3),
.table-alertsTable .data-table td:nth-child(3) { width: 22%; }
.table-alertsTable .data-table th:nth-child(4),
.table-alertsTable .data-table td:nth-child(4) { width: 18%; }
.table-alertsTable .data-table th:nth-child(5),
.table-alertsTable .data-table td:nth-child(5) { width: 9%; }
.table-alertsTable .data-table th:nth-child(6),
.table-alertsTable .data-table td:nth-child(6) { width: 12%; }
.table-alertsTable .data-table th:nth-child(7),
.table-alertsTable .data-table td:nth-child(7) { width: 18%; }

.table-qualityTable .data-table th:nth-child(1),
.table-qualityTable .data-table td:nth-child(1) { width: 20%; }
.table-qualityTable .data-table th:nth-child(2),
.table-qualityTable .data-table td:nth-child(2) { width: 20%; }
.table-qualityTable .data-table th:nth-child(3),
.table-qualityTable .data-table td:nth-child(3) { width: 12%; text-align: center; }
.table-qualityTable .data-table th:nth-child(4),
.table-qualityTable .data-table td:nth-child(4) { width: 48%; }

dialog {
  width: min(900px, calc(100vw - 32px));
  border: 0;
  border-radius: var(--radius);
  box-shadow: 0 30px 90px rgba(6,26,53,.35);
  padding: 0;
}
dialog::backdrop { background: rgba(6,26,53,.45); }
.dialog-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 18px; background: #073763; color: #fff; }
.dialog-head h2 { color: #fff; }
.dialog-head button { border: 1px solid rgba(255,255,255,.4); background: transparent; color: #fff; border-radius: 6px; padding: 6px 10px; }
#producerProfile { padding: 18px; }
.profile-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 14px; }
.profile-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; background: #f8fbff; }
.profile-card span { display: block; color: var(--muted); font-size: 12px; }
.profile-card strong { display: block; margin-top: 8px; font-size: 22px; }

.empty { min-height: 180px; display: grid; place-items: center; color: var(--muted); background: #f8fbff; border: 1px dashed #bdd0e6; border-radius: var(--radius); }

@media (max-width: 1180px) {
  .filters { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .kpi-grid, .kpi-grid.slim, .kpi-grid.overview-only { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .layout-2 { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .shell { width: min(100vw - 20px, 1880px); }
  .topbar, .hero, .panel-head, .section-tools { align-items: stretch; flex-direction: column; }
  .topbar { height: auto; padding: 12px 0; }
  .topbar-meta { flex-wrap: wrap; }
  .hero-score { min-width: 0; }
  .filters { position: static; grid-template-columns: 1fr; }
  .kpi-grid, .kpi-grid.slim, .kpi-grid.overview-only, .profile-grid { grid-template-columns: 1fr; }
  .tabs { overflow-x: auto; flex-wrap: nowrap; padding-bottom: 6px; }
  .tabs button { white-space: nowrap; }
  .data-table th, .data-table td { font-size: 11px; padding: 8px 6px; }
}
