:root {
  color-scheme: dark;
  --bg: #020714;
  --bar: #071f48;
  --bar-2: #061733;
  --panel: #081b3b;
  --panel-2: #040b25;
  --card: #070b2b;
  --line: #125ca7;
  --line-soft: rgba(43, 150, 255, 0.34);
  --cyan: #55d8f2;
  --blue: #168bff;
  --ink: #f4fbff;
  --muted: #8bbce8;
  --ok: #2bddae;
  --warn: #ffd34e;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Arial, Helvetica, sans-serif;
  background: var(--bg);
  color: var(--ink);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: minmax(220px, 340px) 1fr auto;
  align-items: center;
  min-height: 58px;
  border-bottom: 1px solid #147bdb;
  background: var(--bar);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 58px;
  padding: 0 18px;
  color: var(--ink);
  text-decoration: none;
}

.brand small {
  color: #d9ebff;
  font-size: 13px;
}

.brand-grid {
  width: 28px;
  height: 28px;
  border: 2px solid #c8e6ff;
  border-radius: 4px;
  box-shadow: 14px 0 0 -8px #c8e6ff, 0 14px 0 -8px #c8e6ff, 14px 14px 0 -8px #c8e6ff;
}

.viewer-tools {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 26px;
  min-height: 58px;
  color: #c6edff;
}

.tool-dot,
.tool-circle,
.tool-cross,
.tool-line {
  display: inline-block;
  width: 28px;
  height: 28px;
  border: 2px solid #b8eaff;
  border-radius: 50%;
  opacity: 0.95;
}

.tool-dot {
  border-color: var(--cyan);
  background: linear-gradient(135deg, transparent 45%, var(--cyan) 46% 58%, transparent 59%);
}

.tool-line {
  width: 34px;
  height: 2px;
  border: 0;
  border-radius: 0;
  background: #b8eaff;
  transform: rotate(-45deg);
}

.tool-cross {
  position: relative;
  border: 0;
}

.tool-cross::before,
.tool-cross::after {
  content: "";
  position: absolute;
  inset: 13px 2px auto;
  height: 2px;
  background: #b8eaff;
}

.tool-cross::after {
  transform: rotate(90deg);
}

.session {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 58px;
  padding: 0 18px;
  border-left: 1px solid rgba(85, 216, 242, 0.18);
  color: var(--muted);
}

.session a {
  color: var(--blue);
  text-decoration: none;
}

.viewer-shell {
  width: min(1260px, calc(100% - 28px));
  margin: 0 auto;
  padding: 18px 0 36px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(120px, 190px) 1fr auto;
  align-items: center;
  gap: 24px;
  min-height: 230px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(135deg, #02040a 0%, #06183a 54%, #04102c 100%);
  box-shadow: inset 0 0 0 1px rgba(85, 216, 242, 0.12), 0 18px 46px rgba(0, 0, 0, 0.34);
}

.hero-logo {
  width: min(190px, 36vw);
  aspect-ratio: 1;
  border-radius: 50%;
  object-fit: cover;
  background: #fff;
  box-shadow: 0 0 0 1px rgba(85, 216, 242, 0.5), 0 0 38px rgba(22, 139, 255, 0.35);
}

.hero-copy {
  min-width: 0;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--cyan);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0;
}

h1 {
  margin: 0;
  color: #f7fbff;
  font-size: 42px;
  line-height: 1.05;
  letter-spacing: 0;
}

.summary {
  max-width: 680px;
  margin: 12px 0 0;
  color: #a9cef2;
  font-size: 17px;
  line-height: 1.45;
}

.status {
  min-width: 128px;
  padding: 10px 12px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: rgba(8, 27, 59, 0.72);
  color: #b9dcff;
  text-align: center;
  font-weight: 700;
}

.status.ok {
  border-color: rgba(43, 221, 174, 0.6);
  color: var(--ok);
}

.actions,
.footer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 14px 0;
}

.action,
button {
  min-height: 42px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 10px 14px;
  background: #061733;
  color: #dbeeff;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.action:hover,
button:hover {
  border-color: var(--cyan);
}

.action.disabled {
  opacity: 0.55;
  pointer-events: none;
}

.action.primary {
  border-color: var(--cyan);
  background: #0b78d1;
  color: #fff;
  box-shadow: 0 0 20px rgba(22, 139, 255, 0.28);
}

button:disabled {
  cursor: wait;
  opacity: 0.58;
}

.panel,
.login-panel {
  padding: 18px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: rgba(8, 27, 59, 0.92);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

h2 {
  margin: 0;
  color: #f5fbff;
  font-size: 20px;
  letter-spacing: 0;
}

.data-status {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
}

.meter {
  width: 100%;
  height: 14px;
  overflow: hidden;
  border: 1px solid rgba(85, 216, 242, 0.2);
  border-radius: 8px;
  background: #020714;
}

#progressBar {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--blue), var(--cyan));
  transition: width 180ms ease;
}

.progress-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 14px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.stat {
  padding: 13px 14px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: #06132e;
}

.stat strong {
  display: block;
  color: #fff;
  font-size: 24px;
}

.stat span {
  color: var(--muted);
  font-size: 13px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.series {
  min-height: 112px;
  padding: 14px;
  border: 1px solid #0b3974;
  border-radius: 8px;
  background: var(--card);
}

.series.previewed {
  padding: 0;
  overflow: hidden;
}

.series img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  background: #000;
}

.series-body {
  padding: 13px 14px 14px;
}

.series strong {
  display: block;
  margin-bottom: 8px;
  color: #fff;
  font-size: 15px;
}

.series span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.login-page {
  display: grid;
  place-items: center;
  min-height: 100vh;
  background: radial-gradient(circle at 20% 20%, rgba(22, 139, 255, 0.2), transparent 32%), #020714;
}

.login-shell {
  display: grid;
  grid-template-columns: minmax(300px, 1fr) minmax(300px, 420px);
  align-items: center;
  gap: 28px;
  width: min(1080px, calc(100% - 32px));
}

.login-brand {
  display: grid;
  justify-items: center;
  gap: 22px;
  text-align: center;
}

.login-logo {
  width: min(420px, 82vw);
  aspect-ratio: 1;
  border-radius: 50%;
  object-fit: cover;
  background: #fff;
  box-shadow: 0 0 0 1px rgba(85, 216, 242, 0.48), 0 0 54px rgba(22, 139, 255, 0.26);
}

.login-panel {
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.42);
}

.login-panel label {
  display: block;
  margin: 0 0 14px;
  color: #c8def5;
  font-weight: 700;
}

.login-panel input {
  display: block;
  width: 100%;
  min-height: 44px;
  margin-top: 7px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  padding: 10px 12px;
  background: #020714;
  color: #fff;
  font: inherit;
}

.login-panel input:focus {
  border-color: var(--cyan);
  outline: 0;
  box-shadow: 0 0 0 3px rgba(85, 216, 242, 0.16);
}

.login-error {
  min-height: 20px;
  margin: 12px 0 0;
  color: #ff9d9d;
}

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

  .viewer-tools {
    display: none;
  }

  .session {
    justify-content: space-between;
    border-left: 0;
    border-top: 1px solid rgba(85, 216, 242, 0.18);
  }

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

  h1 {
    font-size: 32px;
  }

  .login-shell {
    grid-template-columns: 1fr;
    padding: 26px 0;
  }
}
