header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--paper);
  border-bottom: 4px solid var(--sage);
  gap: var(--space-md);
}
header .brand {
  min-width: 0;
}
header .brand strong {
  color: var(--ink);
  font-size: 1.25rem;
  font-family: var(--font-display);
  white-space: nowrap;
}
#themeSwitcher {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  flex-shrink: 0;
}
#themeSwitcher a {
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 8px 10px;
  color: var(--ink);
  border: 1px solid var(--line);
  text-decoration: none;
  border-radius: 4px;
  font-size: 13px;
  white-space: nowrap;
}
#themeSwitcher a:hover {
  background: var(--surface-raised);
}
#themeSwitcher a[aria-current] {
  border-color: var(--sage);
  background: var(--surface);
  font-weight: 700;
}
.theme-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--theme-dot);
  flex-shrink: 0;
}
[data-theme-link="sleep"] {
  --theme-dot: var(--theme-sleep-dot);
}
[data-theme-link="sajima"] {
  --theme-dot: var(--theme-sajima-dot);
}
[data-theme-link="betherich"] {
  --theme-dot: var(--theme-tv-dot);
}
[data-theme="sajima"] .eyebrow {
  background: var(--sage);
  color: var(--dark-ink);
  padding: 4px 10px;
  width: fit-content;
  font-weight: 700;
}
[data-theme="sajima"] .download,
[data-theme="sajima"] button {
  font-weight: 700;
}
[data-theme="sajima"] .auth-scene,
[data-theme="betherich"] .auth-scene {
  display: none;
}
[data-theme="sajima"] .auth-screen,
[data-theme="betherich"] .auth-screen {
  grid-template-columns: 1fr;
}
.theme-hub {
  max-width: 1440px;
  margin: auto;
  padding: 64px 40px;
}
.theme-hub h1 {
  font-size: 2.75rem;
  margin: 16px 0;
}
.theme-hub > p {
  margin-bottom: 24px;
}
.hub-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
}
.hub-cards article {
  background: var(--paper);
  color: var(--ink);
  border-top: 4px solid var(--sage);
  padding: 32px 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  min-width: 0;
}
.hub-cards p {
  color: var(--muted);
  line-height: 1.9;
  font-size: 0.9rem;
}
.hub-cards .download {
  margin-top: auto;
}
.analytics-heading {
  display: flex;
  gap: 24px;
  justify-content: space-between;
  align-items: start;
  margin-bottom: 24px;
}
.analytics-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
  margin: 32px 0;
}
.analytics-metrics article {
  border-bottom: 1px solid var(--line);
  padding-bottom: 24px;
}
.analytics-metrics strong {
  display: block;
  font-size: 2rem;
  font-variant-numeric: tabular-nums;
  color: var(--sage);
  margin: 8px 0;
}
.analytics-chart {
  width: 100%;
  height: auto;
  max-height: 240px;
  background: var(--surface);
  margin: 24px 0;
}
.analytics-chart polyline {
  stroke: var(--sage);
  fill: none;
  stroke-width: 2;
}
.analytics-chart text {
  fill: var(--muted);
  font-size: 12px;
}
.analytics-video-list {
  display: grid;
  gap: 24px;
  margin-top: 24px;
}
.analytics-video {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line);
}
.analytics-video img {
  width: 180px;
  height: 101px;
  object-fit: cover;
}
.analytics-video h3 {
  margin-bottom: 10px;
  line-height: 1.5;
}
.analytics-video p {
  margin-block: 8px;
}
.analytics-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin: 24px 0;
}
.analytics-filters label {
  flex: 1;
  min-width: 120px;
}
.analytics-table-wrap {
  overflow-x: auto;
  max-width: 100%;
}
.analytics-table {
  min-width: 1060px;
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}
.analytics-table th,
.analytics-table td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}
.analytics-table td:nth-child(2) {
  min-width: 240px;
  max-width: 360px;
  white-space: normal;
}
.analytics-table tbody tr {
  content-visibility: auto;
  contain-intrinsic-size: auto 70px;
}
.analytics-warning {
  border-left: 3px solid var(--brand-red, var(--error));
  padding: 16px;
  margin-block: 16px;
  background: var(--surface);
}
.analytics-status {
  padding: 16px;
  border: 1px solid var(--line);
  margin: 24px 0;
}
.analytics-rule-form textarea {
  width: 100%;
  min-height: 280px;
  font-family: monospace;
}
@media (max-width: 900px) {
  .hub-cards {
    grid-template-columns: 1fr;
  }
  header {
    flex-wrap: wrap;
  }
  #themeSwitcher {
    order: 3;
    width: 100%;
    justify-content: center;
  }
  .theme-hub {
    padding: 40px 24px;
  }
}
@media (max-width: 480px) {
  header {
    padding: 8px 12px;
  }
  #themeSwitcher {
    gap: 4px;
  }
  #themeSwitcher a {
    padding: 8px;
    font-size: 12px;
  }
  #environment {
    display: none;
  }
  .analytics-heading {
    flex-direction: column;
  }
  .analytics-metrics {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .analytics-video {
    grid-template-columns: 1fr;
  }
  .analytics-video img {
    width: 100%;
    height: auto;
  }
  .theme-hub h1 {
    font-size: 2rem;
  }
}

body[data-screen="login"] header {
  display: flex;
}

[data-theme="sajima"] a {
  color: var(--link-ink);
}
[data-theme="sajima"] a.download {
  color: var(--dark-ink);
}
[data-theme="sajima"] #themeSwitcher a {
  color: var(--ink);
}

html { scroll-padding-top:140px; }
@media(max-width:900px) { html { scroll-padding-top:180px; } }
