@import url("https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500&family=Space+Grotesk:wght@400;500;700&display=swap");

:root {
  --bg: #f5f4ef;
  --bg-soft: #ffffffcc;
  --ink: #112017;
  --ink-muted: #44514a;
  --accent: #0f7a5d;
  --accent-soft: #9ddac4;
  --danger: #c2362f;
  --line: #d8e0d8;
  --radius: 14px;
  --shadow: 0 14px 50px rgba(17, 32, 23, 0.09);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Space Grotesk", "Avenir Next", "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(1200px 420px at 0% 0%, #f0f8f3 0%, transparent 72%),
    linear-gradient(180deg, #f9f8f4 0%, var(--bg) 100%);
  min-height: 100vh;
}

.bg-orb {
  position: fixed;
  width: 380px;
  height: 380px;
  border-radius: 50%;
  filter: blur(70px);
  pointer-events: none;
  z-index: -1;
}

.bg-orb-a {
  top: -80px;
  right: -60px;
  background: #c5f0dd;
}

.bg-orb-b {
  bottom: -140px;
  left: -80px;
  background: #ffd8a4;
}

.layout {
  max-width: 1160px;
  margin: 0 auto;
  padding: 2rem 1rem 2.5rem;
}

.hero {
  margin-bottom: 1.5rem;
}

.kicker {
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 0.2rem;
  color: var(--ink-muted);
  font-size: 0.8rem;
}

h1 {
  font-size: clamp(2rem, 6vw, 3.6rem);
  margin: 0;
}

.hero-copy {
  max-width: 700px;
  color: var(--ink-muted);
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 0.9rem;
  margin-bottom: 1rem;
}

.card {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
  box-shadow: var(--shadow);
}

.card h3 {
  margin: 0;
  font-size: 0.8rem;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.card p {
  margin: 0.45rem 0 0;
  font-size: 1.45rem;
  font-weight: 700;
}

.panel {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-top: 1rem;
  overflow: hidden;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  padding: 1rem;
  align-items: end;
}

.control-row {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 210px;
}

label {
  font-size: 0.85rem;
  color: var(--ink-muted);
}

input,
select,
button {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.6rem 0.7rem;
  font: inherit;
}

button {
  border: none;
  background: var(--accent);
  color: white;
  cursor: pointer;
  font-weight: 600;
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.table-panel {
  padding-bottom: 1rem;
}

.table-head {
  padding: 1rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem 1.2rem;
}

.table-head h2 {
  margin: 0;
}

.table-head p {
  margin: 0;
  color: var(--ink-muted);
  font-size: 0.9rem;
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 930px;
  table-layout: fixed;
}

th,
td {
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

th {
  font-size: 0.82rem;
  text-transform: uppercase;
  color: var(--ink-muted);
  letter-spacing: 0.05em;
}

th.sortable {
  cursor: pointer;
  user-select: none;
}

th.sortable .sort-indicator {
  display: inline-block;
  margin-left: 0.35rem;
  color: #84948b;
}

th.sortable.is-sorted {
  color: var(--ink);
}

th.sortable.is-sorted .sort-indicator {
  color: var(--accent);
}

th:nth-child(1),
td:nth-child(1) {
  width: 58px;
}

th:nth-child(2),
td:nth-child(2) {
  width: 95px;
}

th:nth-child(3),
td:nth-child(3) {
  width: 290px;
}

th:nth-child(4),
td:nth-child(4) {
  width: 210px;
}

th:nth-child(5),
td:nth-child(5) {
  width: 115px;
}

th:nth-child(6),
td:nth-child(6) {
  width: 95px;
}

th:nth-child(7),
td:nth-child(7) {
  width: 190px;
}

tbody tr {
  cursor: pointer;
  transition: background 150ms ease;
}

tbody tr:hover {
  background: #ebf6f0;
}

.value-positive {
  color: var(--accent);
  font-weight: 700;
}

.value-negative {
  color: var(--danger);
  font-weight: 700;
}

.pager {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.6rem;
  padding: 0 1rem;
  margin-top: 0.8rem;
}

.pager button {
  min-width: 90px;
}

.sector-bars {
  padding: 0 1rem 1rem;
}

.sector-item {
  margin-top: 0.65rem;
}

.sector-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.3rem;
  color: var(--ink-muted);
  font-size: 0.87rem;
}

.sector-track {
  height: 10px;
  background: #e7ece8;
  border-radius: 999px;
  overflow: hidden;
}

.sector-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent-soft), var(--accent));
  transform-origin: left;
  animation: fillGrow 0.7s ease both;
}

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

.mono {
  font-family: "IBM Plex Mono", "Consolas", monospace;
}

.detail-wrap {
  max-width: 960px;
}

.back-link {
  display: inline-flex;
  margin-bottom: 0.8rem;
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.65rem;
  padding: 0 1rem 1rem;
}

.kv {
  background: #f8fbf8;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.7rem;
}

.kv p:first-child {
  margin: 0;
  font-size: 0.78rem;
  text-transform: uppercase;
  color: var(--ink-muted);
}

.kv p:last-child {
  margin: 0.35rem 0 0;
  font-size: 1rem;
  font-weight: 600;
}

@keyframes fillGrow {
  from {
    transform: scaleX(0.15);
    opacity: 0.5;
  }
  to {
    transform: scaleX(1);
    opacity: 1;
  }
}

@media (max-width: 720px) {
  .layout {
    padding: 1.2rem 0.8rem 2rem;
  }

  .controls {
    flex-direction: column;
    align-items: stretch;
  }

  .control-row {
    min-width: 100%;
  }

  .pager {
    justify-content: space-between;
  }
}
