:root {
  --bg: #efe7db;
  --bg-accent: #dfd2bf;
  --panel: rgba(255, 250, 242, 0.9);
  --panel-strong: #fffaf3;
  --line: rgba(64, 47, 29, 0.12);
  --text: #251a12;
  --muted: #685949;
  --accent: #176b63;
  --accent-soft: rgba(23, 107, 99, 0.12);
  --warn: #a86618;
  --ok: #226a49;
  --shadow: 0 24px 56px rgba(78, 57, 32, 0.12);
  --radius: 24px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: "Inter", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(184, 92, 45, 0.18), transparent 24%),
    radial-gradient(circle at top right, rgba(23, 107, 99, 0.13), transparent 22%),
    linear-gradient(180deg, var(--bg) 0%, #e6dccd 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.16) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.16) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.34), transparent 88%);
}

.shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 44px;
  display: grid;
  gap: 16px;
}

.app-shell {
  display: grid;
  gap: 12px;
}

.auth-shell {
  min-height: 100vh;
}

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: start;
  padding: 30px;
  background:
    linear-gradient(135deg, rgba(255, 251, 244, 0.96), rgba(243, 229, 206, 0.84)),
    var(--panel);
}

.hero-copy {
  max-width: 760px;
}

.hero-meta {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: flex-end;
}

.hero-refresh-meta {
  display: grid;
  gap: 4px;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.62);
  min-width: 190px;
  text-align: right;
}

.hero-refresh-meta strong {
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.05rem;
}

.hero-refresh-meta small {
  color: var(--muted);
  line-height: 1.4;
}

.eyebrow {
  margin: 0 0 10px;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 800;
}

h1,
h2,
h3 {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
}

h1 {
  font-size: clamp(2.8rem, 5vw, 5rem);
  line-height: 0.92;
}

h2 {
  font-size: 1.45rem;
}

.lede,
.panel-meta,
.state-card p {
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.metric-label {
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 800;
}

.source-card h3,
.state-card h3 {
  font-family: "Space Grotesk", sans-serif;
}

.source-panel {
  display: grid;
  gap: 0;
  overflow: hidden;
}

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

.source-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.source-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
}

.source-tab + .source-tab {
  margin-left: -1px;
}

.source-tab {
  appearance: none;
  border: 1px solid var(--line);
  border-bottom: 0;
  border-radius: 18px 18px 0 0;
  background: rgba(255, 255, 255, 0.44);
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-weight: 800;
  padding: 12px 18px;
  transition:
    background 0.16s ease,
    border-color 0.16s ease,
    color 0.16s ease,
    transform 0.16s ease;
}

.source-tab:hover {
  color: var(--text);
  transform: translateY(-1px);
}

.source-tab.is-active {
  background: var(--panel-strong);
  border-color: rgba(23, 107, 99, 0.16);
  color: var(--accent);
  box-shadow: 0 -1px 0 rgba(255, 255, 255, 0.75);
  position: relative;
  z-index: 1;
}

.source-workspace {
  display: grid;
}

.source-panel-tabs {
  padding: 14px 18px 0;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.42), rgba(255, 255, 255, 0.18));
}

.source-panel-body {
  padding: 18px;
  display: grid;
}

.source-workspace-panel {
  display: grid;
  gap: 18px;
}

.source-workspace-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
}

.source-workspace-head h3 {
  margin-top: 2px;
  font-size: 1.4rem;
}

.source-workspace-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.handbook-shell {
  display: grid;
  gap: 14px;
}

.handbook-reader {
  display: grid;
  grid-template-columns: minmax(240px, 300px) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.handbook-toc {
  display: grid;
  gap: 10px;
  position: sticky;
  top: 18px;
  align-self: start;
  padding: 16px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.55);
}

.handbook-toc-head,
.handbook-content-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
}

.handbook-toc-count {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
}

.handbook-toc-list {
  display: grid;
  gap: 4px;
}

.handbook-toc-group {
  display: grid;
  gap: 4px;
}

.handbook-toc-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
  align-items: start;
}

.handbook-toc-item {
  appearance: none;
  width: 100%;
  border: 1px solid transparent;
  border-radius: 14px;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  padding: 10px 12px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  transition:
    background 0.16s ease,
    border-color 0.16s ease,
    transform 0.16s ease;
}

.handbook-toc-item:hover {
  background: rgba(23, 107, 99, 0.06);
  transform: translateX(2px);
}

.handbook-toc-item.is-active {
  background: rgba(23, 107, 99, 0.1);
  border-color: rgba(23, 107, 99, 0.18);
}

.handbook-toc-item-count {
  flex: 0 0 auto;
  min-width: 24px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(23, 107, 99, 0.08);
  color: var(--accent);
  font-size: 0.74rem;
  font-weight: 800;
  text-align: center;
}

.handbook-toc-disclosure {
  appearance: none;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.6);
  color: var(--muted);
  cursor: pointer;
  min-width: 34px;
  min-height: 34px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition:
    background 0.16s ease,
    border-color 0.16s ease,
    transform 0.16s ease,
    color 0.16s ease;
}

