:root {
  color-scheme: light;
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 16px;
  line-height: 1.5;
  background-color: #0b1120;
  color: #0f172a;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 12% 20%, rgba(99, 102, 241, 0.24), transparent 45%),
    radial-gradient(circle at 80% 0%, rgba(14, 116, 144, 0.22), transparent 40%),
    #0b1120;
  color: inherit;
}

#app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
}

.access-screen {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: clamp(3rem, 6vw, 6rem) clamp(1.5rem, 4vw, 5rem);
  background: #ffffff;
  color: #0b1120;
}

.access-content {
  max-width: 420px;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.75rem;
  text-align: center;
}

.access-content .intro {
  color: #334155;
}

.access-content h1 {
  color: #0f172a;
}

.logo {
  width: 180px;
  max-width: 75%;
}

.intro {
  color: rgba(226, 232, 240, 0.7);
  max-width: 32ch;
  margin: 0;
}

#access-form {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

#report-code {
  padding: 0.95rem 1.1rem;
  border: 1px solid rgba(148, 163, 184, 0.35);
  border-radius: 12px;
  font-size: 1rem;
  font-family: inherit;
  background: rgba(15, 23, 42, 0.05);
  color: #0f172a;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

#report-code::placeholder {
  color: rgba(100, 116, 139, 0.6);
  letter-spacing: normal;
  text-transform: none;
}

#report-code:focus {
  outline: none;
  border-color: rgba(129, 140, 248, 0.9);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.2);
  background: rgba(99, 102, 241, 0.05);
}

#access-button {
  padding: 0.95rem 1.1rem;
  border: none;
  border-radius: 12px;
  font-weight: 600;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease;
}

#access-button:hover,
#access-button:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 18px 40px rgba(99, 102, 241, 0.38);
}

#access-button:disabled {
  opacity: 0.7;
  cursor: wait;
}

#access-error {
  min-height: 1.25em;
  font-size: 0.95rem;
  color: #fca5a5;
  margin: 0;
}

.hidden {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.viewer {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(260px, 310px) 1fr;
  height: 100vh;
  max-height: 100vh;
  min-height: 0;
  background: #f8fafc;
  color: #1f2937;
}

#toc-panel {
  background: #0f172a;
  color: #e2e8f0;
  display: flex;
  flex-direction: column;
  padding: 2.75rem 2.25rem;
  gap: 1.5rem;
  min-width: 0;
  height: 100%;
  max-height: 100vh;
  overflow: hidden;
}

.toc-body {
  display: flex;
  flex-direction: column;
  gap: 1.75rem;
  flex: 1;
  min-height: 0;
}

.toc-header {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.toc-eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.35em;
  font-size: 0.68rem;
  color: rgba(148, 163, 184, 0.7);
}

#toc-scroll {
  flex: 1;
  overflow-y: auto;
  margin: 0;
  padding-right: 0.5rem;
  min-height: 0;
}

#toc-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

#toc-list a {
  color: inherit;
  text-decoration: none;
  font-size: 0.95rem;
  display: inline-flex;
  gap: 0.5rem;
  align-items: center;
  opacity: 0.85;
  transition: opacity 120ms ease, transform 120ms ease;
}

#toc-list a:hover,
#toc-list a:focus-visible {
  opacity: 1;
  transform: translateX(2px);
}

#toc-list .toc-depth-2 {
  padding-left: 1rem;
  font-size: 0.9rem;
  opacity: 0.75;
}

#toc-list .toc-depth-3 {
  padding-left: 2rem;
  font-size: 0.85rem;
  opacity: 0.7;
}

#toc-branding {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  align-items: center;
  padding-top: 1.5rem;
  margin-top: auto;
}

#report-meta-container {
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  color: rgba(226, 232, 240, 0.7);
}

#report-meta-container p {
  margin: 0;
  font-size: 0.9rem;
}

.branding-label {
  font-size: 0.72rem;
  letter-spacing: 0.42em;
  text-transform: uppercase;
  color: rgba(226, 232, 240, 0.55);
}

.branding-logo-wrap {
  width: 100%;
  min-height: 56px;
  border-radius: 14px;
  background: rgba(99, 102, 241, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem;
}

#branding-logo {
  max-width: 100%;
  max-height: 56px;
  object-fit: contain;
  filter: drop-shadow(0 10px 18px rgba(15, 23, 42, 0.3));
}

#report-content {
  height: 100%;
  max-height: 100vh;
  overflow-y: auto;
  padding: 3rem clamp(2rem, 3.5vw, 4.5rem);
  background: #ffffff;
  border-radius: 24px 0 0 24px;
  box-shadow: -12px 0 24px rgba(15, 23, 42, 0.08);
}

