:root {
  --bg: #f4f7fb;
  --surface: rgba(255, 255, 255, 0.96);
  --surface-soft: #f8fafc;
  --text: #1f2937;
  --muted: #667085;
  --border: #dbe3ef;
  --border-strong: #c4d2e3;
  --accent: #0f172a;
  --yes: #0f766e;
  --no: #b42318;
  --ctx: #7c3aed;
  --neutral: #475467;
  --shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
  --radius-lg: 24px;
  --radius-md: 18px;
  --radius-sm: 12px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(191, 219, 254, 0.42), transparent 24%),
    linear-gradient(180deg, #f8fbff 0%, var(--bg) 100%);
  color: var(--text);
  font-family: Inter, Arial, Helvetica, sans-serif;
}

a {
  color: inherit;
}

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

.page-main {
  flex: 1;
  padding: 18px 0 36px;
}

.page-container {
  width: min(1440px, calc(100% - 32px));
  margin: 0 auto;
  display: grid;
  gap: 18px;
}

.hero-card,
.stat-card,
.panel,
.note-card {
  background: var(--surface);
  border: 1px solid rgba(219, 227, 239, 0.95);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.hero-card {
  padding: 24px 28px;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: end;
}

.back-page-link {
  position: relative;
  z-index: 5;
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  width: max-content;
  padding: 2px 0;
  color: #475569;
  cursor: pointer;
  text-decoration: none;
  font-size: 13px;
  font-weight: 800;
  line-height: 1.2;
  pointer-events: auto;
}

.back-page-link::before {
  content: "‹";
  font-size: 18px;
  line-height: 1;
  transform: translateY(-1px);
}

.back-page-link:hover {
  color: #0f172a;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.section-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.section-eyebrow::before {
  display: none;
}

.hero-card__title,
.panel__title {
  margin: 0;
  color: #0f172a;
}

.hero-card__title {
  font-size: clamp(30px, 4vw, 40px);
  line-height: 1.05;
}

.hero-card__body,
.stat-card__hint,
.panel__subtitle,
.page-item__meta,
.note-card p {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.hero-card__body {
  max-width: 860px;
  margin: 14px 0 0;
}

.hero-card__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.button,
.button-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 18px;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 700;
}

.button {
  background: var(--accent);
  color: #fff;
}

.button-secondary {
  border: 1px solid var(--border-strong);
  background: #fff;
  color: var(--accent);
}

.stats-grid,
.role-grid,
.notes-grid,
.page-map-grid,
.feature-grid {
  display: grid;
  gap: 14px;
}

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

.role-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.notes-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

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

.feature-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.stat-card {
  padding: 18px 20px;
}

.stat-card__label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.stat-card__value {
  margin-top: 10px;
  font-size: 34px;
  font-weight: 800;
  color: #0f172a;
}

.stat-card__hint {
  margin-top: 8px;
}

.panel__header {
  padding: 20px 22px 0;
}

.panel__title {
  font-size: 24px;
  line-height: 1.1;
}

.panel__subtitle {
  margin: 10px 0 0;
}

.panel__body {
  padding: 18px 22px 22px;
}

.panel__body--table {
  padding-top: 16px;
}

.panel__body--stack {
  display: grid;
  gap: 12px;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: #fff;
}

.access-table {
  width: 100%;
  min-width: 1080px;
  border-collapse: collapse;
}

.access-table th,
.access-table td {
  padding: 14px 12px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
  font-size: 14px;
  line-height: 1.45;
}

.access-table th {
  position: sticky;
  top: 0;
  background: #f8fafc;
  color: #344054;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  z-index: 1;
}

.access-table tbody tr:last-child td {
  border-bottom: 0;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.pill--yes {
  background: rgba(15, 118, 110, 0.12);
  color: var(--yes);
}

.pill--no {
  background: rgba(180, 35, 24, 0.12);
  color: var(--no);
}

.pill--ctx {
  background: rgba(124, 58, 237, 0.12);
  color: var(--ctx);
}

.pill--neutral {
  background: rgba(71, 84, 103, 0.12);
  color: var(--neutral);
}

.page-item {
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: #fff;
}

.map-card {
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: #fff;
}

.map-card__header {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}

.map-card__title,
.feature-card__title {
  margin: 0;
  color: #0f172a;
  font-size: 20px;
  line-height: 1.2;
}

.tree-list {
  display: grid;
  gap: 10px;
}

.tree-item,
.feature-item {
  position: relative;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-soft);
}

.tree-item--child {
  margin-left: 18px;
}

.tree-item--grandchild {
  margin-left: 36px;
}

.tree-item--child::before,
.tree-item--grandchild::before {
  content: "";
  position: absolute;
  left: -12px;
  top: 18px;
  width: 12px;
  height: 1px;
  background: var(--border-strong);
}

.tree-item__title,
.feature-item__title {
  color: #0f172a;
  font-weight: 700;
}

.tree-item__meta,
.feature-item__meta,
.feature-card__body {
  margin-top: 6px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.feature-card {
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: #fff;
}

.feature-card__header {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}

.feature-card__body {
  margin-top: 0;
}

.feature-list {
  display: grid;
  gap: 10px;
}

.page-item__title,
.note-card__title {
  color: #0f172a;
  font-weight: 700;
}

.page-item__meta {
  margin-top: 6px;
}

.note-card {
  padding: 18px;
}

.note-card p {
  margin: 8px 0 0;
}

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

  .role-grid,
  .feature-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .page-container {
    width: min(100%, calc(100% - 20px));
  }

  .hero-card {
    flex-direction: column;
    align-items: stretch;
    padding: 20px;
  }

  .stats-grid,
  .notes-grid,
  .page-map-grid {
    grid-template-columns: 1fr;
  }

  .panel__body,
  .panel__header {
    padding-left: 18px;
    padding-right: 18px;
  }

  .tree-item--child,
  .tree-item--grandchild {
    margin-left: 0;
  }

  .tree-item--child::before,
  .tree-item--grandchild::before {
    display: none;
  }
}