.handbook-toc-disclosure:hover {
  border-color: rgba(23, 107, 99, 0.22);
  color: var(--accent);
  transform: translateY(-1px);
}

.handbook-toc-group.is-open .handbook-toc-disclosure span {
  transform: rotate(180deg);
}

.handbook-toc-disclosure span {
  display: inline-block;
  line-height: 1;
  transition: transform 0.16s ease;
}

.handbook-toc-children {
  display: grid;
  gap: 4px;
  padding-left: 14px;
  border-left: 1px solid rgba(23, 107, 99, 0.12);
  margin-left: 12px;
}

.handbook-toc-child {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 8px 10px;
  text-align: left;
  display: flex;
  align-items: start;
  gap: 8px;
  font: inherit;
  transition:
    background 0.16s ease,
    border-color 0.16s ease,
    color 0.16s ease,
    transform 0.16s ease;
}

.handbook-toc-child:hover {
  background: rgba(23, 107, 99, 0.05);
  color: var(--text);
  transform: translateX(2px);
}

.handbook-toc-child.is-active {
  background: rgba(23, 107, 99, 0.08);
  border-color: rgba(23, 107, 99, 0.14);
  color: var(--accent);
}

.handbook-toc-child-title {
  font-size: 0.92rem;
  line-height: 1.45;
}

.handbook-toc-title {
  min-width: 0;
  font-weight: 800;
  line-height: 1.35;
}

.workspace-card {
  display: grid;
  gap: 8px;
  min-height: 148px;
}

.workspace-card strong {
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.2rem;
}

.workspace-card small {
  color: var(--muted);
  line-height: 1.5;
}

.workspace-card-wide {
  grid-column: 1 / -1;
}

.handbook-content-card {
  display: grid;
  gap: 10px;
  min-height: 640px;
  padding: 18px;
}

.handbook-content {
  display: grid;
  gap: 10px;
  align-content: start;
  max-width: 100%;
}

.handbook-content > :first-child {
  margin-top: 0 !important;
}

.handbook-content > hr:first-child {
  margin-top: 0;
}

.handbook-content h1,
.handbook-content h2,
.handbook-content h3,
.handbook-content h4 {
  margin: 0;
  scroll-margin-top: 24px;
}

.handbook-content h1 {
  font-size: 2rem;
}

.handbook-content h2 {
  font-size: 1.45rem;
}

.handbook-content h3 {
  font-size: 1.2rem;
}

.handbook-content p,
.handbook-content li,
.handbook-content blockquote {
  margin: 0;
  color: var(--text);
  line-height: 1.7;
}

.handbook-content ul,
.handbook-content ol {
  margin: 0;
  padding-left: 20px;
  display: grid;
  gap: 8px;
}

.handbook-content blockquote {
  padding: 14px 16px;
  border-left: 3px solid rgba(23, 107, 99, 0.25);
  background: rgba(23, 107, 99, 0.06);
  border-radius: 0 14px 14px 0;
}

.handbook-content pre {
  margin: 0;
  padding: 16px;
  overflow: auto;
  border-radius: 16px;
  background: #17120d;
  color: #f7efe3;
}

.handbook-content code {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.95em;
}

.handbook-content .notion-columns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
  gap: 14px;
}

.handbook-content .notion-column {
  display: grid;
  gap: 14px;
}

.handbook-content .notion-callout {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 16px;
  border-radius: 18px;
  border: 1px solid rgba(23, 107, 99, 0.16);
  background: var(--accent-soft);
}

.handbook-content .notion-callout-icon {
  font-size: 1.1rem;
  line-height: 1.2;
  flex: 0 0 auto;
}

.handbook-content .notion-callout-body {
  display: grid;
  gap: 10px;
  flex: 1;
}

.handbook-content .notion-callout-body ul,
.handbook-content .notion-callout-body ol {
  margin: 0;
}

.handbook-content .notion-toggle {
  padding: 16px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.5);
}

.handbook-content .notion-toggle summary {
  cursor: pointer;
  list-style: none;
  font-family: "Space Grotesk", sans-serif;
  font-weight: 800;
}

.handbook-content .notion-toggle summary::-webkit-details-marker {
  display: none;
}

.handbook-content .notion-toggle-body {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.handbook-content .notion-list-children {
  display: grid;
  gap: 10px;
  margin-top: 10px;
  padding-left: 16px;
  border-left: 1px solid rgba(23, 107, 99, 0.14);
}

.handbook-content .notion-table-wrap {
  overflow: auto;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.5);
}

.handbook-content .notion-table {
  width: 100%;
  border-collapse: collapse;
}

.handbook-content .notion-table th,
.handbook-content .notion-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.handbook-content .notion-table th {
  background: rgba(23, 107, 99, 0.08);
  font-weight: 800;
}

.handbook-content .notion-table tr:last-child th,
.handbook-content .notion-table tr:last-child td {
  border-bottom: 0;
}

.handbook-content .notion-divider {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 4px 0;
}

.handbook-content .notion-todo {
  display: grid;
  gap: 8px;
}

