:root {
  --bg: #07110f;
  --surface: rgba(11, 20, 18, 0.94);
  --surface-soft: rgba(10, 17, 15, 0.72);
  --surface-strong: #0c1513;
  --line: rgba(160, 188, 179, 0.12);
  --line-strong: rgba(160, 188, 179, 0.18);
  --text: #eef3f1;
  --muted: #9eb0aa;
  --red: #9a3734;
  --yellow: #a77d24;
  --green: #2d7147;
  --green-deep: #224d34;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family:
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(45, 122, 74, 0.22), transparent 24%),
    radial-gradient(circle at top right, rgba(163, 59, 56, 0.18), transparent 20%),
    linear-gradient(180deg, #091211 0%, #050908 100%);
}

button,
input,
table {
  font: inherit;
}

.dashboard-shell {
  width: min(1560px, calc(100vw - 28px));
  margin: 0 auto;
  padding: 18px 0 32px;
}

.masthead,
.workspace,
.inventory-panel {
  border: 1px solid var(--line);
  background: var(--surface);
}

.masthead {
  display: grid;
  gap: 8px;
  padding: 16px 18px 14px;
  background: var(--surface-strong);
}

.masthead-heading {
  display: grid;
  gap: 4px;
}

.masthead-copy-block {
  display: grid;
  gap: 10px;
}

.masthead-meta {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
}

.eyebrow,
.section-kicker,
.summary-label {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.66rem;
  color: var(--muted);
}

h1 {
  margin: 0;
  font-size: clamp(1.65rem, 4vw, 2.7rem);
  line-height: 0.94;
  letter-spacing: -0.025em;
}

.masthead-copy,
.section-note,
#maturity-copy {
  margin: 0;
  max-width: 58ch;
  color: var(--muted);
  line-height: 1.35;
}

.masthead-copy {
  font-size: 0.88rem;
}

.masthead-copy a {
  color: var(--text);
  text-decoration-color: rgba(238, 243, 241, 0.28);
  text-underline-offset: 0.16em;
}

.masthead-copy a:hover,
.masthead-copy a:focus-visible {
  text-decoration-color: rgba(238, 243, 241, 0.72);
  outline: none;
}

.masthead-links {
  display: flex;
  align-items: center;
  gap: 10px;
}

.masthead-link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  color: var(--text);
  background: transparent;
  text-decoration: none;
  font-size: 0.82rem;
  transition:
    background 180ms ease,
    border-color 180ms ease;
}

.masthead-link-button:hover,
.masthead-link-button:focus-visible {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(232, 242, 238, 0.28);
  outline: none;
}

.masthead-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, auto));
  gap: 14px;
  align-items: end;
}

.summary-item {
  display: grid;
  gap: 2px;
  min-width: 72px;
}

.summary-item strong {
  font-size: clamp(1rem, 1.4vw, 1.18rem);
  font-weight: 600;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.9fr) minmax(280px, 0.62fr);
  gap: 16px;
  align-items: stretch;
  margin-top: 14px;
  border: 0;
  background: transparent;
}

.treemap-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 14px 14px 12px;
  border: 1px solid var(--line);
  background: var(--surface-strong);
}

.detail-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  gap: 10px;
  padding: 14px 14px 12px;
  scroll-margin-top: 12px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
}

.inventory-panel {
  padding: 24px;
}

.inventory-panel.subdued {
  margin-top: 12px;
  padding: 14px 16px 18px;
  background: rgba(9, 15, 13, 0.44);
}

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

.section-heading.compact {
  margin-bottom: 6px;
}

.section-heading h2,
.section-heading h3 {
  margin: 2px 0 0;
  font-size: clamp(1.1rem, 1.45vw, 1.48rem);
}

.section-note {
  max-width: 22ch;
  text-align: right;
  font-size: 0.82rem;
}

.treemap {
  position: relative;
  flex: 1 1 auto;
  width: 100%;
  min-height: 700px;
  border: 1px solid var(--line);
  overflow: hidden;
  background: #0b1513;
}