#report-content h1,
#report-content h2,
#report-content h3,
#report-content h4 {
  font-weight: 600;
  color: #0f172a;
  scroll-margin-top: 1.75rem;
}

#report-content h1 {
  font-size: clamp(2.1rem, 2.8vw, 2.8rem);
  margin-top: 0;
}

#report-content p {
  margin: 0 0 1rem;
}

#report-content pre {
  background: #0f172a;
  color: #e2e8f0;
  padding: 1rem 1.25rem;
  border-radius: 14px;
  overflow-x: auto;
  font-size: 0.9rem;
}

#report-content code {
  font-family: 'JetBrains Mono', 'Fira Code', SFMono-Regular, Consolas, 'Liberation Mono', monospace;
  background: rgba(15, 23, 42, 0.1);
  padding: 0.2rem 0.35rem;
  border-radius: 6px;
}

#report-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0;
  font-size: 0.95rem;
  overflow: hidden;
  border-radius: 14px;
  background: #ffffff;
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.05);
}

#report-content table thead {
  background: #1e1b4b;
  color: #f8fafc;
}

#report-content th,
#report-content td {
  padding: 0.85rem 1rem;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
  text-align: left;
}

#report-content tbody tr:nth-child(even) {
  background: rgba(15, 23, 42, 0.03);
}

.exit-button {
  position: fixed;
  bottom: clamp(1.5rem, 2vw, 2.25rem);
  right: clamp(1.5rem, 2vw, 2.5rem);
  padding: 0.75rem 1.4rem;
  border-radius: 999px;
  border: none;
  font-weight: 600;
  background: linear-gradient(135deg, #f97316, #fb7185);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 20px 40px rgba(249, 115, 22, 0.22);
  z-index: 50;
  transition: transform 140ms ease, box-shadow 140ms ease;
}

.exit-button:hover,
.exit-button:focus-visible {
  transform: translateY(-2px);
  box-shadow: 0 24px 48px rgba(249, 115, 22, 0.32);
}

dialog {
  border: none;
  border-radius: 18px;
  padding: 2.25rem;
  max-width: clamp(320px, 70vw, 460px);
  background: #ffffff;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.35);
}

dialog::backdrop {
  background: rgba(15, 23, 42, 0.6);
}

dialog h2 {
  margin-top: 0;
  font-size: 1.35rem;
}

dialog p {
  color: #334155;
}

dialog menu {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 1rem 0 0;
  margin: 0;
}

dialog button {
  padding: 0.6rem 1.1rem;
  border-radius: 8px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: box-shadow 120ms ease, transform 120ms ease;
}

.agreement-button {
  font-family: inherit;
}

.agreement-decline {
  background: transparent;
  color: #0f172a;
  border-color: rgba(15, 23, 42, 0.2);
}

.agreement-confirm {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
}

.agreement-confirm:hover,
.agreement-confirm:focus-visible {
  box-shadow: 0 10px 30px rgba(99, 102, 241, 0.3);
  transform: translateY(-1px);
}

.dialog-fallback {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  display: grid;
  place-items: center;
  z-index: 1000;
}

.dialog-fallback > form {
  background: #ffffff;
  border-radius: 18px;
  padding: 2.25rem;
  max-width: clamp(320px, 70vw, 460px);
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.35);
}

@media (max-width: 1100px) {
  .viewer {
    grid-template-columns: minmax(220px, 280px) 1fr;
  }
}

@media (max-width: 960px) {
  .viewer {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
    height: auto;
    max-height: none;
  }

  #toc-panel {
    flex-direction: column;
    padding: 2rem;
    height: auto;
    max-height: none;
    overflow: visible;
  }

  #report-content {
    border-radius: 0;
    box-shadow: none;
    padding: 2.5rem clamp(1.5rem, 4vw, 3rem);
    min-height: 60vh;
    max-height: none;
  }

  #toc-scroll {
    overflow: visible;
  }

  .exit-button {
    right: clamp(1.25rem, 4vw, 2rem);
  }
}

@media (max-width: 720px) {
  .access-content {
    gap: 1.4rem;
  }

  #report-code {
    letter-spacing: 0.05em;
  }

  #access-button {
    width: 100%;
  }

  #toc-panel {
    padding: 1.75rem 1.5rem;
  }

  .branding-logo-wrap {
    min-height: 48px;
  }

  .exit-button {
    bottom: 1.2rem;
    right: 1.2rem;
  }
}