.handbook-content .notion-todo label {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.handbook-content .notion-media img {
  display: block;
  max-width: 100%;
  border-radius: 16px;
}

.handbook-content .notion-bookmark,
.handbook-content .notion-embed {
  display: inline-flex;
  align-items: center;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.58);
  color: var(--text);
  text-decoration: none;
  overflow-wrap: anywhere;
}

.handbook-content .notion-bookmark:hover,
.handbook-content .notion-embed:hover {
  border-color: rgba(23, 107, 99, 0.22);
}

.handbook-content-head h4 {
  margin-top: 6px;
  font-size: 1.15rem;
}

.handbook-content-meta {
  display: grid;
  justify-items: end;
  gap: 6px;
}

.handbook-content-meta small {
  color: var(--muted);
  font-size: 0.82rem;
}

.handbook-notice {
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(168, 102, 24, 0.16);
  background: rgba(168, 102, 24, 0.08);
  color: #6e4310;
  font-size: 0.92rem;
  line-height: 1.5;
}

.handbook-content-card .canvas-placeholder {
  min-height: 220px;
}

.team-directory-card {
  min-height: 0;
}

.team-directory-shell {
  display: grid;
  gap: 14px;
}

.team-directory-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.team-directory-summary-card {
  display: grid;
  gap: 8px;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid rgba(23, 107, 99, 0.14);
  background: rgba(255, 255, 255, 0.48);
}

.team-directory-summary-card strong {
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.35rem;
  color: var(--text);
}

.team-directory-table-wrap {
  overflow: auto;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.52);
}

.team-directory-table {
  width: 100%;
  min-width: 1040px;
  border-collapse: collapse;
}

.team-directory-table th,
.team-directory-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.team-directory-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: rgba(23, 107, 99, 0.08);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.team-directory-table tr:last-child td {
  border-bottom: 0;
}

.team-directory-nowrap {
  white-space: nowrap;
}

.team-directory-person {
  display: grid;
  gap: 4px;
}

.team-directory-person strong {
  font-family: "Space Grotesk", sans-serif;
  font-size: 1rem;
}

.team-directory-contact {
  display: grid;
  gap: 6px;
}

.team-directory-contact span,
.team-directory-contact a {
  color: var(--accent);
  font-weight: 700;
  white-space: nowrap;
}

.team-directory-contact a {
  text-decoration: none;
}

.team-directory-contact a:hover {
  text-decoration: underline;
}

.section-list {
  margin: 0;
  padding-left: 20px;
  color: var(--text);
  display: grid;
  gap: 8px;
  line-height: 1.5;
  font-weight: 600;
}

.canvas-placeholder {
  display: grid;
  gap: 10px;
  min-height: 180px;
  padding: 18px;
  border-radius: 18px;
  border: 1px dashed rgba(23, 107, 99, 0.18);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.5), rgba(255, 255, 255, 0.2)),
    rgba(23, 107, 99, 0.05);
}

.canvas-placeholder p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.source-card,
.state-card {
  padding: 18px;
}

.source-card-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
}

.source-card h3 {
  margin-top: 2px;
  font-size: 1.2rem;
}

.source-details {
  margin: 18px 0 0;
  display: grid;
  gap: 10px;
}

.source-details div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.source-details dt {
  font-size: 0.74rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 800;
}

.source-details dd {
  margin: 0;
  font-weight: 700;
  text-align: right;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 10px;
  border-radius: 999px;
  border: 1px solid transparent;
  font-size: 0.78rem;
  font-weight: 800;
  white-space: nowrap;
}

.status-badge.is-open {
  background: rgba(255, 255, 255, 0.76);
  border-color: var(--line);
  color: var(--warn);
}

.status-badge.is-approved {
  background: rgba(34, 106, 73, 0.12);
  border-color: rgba(34, 106, 73, 0.16);
  color: var(--ok);
}

.status-badge.is-warn {
  background: rgba(168, 102, 24, 0.12);
  border-color: rgba(168, 102, 24, 0.16);
  color: var(--warn);
}

.btn {
  appearance: none;
  border: 1px solid transparent;
  border-radius: 13px;
  cursor: pointer;
  font: inherit;
  font-weight: 800;
  padding: 10px 14px;
  transition:
    background 0.16s ease,
    border-color 0.16s ease,
    transform 0.16s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.7);
  border-color: var(--line);
  color: var(--text);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.9);
}

@media (max-width: 920px) {
  .hero,
  .panel-head {
    flex-direction: column;
    align-items: start;
  }

  .hero-meta {
    align-items: start;
  }

  .source-grid,
  .source-workspace-grid,
  .handbook-reader {
    grid-template-columns: 1fr;
  }

  .source-workspace-head {
    flex-direction: column;
  }

  .handbook-toc {
    position: static;
  }

  .team-directory-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hero-refresh-meta {
    text-align: left;
    min-width: 0;
  }
}

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

  .hero,
  .source-panel {
    padding: 20px;
  }

  .team-directory-summary {
    grid-template-columns: 1fr;
  }
}
