:root {
  color-scheme: light;
  --bg: #f7f8f5;
  --surface: #ffffff;
  --surface-2: #eef4f1;
  --line: #d9e1dc;
  --text: #17211d;
  --muted: #66736d;
  --accent: #0f766e;
  --accent-soft: #d8f0ec;
  --good: #138a4a;
  --warn: #a45f00;
  --risk: #bf2f2f;
  --good-soft: #dff3e8;
  --warn-soft: #fff0d3;
  --risk-soft: #ffe0df;
  --radius: 14px;
  --shadow: 0 18px 50px rgba(34, 48, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100dvh;
  background:
    linear-gradient(135deg, rgba(15, 118, 110, 0.08), transparent 34rem),
    var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.shell {
  width: min(1440px, calc(100% - 32px));
  margin: 0 auto;
  padding: 36px 0 64px;
}

.page-header {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 24px;
  align-items: end;
  margin-bottom: 24px;
}

.label {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(34px, 5vw, 72px);
  line-height: 0.96;
  letter-spacing: 0;
}

.intro {
  max-width: 680px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.7;
}

.legend {
  display: flex;
  gap: 14px;
  align-items: center;
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  white-space: nowrap;
}

.dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-right: 6px;
  border-radius: 50%;
  vertical-align: 1px;
}

.good {
  background: var(--good);
}

.warn {
  background: var(--warn);
}

.risk {
  background: var(--risk);
}

.overview {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.overview-card,
.person-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.84);
  box-shadow: var(--shadow);
}

.overview-card {
  padding: 18px;
}

.overview-card span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.overview-card strong {
  display: block;
  margin-top: 10px;
  font-size: 30px;
  line-height: 1;
}

.people {
  display: grid;
  gap: 18px;
}

.person-card {
  padding: 22px;
}

.card-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: start;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.person-meta {
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 14px;
}

h2 {
  font-size: clamp(26px, 3vw, 40px);
  line-height: 1.08;
}

.status-pill,
.metric .value {
  font-variant-numeric: tabular-nums;
}

.status-pill {
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 750;
  white-space: nowrap;
}

.status-pill.good {
  color: var(--good);
  background: var(--good-soft);
}

.status-pill.warn {
  color: var(--warn);
  background: var(--warn-soft);
}

.status-pill.risk {
  color: var(--risk);
  background: var(--risk-soft);
}

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

.summary-copy {
  display: grid;
  gap: 12px;
  align-content: start;
  color: #26332e;
  line-height: 1.75;
}

.summary-copy p {
  max-width: 78ch;
}

.advice {
  color: var(--muted);
}

.trend-panel {
  min-height: 190px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.trend-title {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.trend-chart {
  margin-top: 8px;
}

.trend-chart svg {
  display: block;
  width: 100%;
  height: 140px;
}

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

.metric {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.metric .value {
  margin-top: 8px;
  font-size: 20px;
  font-weight: 800;
  line-height: 1;
}

.metric.good {
  border-color: rgba(19, 138, 74, 0.28);
  background: var(--good-soft);
}

.metric.warn {
  border-color: rgba(164, 95, 0, 0.28);
  background: var(--warn-soft);
}

.metric.risk {
  border-color: rgba(191, 47, 47, 0.25);
  background: var(--risk-soft);
}

.skill-summary {
  margin-top: 18px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcfa;
}

.skill-summary h3 {
  margin: 0 0 10px;
  font-size: 15px;
}

.skill-summary pre {
  margin: 0;
  white-space: pre-wrap;
  color: #26332e;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.75;
}

.industry-section {
  height: min(33dvh, 360px);
  min-height: 260px;
  margin-top: 18px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcfa;
  overflow: hidden;
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 10px;
}

.section-head h3 {
  margin: 0;
  font-size: 15px;
}

.section-head p {
  color: var(--muted);
  font-size: 13px;
}

.industry-content {
  height: calc(100% - 35px);
  min-height: 0;
}

.industry-cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  align-content: start;
  min-height: 0;
  overflow: auto;
  padding-right: 2px;
}

.industry-card {
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

.industry-card-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
}

.industry-name {
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.industry-total {
  font-size: 17px;
  font-weight: 850;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.industry-count {
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
}

.industry-mini-bars {
  display: grid;
  gap: 6px;
  margin-top: 10px;
}

.industry-summary-card {
  background: var(--surface-2);
}

.bar-line {
  display: grid;
  grid-template-columns: 18px minmax(90px, 1fr) 98px;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-size: 11px;
}

.bar-line b {
  color: var(--text);
  font-weight: 750;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.bar-track {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #e2e9e5;
}

.bar-track i {
  display: block;
  height: 100%;
  min-width: 2px;
  border-radius: inherit;
}

.bar-in {
  background: var(--good);
}

.bar-out {
  background: var(--warn);
}

.detail-panel {
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}

summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
  font-weight: 800;
}

summary::-webkit-details-marker {
  display: none;
}

summary b {
  color: var(--muted);
  font-size: 13px;
}

.table-wrap {
  max-height: 520px;
  overflow: auto;
  border-top: 1px solid var(--line);
}

table {
  width: 100%;
  min-width: 1080px;
  border-collapse: collapse;
  font-size: 13px;
}

th,
td {
  padding: 12px 14px;
  border-bottom: 1px solid #edf1ee;
  text-align: left;
  vertical-align: top;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f4f8f6;
  color: var(--muted);
  font-size: 12px;
}

th button {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  border: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
}

th button::after {
  content: "↕";
  color: #9aa8a1;
  font-size: 11px;
}

th button[data-direction="asc"]::after {
  content: "↑";
  color: var(--accent);
}

th button[data-direction="desc"]::after {
  content: "↓";
  color: var(--accent);
}

th button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 6px;
}

.customer-cell {
  width: 34%;
  min-width: 260px;
  max-width: 420px;
}

.industry-cell,
.type-cell {
  min-width: 112px;
  color: #31413b;
  font-weight: 650;
  white-space: nowrap;
}

.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.amount-in {
  color: var(--good);
  font-weight: 750;
}

.amount-out {
  color: var(--warn);
  font-weight: 750;
}

.zero-coverage {
  color: var(--risk);
  font-weight: 750;
}

@media (max-width: 1040px) {
  .page-header,
  .summary-grid {
    grid-template-columns: 1fr;
  }

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

  .industry-section {
    height: auto;
    max-height: none;
  }

  .industry-content {
    height: auto;
  }

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

  .legend {
    width: fit-content;
  }
}

@media (max-width: 680px) {
  .shell {
    width: min(100% - 20px, 1440px);
    padding-top: 20px;
  }

  .overview,
  .metric-grid,
  .industry-cards {
    grid-template-columns: 1fr;
  }

  .section-head,
  .industry-row,
  .bar-line {
    grid-template-columns: 1fr;
  }

  .section-head {
    display: grid;
  }

  .bar-line b {
    text-align: left;
  }

  .person-card {
    padding: 16px;
  }

  .card-head {
    display: grid;
  }

  .legend {
    flex-wrap: wrap;
    border-radius: 14px;
    padding: 12px;
  }
}