.treemap-tile {
  position: absolute;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 10px;
  border: 1px solid rgba(240, 245, 243, 0.08);
  color: #f3f7f6;
  cursor: pointer;
  overflow: hidden;
  transition:
    transform 140ms ease,
    opacity 140ms ease,
    border-color 140ms ease;
}

.treemap-tile.meta-hidden {
  justify-content: center;
}

.treemap-tile.meta-hidden .treemap-title {
  text-align: center;
}

.treemap-tile:hover,
.treemap-tile:focus-visible {
  opacity: 0.96;
  border-color: rgba(255, 255, 255, 0.2);
  outline: none;
}

.treemap-tile.active {
  border-color: rgba(240, 245, 243, 0.72);
}

.treemap-tile.red {
  background: #742523;
}

.treemap-tile.yellow {
  background: #88601a;
}

.treemap-tile.green {
  background: #255f3a;
}

.treemap-title {
  margin: 0;
  font-size: var(--tile-font-size, clamp(1rem, 1.25vw, 1.65rem));
  font-weight: 600;
  line-height: 0.9;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.treemap-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  margin: 0;
  color: rgba(243, 247, 246, 0.72);
  font-size: clamp(0.76rem, 0.88vw, 0.95rem);
}

.gauge-panel {
  padding: 8px 0 6px;
  border-bottom: 1px solid var(--line);
}

.gauge-wrap {
  display: grid;
  grid-template-columns: 132px 1fr;
  align-items: center;
  gap: 10px;
}

.gauge {
  width: 100%;
  height: auto;
}

.gauge-label {
  display: block;
  margin-bottom: 2px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.11em;
  font-size: 0.64rem;
}

#maturity-label {
  display: block;
  margin-bottom: 4px;
  font-size: clamp(1.05rem, 1.45vw, 1.38rem);
}

#maturity-copy {
  max-width: 24ch;
  font-size: 0.76rem;
  line-height: 1.3;
}

.metrics-panel {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  padding: 0;
}

.metric {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}

.metric span {
  display: inline-block;
  color: var(--muted);
  font-size: 0.74rem;
}

.metric strong {
  display: inline-block;
  margin-top: 0;
  font-size: 1rem;
  font-weight: 600;
}

.inventory-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.inventory-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 0 10px;
  border-bottom: 1px solid var(--line);
}

.inventory-count,
.inventory-page-summary {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.inventory-pagination {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.pagination-button {
  min-width: 94px;
  padding: 8px 12px;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  transition:
    background 180ms ease,
    border-color 180ms ease,
    opacity 180ms ease;
}

.pagination-button:hover:not(:disabled),
.pagination-button:focus-visible:not(:disabled) {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(232, 242, 238, 0.28);
  outline: none;
}

.pagination-button:disabled {
  opacity: 0.45;
  cursor: default;
}

.table-wrap {
  overflow-x: auto;
  margin-top: 10px;
  border-top: 1px solid var(--line);
}

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

thead th {
  padding: 12px 10px;
  text-align: left;
  font-size: 0.74rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  background: transparent;
}

tbody td {
  padding: 13px 10px;
  border-top: 1px solid var(--line);
  vertical-align: top;
  font-size: 0.9rem;
}

.inventory-table tbody tr {
  transition: background 180ms ease;
}

.inventory-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.012);
}

.inventory-table th:first-child,
.inventory-table td:first-child {
  width: 34%;
}

.use-case-name {
  font-weight: 600;
}

.use-case-context {
  display: inline-flex;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.66rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.use-case-subtext {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.8rem;
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border: 1px solid var(--line-strong);
  font-size: 0.82rem;
  line-height: 1;
  white-space: nowrap;
  background: rgba(255, 255, 255, 0.02);
}

.stage-pill.green {
  border-color: rgba(45, 122, 74, 0.4);
  background: rgba(45, 122, 74, 0.14);
}

.stage-pill.yellow {
  border-color: rgba(178, 133, 40, 0.42);
  background: rgba(178, 133, 40, 0.16);
}

.stage-pill.red,
.impact-pill.red {
  border-color: rgba(163, 59, 56, 0.4);
  background: rgba(163, 59, 56, 0.16);
}

.stage-pill.neutral,
.impact-pill.neutral {
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.03);
}

