:root {
  --bg-black: #000000;
  --bg-card: #09090b;
  --bg-surface: #121215;
  --bg-hover: #1c1c22;
  --border-subtle: #1c1c20;
  --border-strong: #27272a;
  --text-main: #f4f4f5;
  --text-muted: #a1a1aa;
  --text-dim: #71717a;
  --accent-blue: #38bdf8;
  --accent-green: #34d399;
  --nav-height: 56px;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Inter", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "JetBrains Mono", Consolas, monospace;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background-color: var(--bg-black);
  color: var(--text-main);
  font-family: var(--font-sans);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
  text-decoration: none;
}

/* Top Navigator */
.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  height: var(--nav-height);
  background-color: rgba(9, 9, 11, 0.94);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-subtle);
}

.nav-container {
  max-width: 1440px;
  height: 100%;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 28px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.01em;
  white-space: nowrap;
  color: var(--text-main);
}

.brand-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent-blue);
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.6);
}

.nav-toggle {
  display: none;
  margin-left: auto;
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  color: var(--text-main);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 14px;
  cursor: pointer;
}

.nav-menu {
  display: flex;
  align-items: center;
  list-style: none;
  margin: 0;
  padding: 0;
  gap: 4px;
}

.nav-item {
  position: relative;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  transition: color 0.15s ease, background-color 0.15s ease;
  white-space: nowrap;
}

.nav-link:hover,
.nav-link.active,
.nav-item:hover > .nav-link,
.nav-item:focus-within > .nav-link {
  color: var(--text-main);
  background-color: var(--bg-surface);
}

.nav-link.active {
  color: var(--accent-blue);
}

.caret {
  font-size: 10px;
  opacity: 0.7;
  transition: transform 0.15s ease;
}

/* Multilevel Dropdown (Desktop) */
.dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 220px;
  padding: 6px;
  margin: 0;
  list-style: none;
  background-color: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.75);
  opacity: 0;
  visibility: hidden;
  transform: translateY(4px);
  transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
  z-index: 1010;
}

.nav-item:hover > .dropdown,
.nav-item:focus-within > .dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dropdown-item {
  position: relative;
}

.dropdown-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 13.5px;
  color: var(--text-muted);
  transition: background-color 0.12s ease, color 0.12s ease;
}

.dropdown-link:hover,
.dropdown-item:hover > .dropdown-link,
.dropdown-item:focus-within > .dropdown-link {
  background-color: var(--bg-hover);
  color: var(--text-main);
}

.dropdown-link .label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 240px;
}

.dropdown-link .badge {
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-dim);
  flex-shrink: 0;
}

.dropdown .dropdown {
  top: -6px;
  left: 100%;
  min-width: 240px;
}

.dropdown-reports {
  min-width: 280px;
  max-width: 360px;
  max-height: 65vh;
  overflow-y: auto;
}

.dropdown-item:hover > .dropdown,
.dropdown-item:focus-within > .dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dropdown-divider {
  height: 1px;
  background-color: var(--border-subtle);
  margin: 4px 6px;
}

.dropdown-footer-link {
  color: var(--accent-blue);
  font-weight: 500;
}

/* Main Layout */
.main-content {
  max-width: 1280px;
  margin: 0 auto;
  padding: 32px 20px 64px;
}

.page-header {
  margin-bottom: 28px;
}

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 12px;
}

.breadcrumb a:hover {
  color: var(--accent-blue);
}

.page-title {
  margin: 0 0 8px;
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.page-subtitle {
  margin: 0;
  color: var(--text-muted);
  font-size: 15px;
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.stat-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 18px 20px;
}

.stat-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
  margin-bottom: 6px;
}

.stat-value {
  font-size: 26px;
  font-weight: 600;
  font-family: var(--font-mono);
  color: var(--text-main);
}

/* Sections & Cards */
.section {
  margin-bottom: 36px;
}

.section-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-main);
  margin: 0 0 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.folder-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}

.folder-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 18px 20px;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.folder-card:hover {
  border-color: var(--accent-blue);
  background-color: var(--bg-surface);
}

.folder-name {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 6px;
  word-break: break-word;
}

.folder-meta {
  font-size: 13px;
  color: var(--text-muted);
}

/* Report List */
.report-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.report-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 16px 20px;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.report-row:hover {
  border-color: var(--accent-blue);
  background-color: var(--bg-surface);
}

.report-info {
  min-width: 0;
  flex: 1;
}

.report-title {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-main);
  margin-bottom: 4px;
  word-break: break-word;
}

.report-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 12.5px;
  color: var(--text-dim);
  font-family: var(--font-mono);
}

.report-action {
  flex-shrink: 0;
  font-size: 13px;
  font-weight: 500;
  color: var(--accent-blue);
  padding: 6px 12px;
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: 6px;
}

/* Report Viewer (Iframe) */
.viewer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 20px;
  background-color: var(--bg-card);
  border-bottom: 1px solid var(--border-subtle);
  font-size: 13px;
}

.viewer-bar .breadcrumb {
  margin: 0;
}

.viewer-raw-link {
  color: var(--accent-blue);
  font-size: 12.5px;
  white-space: nowrap;
  padding: 4px 10px;
  border: 1px solid var(--border-strong);
  border-radius: 6px;
}

.viewer-raw-link:hover {
  border-color: var(--accent-blue);
}

.report-frame {
  display: block;
  width: 100%;
  height: calc(100vh - var(--nav-height) - 41px);
  border: none;
  background-color: var(--bg-black);
}

/* About / Prose */
.prose-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 28px 32px;
  max-width: 820px;
}

.prose-card h2 {
  margin-top: 24px;
  margin-bottom: 10px;
  font-size: 18px;
}

.prose-card p, .prose-card li {
  color: var(--text-muted);
  font-size: 15px;
}

.prose-card code {
  font-family: var(--font-mono);
  font-size: 13px;
  background: var(--bg-surface);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--accent-blue);
}

/* Mobile Responsive */
@media (max-width: 860px) {
  .nav-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
  }

  .nav-menu {
    display: none;
    position: absolute;
    top: var(--nav-height);
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    background-color: var(--bg-card);
    border-bottom: 1px solid var(--border-strong);
    padding: 12px 16px 20px;
    max-height: calc(100vh - var(--nav-height));
    overflow-y: auto;
  }

  .nav-menu.open {
    display: flex;
  }

  .nav-link {
    justify-content: space-between;
    width: 100%;
  }

  .dropdown,
  .dropdown .dropdown {
    position: static;
    opacity: 1;
    visibility: visible;
    transform: none;
    box-shadow: none;
    border: none;
    border-left: 1px solid var(--border-strong);
    border-radius: 0;
    margin-left: 12px;
    padding: 2px 0 2px 10px;
    min-width: 0;
    max-width: none;
    max-height: none;
    display: none;
  }

  .nav-item.submenu-open > .dropdown,
  .dropdown-item.submenu-open > .dropdown {
    display: block;
  }

  .report-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .viewer-bar {
    flex-direction: column;
    align-items: flex-start;
  }
}
