:root {
  color-scheme: dark;
  --bg: #101411;
  --bg-soft: #19211d;
  --panel: rgba(245, 250, 247, 0.11);
  --panel-strong: rgba(255, 255, 255, 0.17);
  --line: rgba(255, 255, 255, 0.18);
  --text: #f4fbf6;
  --muted: #afbab3;
  --soft: #d9e4dd;
  --green: #70e08f;
  --cyan: #72d7df;
  --red: #ff7373;
  --yellow: #f3d36b;
  --ink: #0c0f0d;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.32);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  margin: 0;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 12% 4%, rgba(112, 224, 143, 0.2), transparent 30rem),
    radial-gradient(circle at 82% 12%, rgba(114, 215, 223, 0.18), transparent 28rem),
    linear-gradient(135deg, #0d120f 0%, #17211b 48%, #101415 100%);
}

body.locked {
  min-height: 100vh;
  overflow: hidden;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  content: "";
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: linear-gradient(to bottom, #000, transparent 82%);
}

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

button {
  font: inherit;
}

[hidden] {
  display: none !important;
}

.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 20px;
  background: rgba(5, 8, 6, 0.72);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

.login-card {
  display: grid;
  width: min(100%, 430px);
  gap: 14px;
  padding: 24px;
  border-radius: 8px;
}

.login-brand {
  margin-bottom: 12px;
}

.login-title {
  font-size: clamp(2rem, 8vw, 3.4rem);
}

.login-text {
  margin: 12px 0 8px;
  color: var(--soft);
  line-height: 1.6;
}

.field-label {
  color: var(--soft);
  font-size: 0.88rem;
  font-weight: 800;
}

.login-input {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: 0;
  color: var(--text);
  font: inherit;
  background: rgba(255, 255, 255, 0.08);
}

.login-input:focus {
  border-color: rgba(112, 224, 143, 0.72);
  box-shadow: 0 0 0 3px rgba(112, 224, 143, 0.14);
}

.login-error {
  min-height: 22px;
  margin: 0;
  color: var(--red);
  font-size: 0.88rem;
}

.login-button {
  min-height: 50px;
  border: 0;
  border-radius: 8px;
  color: var(--ink);
  font-weight: 800;
  cursor: pointer;
  background: linear-gradient(135deg, var(--green), var(--cyan));
}

.site-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 20px 0 48px;
}

.glass-panel {
  border: 1px solid var(--line);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.07));
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(22px) saturate(145%);
  -webkit-backdrop-filter: blur(22px) saturate(145%);
}

.topbar {
  position: sticky;
  top: 16px;
  z-index: 10;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 18px;
  align-items: center;
  min-height: 72px;
  padding: 12px;
  border-radius: 8px;
}

.brand,
.sync-button,
.primary-action,
.secondary-action,
.tiny-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
}

.brand {
  justify-content: flex-start;
  gap: 12px;
}

.brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 8px;
  color: var(--ink);
  font-weight: 800;
  background: linear-gradient(135deg, var(--green), var(--cyan));
}

.brand strong,
.brand small {
  display: block;
}

.brand small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.76rem;
}

.nav-links {
  display: flex;
  gap: 6px;
  padding: 6px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
}

.nav-links a {
  padding: 10px 13px;
  border-radius: 8px;
  color: var(--soft);
  font-size: 0.9rem;
  transition: background 160ms ease, color 160ms ease;
}

.nav-links a:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.1);
}

.sync-button {
  justify-self: end;
  gap: 9px;
  min-height: 44px;
  padding: 0 16px;
  border: 0;
  color: var(--ink);
  font-weight: 700;
  cursor: pointer;
  background: var(--text);
}

.pulse-dot {
  width: 9px;
  height: 9px;
  border-radius: 99px;
  background: var(--green);
  box-shadow: 0 0 0 0 rgba(112, 224, 143, 0.7);
  animation: pulse 1.8s infinite;
}

.hero-section {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(330px, 0.92fr);
  gap: 24px;
  align-items: stretch;
  min-height: 430px;
  padding: 70px 0 28px;
}

.hero-copy {
  align-self: center;
}

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

h1,
h2,
p {
  overflow-wrap: anywhere;
}

h1 {
  max-width: 780px;
  margin: 0;
  font-size: clamp(2.45rem, 6vw, 5.5rem);
  line-height: 0.94;
  letter-spacing: 0;
}

h2 {
  margin: 0;
  font-size: clamp(1.25rem, 2vw, 1.65rem);
  letter-spacing: 0;
}

.hero-text {
  max-width: 580px;
  margin: 22px 0 0;
  color: var(--soft);
  font-size: 1.05rem;
  line-height: 1.75;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 28px;
}

.primary-action,
.secondary-action {
  min-height: 48px;
  padding: 0 18px;
  font-weight: 800;
}

.primary-action {
  color: var(--ink);
  background: linear-gradient(135deg, var(--green), var(--cyan));
}

.secondary-action {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.08);
}

.hero-visual {
  position: relative;
  min-height: 360px;
  overflow: hidden;
  border-radius: 8px;
}

.visual-image {
  width: 100%;
  height: 100%;
  min-height: 360px;
  object-fit: cover;
  filter: saturate(0.8) contrast(1.05) brightness(0.72);
}

.visual-overlay {
  position: absolute;
  right: 18px;
  bottom: 18px;
  width: min(230px, calc(100% - 36px));
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(10, 14, 12, 0.58);
  backdrop-filter: blur(18px);
}