.empty-state {
  padding: 24px 10px;
  color: var(--muted);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 1180px) {
  .dashboard-shell {
    width: min(100vw - 22px, 100%);
    padding: 16px 0 28px;
  }

  .workspace {
    grid-template-columns: minmax(0, 1.7fr) minmax(260px, 0.7fr);
  }

  .masthead-meta {
    align-items: start;
    flex-direction: column;
  }

  .masthead-stats {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    width: 100%;
  }

  .section-heading h2,
  .section-heading h3 {
    font-size: clamp(1.04rem, 1.5vw, 1.32rem);
  }

  .gauge-wrap {
    grid-template-columns: 116px 1fr;
  }
}

@media (max-width: 980px) {
  .masthead-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .workspace {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .detail-panel {
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .treemap {
    min-height: 520px;
  }
}

@media (max-width: 760px) {
  .dashboard-shell {
    width: min(100vw - 16px, 100%);
    padding-top: 10px;
  }

  .masthead {
    padding: 14px 14px 12px;
  }

  h1 {
    font-size: clamp(1.5rem, 8vw, 2.2rem);
  }

  .summary-item {
    min-width: 0;
  }

  .section-heading,
  .inventory-header {
    align-items: start;
    flex-direction: column;
  }

  .section-note {
    max-width: none;
    text-align: left;
  }

  .treemap-panel,
  .detail-panel,
  .inventory-panel {
    padding-left: 12px;
    padding-right: 12px;
  }

  .treemap {
    min-height: 460px;
  }

  .treemap-tile {
    padding: 9px;
  }

  .treemap-meta {
    display: none;
  }

  .gauge-panel {
    padding: 10px 0 7px;
  }

  .gauge-wrap {
    grid-template-columns: 118px 1fr;
    gap: 8px;
  }

  #maturity-label {
    font-size: clamp(1rem, 4.5vw, 1.25rem);
  }

  #maturity-copy {
    font-size: 0.74rem;
  }

  .metric strong {
    font-size: 0.96rem;
  }

  .inventory-toolbar,
  .inventory-pagination {
    width: 100%;
    align-items: stretch;
    flex-direction: column;
  }

  .pagination-button {
    width: 100%;
  }
}

@media (max-width: 640px) {
  .dashboard-shell {
    width: min(100vw - 12px, 100%);
    padding-top: 8px;
  }

  .masthead-stats {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .masthead-meta {
    gap: 12px;
  }

  .treemap {
    min-height: 400px;
  }

  .treemap-tile {
    padding: 7px;
  }

  .gauge-wrap {
    grid-template-columns: 1fr;
  }

  .gauge {
    max-width: 190px;
  }

  .table-wrap {
    overflow: visible;
    margin-top: 12px;
    border-top: 0;
  }

  .inventory-table {
    table-layout: auto;
  }

  .inventory-table thead {
    display: none;
  }

  .inventory-table,
  .inventory-table tbody,
  .inventory-table tbody tr,
  .inventory-table tbody td {
    display: block;
    width: 100%;
  }

  .inventory-table tbody {
    display: grid;
    gap: 12px;
  }

  .inventory-table tbody tr {
    padding: 14px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.02);
  }

  .inventory-table tbody td {
    display: grid;
    grid-template-columns: 88px 1fr;
    gap: 10px;
    padding: 0;
    border-top: 0;
  }

  .inventory-table tbody td + td {
    margin-top: 10px;
  }

  .inventory-table th:first-child,
  .inventory-table td:first-child {
    width: auto;
  }

  .inventory-table tbody td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 0.68rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
  }

  .inventory-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.02);
  }

  .use-case-name {
    font-size: 0.96rem;
  }

  .use-case-subtext {
    margin-top: 6px;
    font-size: 0.8rem;
  }

  .pill {
    justify-self: start;
  }

  .empty-state {
    display: block;
    padding: 0;
  }

  .empty-state::before {
    content: none;
  }
}