.visual-overlay span,
.visual-overlay small {
  display: block;
  color: var(--muted);
}

.visual-overlay strong {
  display: block;
  margin: 6px 0;
  font-size: 3rem;
}

.metric-grid,
.dashboard-grid,
.insight-grid {
  display: grid;
  gap: 16px;
}

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

.metric-card,
.sources-panel,
.chart-panel,
.genre-panel,
.quality-panel {
  border-radius: 8px;
}

.metric-card {
  min-height: 150px;
  padding: 20px;
}

.metric-label,
.metric-note {
  display: block;
  color: var(--muted);
  font-size: 0.88rem;
}

.metric-value {
  display: block;
  margin: 16px 0 10px;
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1;
}

.positive {
  color: var(--green);
}

.dashboard-grid {
  grid-template-columns: minmax(0, 1.08fr) minmax(320px, 0.92fr);
  margin-top: 16px;
}

.insight-grid {
  grid-template-columns: minmax(0, 1.22fr) minmax(300px, 0.78fr);
  margin-top: 16px;
}

.sources-panel,
.chart-panel,
.genre-panel,
.quality-panel {
  padding: 22px;
}

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

.badge,
.tiny-button {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 0 11px;
  border: 1px solid var(--line);
  color: var(--soft);
  font-size: 0.82rem;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.08);
}

.tiny-button {
  cursor: pointer;
}

.source-list,
.genre-list,
.legend {
  display: grid;
  gap: 10px;
}

.source-row,
.genre-row {
  display: grid;
  gap: 14px;
  align-items: center;
  min-height: 72px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
}

.source-row {
  grid-template-columns: 1fr auto;
}

.source-name,
.genre-name {
  display: flex;
  gap: 10px;
  align-items: center;
  font-weight: 800;
}

.status-dot {
  width: 10px;
  height: 10px;
  flex: 0 0 auto;
  border-radius: 99px;
}

.source-meta,
.genre-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 7px;
  color: var(--muted);
  font-size: 0.83rem;
}

.source-score {
  min-width: 84px;
  text-align: right;
}

.source-score strong {
  display: block;
  font-size: 1.25rem;
}

.source-score span {
  color: var(--muted);
  font-size: 0.78rem;
}

.bar-chart {
  display: grid;
  grid-template-columns: repeat(7, minmax(34px, 1fr));
  gap: 10px;
  align-items: end;
  min-height: 310px;
  padding-top: 16px;
}

.bar-item {
  display: grid;
  gap: 10px;
  align-items: end;
  height: 100%;
}

.bar-track {
  position: relative;
  height: 245px;
  overflow: hidden;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.07);
}

.bar-fill {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  min-height: 14px;
  border-radius: 8px 8px 0 0;
  background: linear-gradient(180deg, var(--cyan), var(--green));
}

.bar-value,
.bar-label {
  display: block;
  text-align: center;
}

.bar-value {
  color: var(--soft);
  font-size: 0.78rem;
  font-weight: 800;
}

.bar-label {
  color: var(--muted);
  font-size: 0.8rem;
}

.genre-row {
  grid-template-columns: minmax(0, 1fr) minmax(120px, 32%);
}

.progress-track {
  height: 10px;
  overflow: hidden;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.09);
}

.progress-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green), var(--cyan));
}

.donut-wrap {
  position: relative;
  display: grid;
  width: min(280px, 78vw);
  aspect-ratio: 1;
  place-items: center;
  margin: 20px auto 26px;
}

.donut {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: conic-gradient(var(--green) 0deg, var(--cyan) 0deg);
  box-shadow: inset 0 0 34px rgba(0, 0, 0, 0.25);
}

.donut::after {
  position: absolute;
  inset: 16%;
  content: "";
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(16, 20, 17, 0.82);
  backdrop-filter: blur(12px);
}

.donut-center {
  position: absolute;
  display: grid;
  place-items: center;
}

.donut-center strong {
  font-size: 2.5rem;
}

.donut-center span {
  color: var(--muted);
  font-weight: 800;
}

.legend-item {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  color: var(--soft);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.legend-label {
  display: inline-flex;
  gap: 9px;
  align-items: center;
}

.legend-swatch {
  width: 11px;
  height: 11px;
  border-radius: 3px;
}

@keyframes pulse {
  70% {
    box-shadow: 0 0 0 12px rgba(112, 224, 143, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(112, 224, 143, 0);
  }
}

@media (max-width: 920px) {
  .topbar {
    grid-template-columns: 1fr auto;
  }

  .nav-links {
    display: none;
  }

  .hero-section,
  .dashboard-grid,
  .insight-grid {
    grid-template-columns: 1fr;
  }

  .hero-section {
    padding-top: 48px;
  }

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

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

  .topbar {
    top: 10px;
    min-height: 64px;
  }

  .brand small {
    display: none;
  }

  .sync-button {
    min-height: 40px;
    padding: 0 12px;
  }

  .hero-section {
    min-height: 0;
    padding: 38px 0 18px;
  }

  .hero-text {
    font-size: 0.98rem;
  }

  .hero-visual,
  .visual-image {
    min-height: 270px;
  }

  .metric-grid {
    grid-template-columns: 1fr;
  }

  .section-heading,
  .source-row,
  .genre-row {
    grid-template-columns: 1fr;
  }

  .source-row,
  .genre-row {
    align-items: start;
  }

  .source-score {
    text-align: left;
  }

  .bar-chart {
    gap: 6px;
    min-height: 250px;
  }

  .bar-track {
    height: 190px;
  }
}
