@font-face {
  font-family: "M8 DIN";
  src: url("./assets/fonts/DINNextW01-Regular.woff2") format("woff2");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "M8 Good Wide";
  src: url("./assets/fonts/FFGoodProWide-BlackItalic.woff2") format("woff2");
  font-style: normal;
  font-weight: 900;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --ink: #f7f7f5;
  --muted: #a6a9b2;
  --faint: #747780;
  --paper: #171717;
  --chrome: #1d1d1e;
  --panel: #242425;
  --panel-raised: #2c2c2e;
  --panel-strong: #333336;
  --line: rgba(255, 255, 255, 0.1);
  --line-strong: rgba(255, 255, 255, 0.2);
  --accent: #ff2e91;
  --accent-soft: rgba(255, 46, 145, 0.16);
  --warm: #ffd400;
  --danger: #ff5b62;
  --serif: "M8 Good Wide", "Arial Narrow", "Bahnschrift Condensed", "Segoe UI", Arial, sans-serif;
  --sans: "M8 DIN", "Bahnschrift", "Arial Narrow", "Segoe UI", Arial, sans-serif;
  --mono: "Cascadia Mono", Consolas, monospace;
  --radius: 0;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

::selection {
  background: var(--accent-soft);
  color: var(--ink);
}

html {
  min-width: 320px;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  caret-color: transparent;
  overflow-x: hidden;
  background:
    linear-gradient(rgba(41, 42, 37, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(41, 42, 37, 0.035) 1px, transparent 1px),
    var(--paper);
  background-size: 48px 48px;
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

input,
textarea,
[contenteditable="true"] {
  caret-color: auto;
}

button,
input,
select,
a {
  accent-color: var(--accent);
  color: inherit;
  font: inherit;
}

button,
select {
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
}

button {
  border: 0;
}

a {
  -webkit-touch-callout: none;
  text-decoration: none;
  user-select: none;
}

button:focus:not(:focus-visible),
input:focus:not(:focus-visible),
select:focus:not(:focus-visible),
a:focus:not(:focus-visible) {
  outline: none;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
a:focus-visible,
.chart-bar:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.ambient {
  position: fixed;
  z-index: -1;
  width: 30rem;
  height: 30rem;
  border-radius: 50%;
  opacity: 0.075;
  filter: blur(140px);
  pointer-events: none;
}

.ambient--one {
  top: -14rem;
  left: -9rem;
  background: var(--accent);
}

.ambient--two {
  right: -13rem;
  bottom: -6rem;
  background: var(--warm);
}

.topbar,
.app-shell {
  width: min(1480px, calc(100% - 40px));
  margin-inline: auto;
}

.topbar {
  display: flex;
  min-height: 62px;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-top: 0;
  border-radius: 0 0 5px 5px;
  background:
    linear-gradient(105deg, var(--chrome) 0%, var(--chrome) 72%, var(--panel-raised) 100%);
  box-shadow: 0 8px 26px rgba(41, 42, 37, 0.1);
}

.brand {
  display: inline-flex;
  gap: 11px;
  align-items: center;
  color: var(--ink);
  font-size: 13px;
  font-weight: 550;
  letter-spacing: 0.035em;
}

.brand__mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: var(--accent);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18);
  color: #fffef9;
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.brand__copy {
  display: grid;
  gap: 2px;
}

.brand__copy strong {
  font-size: 13px;
  font-weight: 650;
  letter-spacing: 0;
  line-height: 1.1;
}

.brand__copy small {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 400;
  letter-spacing: 0.12em;
  line-height: 1.1;
  text-transform: uppercase;
}

.topbar__actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.sync-status {
  display: inline-flex;
  gap: 9px;
  align-items: center;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.04em;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.42);
}

.sync-status__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--faint);
}

.sync-status[data-state="ok"] .sync-status__dot {
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.sync-status[data-state="error"] .sync-status__dot {
  background: var(--danger);
}

.button {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: transparent;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  transition: border-color 180ms ease, background 180ms ease, color 180ms ease, transform 180ms ease;
}

.button:hover {
  border-color: rgba(41, 42, 37, 0.44);
  transform: translateY(-1px);
}

.button--primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #fffef9;
}

.button--primary:hover {
  border-color: #666c32;
  background: #666c32;
}

.download-action {
  min-height: 34px;
  padding-inline: 13px;
  font-size: 10px;
}

.button--secondary {
  background: rgba(41, 42, 37, 0.035);
}

.button--quiet {
  min-height: 32px;
  gap: 9px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.42);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 400;
  text-transform: uppercase;
}

.button--quiet:hover {
  color: var(--ink);
  border-color: var(--line-strong);
  background: var(--chrome);
  transform: none;
}

.button__arrow {
  color: var(--accent);
  font-size: 14px;
  line-height: 1;
  transition: transform 180ms ease;
}

.button--quiet:hover .button__arrow {
  transform: translateX(2px);
}

.eyebrow,
.card-label {
  margin: 0;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.eyebrow {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 24px;
}

.eyebrow > span {
  width: 34px;
  height: 1px;
  background: var(--accent);
}

.login-card h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(52px, 7vw, 102px);
  font-weight: 400;
  letter-spacing: -0.052em;
  line-height: 0.9;
}

.tabs {
  display: flex;
  margin-top: 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--chrome);
}

.tab {
  position: relative;
  display: inline-flex;
  gap: 10px;
  min-width: 140px;
  min-height: 44px;
  align-items: center;
  padding: 0 18px;
  border-right: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.tab::after {
  position: absolute;
  right: 18px;
  bottom: -1px;
  left: 18px;
  height: 2px;
  background: var(--accent);
  content: "";
  opacity: 0;
  transform: scaleX(0.25);
  transition: opacity 180ms ease, transform 260ms var(--ease);
}

.tab > strong {
  display: inline-grid;
  min-width: 20px;
  height: 20px;
  margin-left: auto;
  place-items: center;
  border-radius: 50%;
  background: rgba(41, 42, 37, 0.07);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 400;
}

.tab:hover,
.tab.is-active {
  color: var(--ink);
}

.tab:hover {
  background: rgba(41, 42, 37, 0.035);
}

.tab.is-active {
  background: var(--panel-raised);
}

.tab.is-active::after {
  opacity: 1;
  transform: scaleX(1);
}

.tab-panel {
  padding: 16px 0 32px;
}

.kpi-layout {
  display: grid;
  grid-template-columns: minmax(180px, 220px) minmax(0, 1fr);
  gap: 14px;
}

.metric-card,
.chart-card,
.export-card,
.video-browser,
.player-card {
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.14);
}

.metric-card {
  display: flex;
  min-height: 350px;
  flex-direction: column;
  padding: 20px;
  background:
    linear-gradient(145deg, rgba(184, 189, 116, 0.055), transparent 55%),
    var(--panel-raised);
}

.metric-card__value {
  display: block;
  margin-top: auto;
  font-family: var(--sans);
  font-size: clamp(72px, 8vw, 112px);
  font-weight: 620;
  letter-spacing: -0.065em;
  line-height: 0.82;
}

.metric-card__detail {
  margin: 30px 0 0;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.chart-card {
  min-width: 0;
  min-height: 350px;
  padding: 20px;
  background: var(--panel);
}

.card-header,
.video-browser__header,
.player-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.card-header {
  gap: 24px;
  min-height: 44px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.card-header h2,
.export-card h2,
.video-browser h2,
.player-meta h2 {
  margin: 0;
  font-family: var(--sans);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.015em;
}

.chart-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.custom-select {
  position: relative;
  flex: 0 0 auto;
}

.custom-select__trigger {
  display: inline-flex;
  min-width: 138px;
  min-height: 34px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 11px 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--panel-strong);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 600;
  text-align: left;
}

.custom-select__trigger:hover,
.custom-select.is-open .custom-select__trigger {
  border-color: rgba(116, 122, 59, 0.55);
  background: var(--panel-raised);
}

.custom-select__trigger:focus-visible {
  outline: 2px solid rgba(116, 122, 59, 0.42);
  outline-offset: 2px;
}

.custom-select__chevron {
  width: 7px;
  height: 7px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  opacity: 0.68;
  transform: translateY(-2px) rotate(45deg);
  transition: transform 140ms ease;
}

.custom-select.is-open .custom-select__chevron {
  transform: translateY(2px) rotate(225deg);
}

.custom-select__menu {
  position: absolute;
  z-index: 12;
  top: calc(100% + 6px);
  left: 0;
  min-width: 100%;
  width: max-content;
  padding: 4px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--panel-strong);
  box-shadow: 0 12px 28px rgba(41, 42, 37, 0.16);
}

.custom-select__option {
  display: flex;
  width: 100%;
  min-height: 34px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 0 10px;
  border-radius: 2px;
  background: transparent;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 12px;
  text-align: left;
}

.custom-select__option:hover,
.custom-select__option:focus-visible {
  outline: none;
  background: var(--chrome);
  color: var(--ink);
}

.custom-select__option.is-selected {
  color: var(--ink);
  font-weight: 650;
}

.custom-select__option.is-selected::after {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  content: "";
}

.card-header #download-chart {
  flex: 0 0 auto;
}

.chart-wrap {
  position: relative;
  min-height: 240px;
  overflow-x: auto;
  overflow-y: hidden;
  background: var(--chrome);
  scrollbar-color: var(--line-strong) transparent;
  scrollbar-width: thin;
  cursor: grab;
  touch-action: pan-x;
  user-select: none;
}

.chart-wrap.is-dragging {
  cursor: grabbing;
}

.chart {
  display: block;
  min-width: 100%;
  height: 240px;
  overflow: visible;
}

.chart-y-axis {
  position: absolute;
  z-index: 3;
  top: 0;
  bottom: 0;
  left: 0;
  width: 32px;
  background: linear-gradient(90deg, var(--chrome) 76%, transparent);
  pointer-events: none;
  will-change: transform;
}

.chart-y-axis[hidden] {
  display: none;
}

.chart-y-axis__label {
  position: absolute;
  right: 8px;
  color: var(--faint);
  font-family: var(--mono);
  font-size: 9px;
  line-height: 1;
  transform: translateY(-50%);
}

.chart-grid {
  stroke: rgba(41, 42, 37, 0.11);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.chart-axis-label {
  fill: var(--faint);
  font-family: var(--mono);
  font-size: 9px;
}

.chart-bar {
  fill: rgba(116, 122, 59, 0.72);
  transition: fill 120ms ease, opacity 120ms ease;
}

.chart-bar:hover,
.chart-bar:focus {
  fill: var(--accent);
  outline: none;
}

.chart-bar[data-zero="true"] {
  fill: rgba(41, 42, 37, 0.065);
}

.chart-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--faint);
  font-size: 13px;
}

.chart-tooltip {
  position: fixed;
  z-index: 20;
  max-width: 220px;
  padding: 10px 12px;
  border: 1px solid #3d3f37;
  border-radius: var(--radius);
  background: #282923;
  box-shadow: 0 12px 34px rgba(0, 0, 0, 0.34);
  color: #fffef9;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  line-height: 1.55;
  pointer-events: none;
}

.videos-layout {
  display: grid;
  grid-template-columns: minmax(300px, 380px) minmax(0, 1fr);
  gap: 14px;
}

.dashboard-page.is-videos-view {
  height: 100dvh;
  overflow: hidden;
}

.dashboard-page.is-videos-view .topbar {
  position: relative;
  z-index: 5;
  background:
    linear-gradient(105deg, var(--chrome) 0%, var(--chrome) 72%, var(--panel-raised) 100%);
}

.dashboard-page.is-videos-view .app-shell {
  display: flex;
  height: calc(100dvh - 62px);
  min-height: 0;
  flex-direction: column;
}

.dashboard-page.is-videos-view .tabs {
  flex: 0 0 auto;
}

.dashboard-page.is-videos-view #panel-videos {
  min-height: 0;
  flex: 1 1 auto;
  padding-bottom: 16px;
  overflow: hidden;
}

.dashboard-page.is-videos-view .videos-layout {
  height: 100%;
  min-height: 0;
}

.dashboard-page.is-videos-view .video-browser,
.dashboard-page.is-videos-view .player-card {
  height: 100%;
  min-height: 0;
}

.dashboard-page.is-videos-view .video-browser,
.dashboard-page.is-videos-view .player-card {
  display: flex;
  flex-direction: column;
}

.dashboard-page.is-videos-view .video-browser__header,
.dashboard-page.is-videos-view .player-meta {
  flex: 0 0 auto;
}

.dashboard-page.is-videos-view .video-list {
  max-height: none;
  min-height: 0;
  flex: 1 1 0;
  overflow-y: auto;
}

.dashboard-page.is-videos-view .player-stage {
  min-height: 0;
  flex: 1 1 auto;
}

.dashboard-page.is-videos-view .player-stage video {
  height: 100%;
  min-height: 0;
  max-height: 100%;
  object-fit: contain;
}

.video-browser {
  min-height: 540px;
  overflow: hidden;
  background: var(--panel);
}

.video-browser__header {
  min-height: 66px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line-strong);
  background: var(--panel-strong);
}

.video-browser__header h2 {
  font-size: 16px;
}

.video-browser__download {
  flex: 0 0 auto;
}

.video-list {
  max-height: 474px;
  overflow-y: auto;
  scrollbar-color: var(--line-strong) transparent;
  scrollbar-width: thin;
  background: var(--panel);
}

.video-item {
  position: relative;
  display: grid;
  width: 100%;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  gap: 13px;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  text-align: left;
}

.video-item::before {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 2px;
  background: var(--accent);
  content: "";
  opacity: 0;
}

.video-item:hover,
.video-item.is-active {
  background: var(--panel-raised);
}

.video-item.is-active::before {
  opacity: 1;
}

.video-item__play {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  color: var(--accent);
  font-size: 10px;
}

.video-item__copy {
  min-width: 0;
}

.video-item__copy strong,
.video-item__copy span {
  display: block;
}

.video-item__copy strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 12px;
  font-weight: 560;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.video-item__copy span,
.video-item__duration {
  margin-top: 5px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
}

.video-item__duration {
  margin: 0;
}

.empty-message {
  margin: 0;
  padding: 30px 24px;
  color: var(--faint);
  font-size: 13px;
}

.player-card {
  min-width: 0;
  overflow: hidden;
  background: var(--panel);
}

.player-stage {
  position: relative;
  display: grid;
  min-height: 455px;
  place-items: center;
  overflow: hidden;
  background:
    linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    #090a08;
  background-size: 40px 40px;
}

.player-stage video {
  display: none;
  width: 100%;
  max-height: min(68vh, 650px);
  accent-color: var(--accent);
  background: #000;
}

.player-stage.has-video video {
  display: block;
}

.player-placeholder {
  display: grid;
  max-width: 330px;
  place-items: center;
  padding: 24px;
  color: #aaa79f;
  text-align: center;
}

.player-placeholder > span {
  display: grid;
  width: 62px;
  height: 62px;
  margin-bottom: 18px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 50%;
  color: #c4ca78;
  font-size: 15px;
  text-indent: 3px;
}

.player-placeholder p {
  margin: 0;
  font-size: 13px;
  line-height: 1.55;
}

.player-stage.has-video .player-placeholder {
  display: none;
}

.player-meta {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  min-height: 84px;
  gap: 12px;
  padding: 16px 20px;
  border-top: 1px solid var(--line-strong);
  background: var(--panel-strong);
}

.player-meta__info {
  grid-column: 2;
  min-width: 0;
}

.player-meta h2 {
  max-width: 650px;
  min-width: 0;
  overflow: hidden;
  font-size: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.video-download {
  grid-column: 1;
  width: 34px;
  min-height: 34px;
  align-self: center;
  padding: 0;
  color: var(--ink);
}

.video-download svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.5;
}

.player-meta p:last-child {
  margin: 7px 0 0;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
}

.switch {
  display: inline-flex;
  flex: 0 0 auto;
  gap: 11px;
  align-items: center;
  color: var(--muted);
  cursor: pointer;
  font-size: 11px;
}

.player-meta > .switch {
  grid-column: 3;
  justify-self: end;
}

.switch input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.switch__track {
  position: relative;
  width: 38px;
  height: 21px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.2);
  transition: background 180ms ease, border-color 180ms ease;
}

.switch__track > span {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--muted);
  transition: left 200ms var(--ease), background 180ms ease;
}

.switch input:checked + .switch__track {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.switch input:checked + .switch__track > span {
  left: 21px;
  background: var(--accent);
}

.switch input:focus-visible + .switch__track {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.login-page {
  display: grid;
  place-items: center;
}

.login-shell {
  width: min(520px, calc(100% - 40px));
  padding: 50px 0;
}

.login-card {
  padding: clamp(30px, 5vw, 44px);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--panel-raised);
  box-shadow: 0 32px 100px rgba(41, 42, 37, 0.14);
}

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

.login-card .eyebrow {
  margin-bottom: 18px;
}

.login-card h1 {
  font-size: clamp(36px, 7vw, 52px);
}

.login-card__intro {
  max-width: 520px;
  margin: 28px 0 38px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.65;
}

.login-form label {
  display: block;
  margin-bottom: 10px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.login-form {
  margin-top: 38px;
}

.login-form__row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.login-form input[type="password"] {
  min-width: 0;
  min-height: 48px;
  padding: 0 15px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--chrome);
}

.login-form input[type="password"]:hover {
  border-color: rgba(41, 42, 37, 0.4);
}

.form-error {
  margin: 12px 0 0;
  color: var(--danger);
  font-size: 12px;
}

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

[hidden] {
  display: none !important;
}

@media (max-width: 980px) {
  .kpi-layout {
    grid-template-columns: 1fr;
  }

  .metric-card {
    min-height: 240px;
  }

  .metric-card__value {
    margin-top: 54px;
  }

  .videos-layout {
    grid-template-columns: 1fr;
  }

  .dashboard-page.is-videos-view .videos-layout {
    grid-template-rows: clamp(170px, 40dvh, 300px) minmax(0, 1fr);
  }

  .player-card {
    grid-row: 1;
  }

  .video-browser {
    min-height: auto;
  }

  .video-list {
    max-height: 440px;
  }

  .player-stage {
    min-height: 420px;
  }
}

@media (max-width: 680px) {
  .topbar,
  .app-shell {
    width: min(100% - 24px, 1480px);
  }

  .topbar {
    min-height: 58px;
    padding: 0 10px;
  }

  .topbar__actions {
    gap: 14px;
  }

  .sync-status {
    display: none;
  }

  .brand__copy small {
    display: none;
  }

  .tabs {
    margin-top: 10px;
    overflow: hidden;
  }

  .tab {
    min-width: 0;
    flex: 1 1 0;
    min-height: 42px;
    padding: 0 14px;
  }

  .tab-panel {
    padding-top: 10px;
  }

  .metric-card,
  .chart-card {
    padding: 16px;
  }

  .metric-card {
    display: grid;
    min-height: 104px;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
  }

  .metric-card__value {
    margin: 0;
    font-size: 62px;
  }

  .card-header {
    gap: 12px;
    flex-wrap: wrap;
  }

  .chart-heading {
    flex: 1 1 100%;
    gap: 8px;
  }

  .custom-select {
    min-width: 116px;
  }

  .custom-select__trigger {
    min-width: 116px;
  }

  .card-header #download-chart {
    min-height: 36px;
    margin-left: auto;
    padding: 0 11px;
    font-size: 9px;
  }

  .chart-wrap,
  .chart {
    min-height: 220px;
    height: 220px;
  }

  .player-stage {
    min-height: 240px;
  }

  .dashboard-page.is-videos-view .app-shell {
    height: calc(100dvh - 58px);
  }

  .dashboard-page.is-videos-view #panel-videos {
    padding-bottom: 10px;
  }

  .dashboard-page.is-videos-view .videos-layout {
    grid-template-rows: clamp(170px, 40dvh, 300px) minmax(0, 1fr);
  }

  .dashboard-page.is-videos-view .player-stage {
    min-height: 0;
  }

  .player-meta {
    gap: 10px;
    padding: 14px 16px;
  }

  .player-meta h2 {
    font-size: 14px;
  }

  .switch {
    margin-top: 0;
  }

  .video-browser__header {
    padding: 14px 16px;
  }

  .video-browser__download {
    min-height: 32px;
    padding-inline: 10px;
    font-size: 9px;
  }

  .video-item {
    padding: 12px 14px;
  }

  .login-shell {
    width: min(100% - 28px, 760px);
  }

  .login-card {
    padding: 28px 23px 32px;
  }

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

  .login-form__row {
    grid-template-columns: 1fr;
  }

  .login-form__row .button {
    min-height: 48px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

/* M8 visual system */
body {
  background:
    radial-gradient(circle at 82% -10%, rgba(255, 46, 145, 0.14), transparent 30rem),
    linear-gradient(rgba(255, 255, 255, 0.026) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.026) 1px, transparent 1px),
    var(--paper);
  background-size: auto, 44px 44px, 44px 44px, auto;
  color: var(--ink);
}

::selection {
  background: var(--accent);
  color: #fff;
}

.ambient {
  opacity: 0.13;
  filter: blur(120px);
}

.ambient--one {
  background: var(--accent);
}

.ambient--two {
  background: #6f1745;
}

.topbar {
  position: relative;
  width: 100%;
  min-height: 72px;
  justify-content: flex-end;
  padding: 0 24px;
  border: 0;
  border-bottom: 2px solid var(--accent);
  border-radius: 0;
  background: rgba(24, 24, 25, 0.97);
  box-shadow: 0 16px 42px rgba(0, 0, 0, 0.28);
}

.dashboard-page.is-videos-view .topbar {
  background: rgba(24, 24, 25, 0.98);
}

.topbar .brand {
  position: absolute;
  top: 50%;
  left: 50%;
  flex-direction: column;
  gap: 0;
  transform: translate(-50%, -50%);
}

.brand {
  color: var(--ink);
  text-transform: uppercase;
}

.brand__logo {
  display: block;
  width: 48px;
  height: 48px;
  object-fit: contain;
  filter: invert(1);
}

.brand__copy {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.brand__copy strong {
  color: var(--ink);
  font-family: var(--serif);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.sync-status {
  border-color: var(--line-strong);
  border-radius: 0;
  background: #202021;
  color: var(--muted);
  text-transform: uppercase;
}

.sync-status[data-state="ok"] .sync-status__dot {
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.button {
  border-color: var(--line-strong);
  border-radius: 0;
  font-family: var(--serif);
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.button:hover {
  border-color: var(--accent);
}

.button--primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
  clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 8px, 100% 100%, 0 100%);
}

.button--primary:hover {
  border-color: #ff5dad;
  background: #ff5dad;
}

.button--secondary {
  border-color: #55545a;
  background: #2c2c2e;
}

.button--quiet {
  border-color: #4b4b4e;
  border-radius: 0;
  background: #232324;
  color: #d6d6da;
  clip-path: none;
}

.button--quiet:hover {
  border-color: var(--accent);
  background: #2d2d2f;
  color: #fff;
}

.button__arrow,
.eyebrow,
.card-label {
  color: var(--accent);
}

.app-shell {
  width: min(1480px, calc(100% - 56px));
}

.tabs {
  margin-top: 18px;
  border-color: #414144;
  border-radius: 0;
  background: #1d1d1e;
}

.tab {
  min-height: 48px;
  border-color: #414144;
  color: #a7a7ad;
  font-family: var(--serif);
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.tab::after {
  right: 0;
  bottom: 0;
  left: 0;
  height: 3px;
  background: var(--accent);
}

.tab:hover {
  background: #29292b;
  color: #fff;
}

.tab.is-active {
  background: var(--accent);
  color: #fff;
}

.tab.is-active::after {
  background: #fff;
}

.tab > strong {
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 0;
  background: rgba(0, 0, 0, 0.2);
  color: currentColor;
}

.metric-card,
.chart-card,
.video-browser,
.player-card {
  border-color: #444448;
  border-radius: 0;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.22);
}

.metric-card {
  position: relative;
  overflow: hidden;
  border-top: 4px solid var(--accent);
  background:
    linear-gradient(145deg, rgba(255, 46, 145, 0.2), transparent 58%),
    #272729;
}

.metric-card::after {
  position: absolute;
  right: -48px;
  bottom: -70px;
  width: 180px;
  height: 180px;
  border: 22px solid rgba(255, 46, 145, 0.08);
  content: "";
  transform: rotate(45deg);
  pointer-events: none;
}

.card-label {
  font-family: var(--serif);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.16em;
}

.metric-card__value {
  position: relative;
  z-index: 1;
  color: #fff;
  font-family: var(--serif);
  font-size: clamp(64px, 6.5vw, 96px);
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  text-shadow: 8px 8px 0 rgba(255, 46, 145, 0.2);
}

.chart-card {
  border-top: 4px solid #4a4a4d;
  background: #242425;
}

.card-header {
  border-color: #444448;
}

.card-header h2,
.video-browser h2,
.player-meta h2 {
  color: #fff;
  font-family: var(--serif);
  font-weight: 800;
  letter-spacing: 0.035em;
  text-transform: uppercase;
}

.custom-select__trigger {
  border-color: #55555a;
  border-radius: 0;
  background: #303033;
  color: #fff;
  font-family: var(--serif);
  font-weight: 800;
  text-transform: uppercase;
}

.custom-select__trigger:hover,
.custom-select.is-open .custom-select__trigger {
  border-color: var(--accent);
  background: #39393c;
}

.custom-select__trigger:focus-visible {
  outline-color: var(--accent);
}

.custom-select__menu {
  border-color: var(--accent);
  border-radius: 0;
  background: #262627;
  box-shadow: 12px 12px 0 rgba(0, 0, 0, 0.28);
}

.custom-select__option {
  border-radius: 0;
  color: var(--muted);
  font-family: var(--serif);
  font-weight: 700;
  text-transform: uppercase;
}

.custom-select__option:hover,
.custom-select__option:focus-visible {
  background: var(--accent);
  color: #fff;
}

.custom-select__option.is-selected::after {
  border-radius: 0;
  background: var(--accent);
  transform: rotate(45deg);
}

.chart-wrap {
  background:
    linear-gradient(rgba(255, 255, 255, 0.028) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.028) 1px, transparent 1px),
    #1d1d1e;
  background-size: 32px 32px;
  scrollbar-color: var(--accent) #181819;
}

.chart-y-axis {
  background: linear-gradient(90deg, #1d1d1e 76%, rgba(29, 29, 30, 0));
}

.chart-y-axis__label {
  color: #8f9098;
}

.chart-grid {
  stroke: rgba(255, 255, 255, 0.12);
}

.chart-axis-label {
  fill: #8f9098;
}

.chart-bar {
  fill: rgba(255, 46, 145, 0.78);
}

.chart-bar:hover,
.chart-bar:focus {
  fill: #ff65b0;
}

.chart-bar[data-zero="true"] {
  fill: rgba(255, 255, 255, 0.06);
}

.chart-tooltip {
  border-color: var(--accent);
  border-radius: 0;
  background: #111;
  box-shadow: 8px 8px 0 rgba(255, 46, 145, 0.22);
  color: #fff;
}

.video-browser {
  border-top: 4px solid var(--accent);
  background: #202021;
}

.video-browser__header {
  border-color: #47474b;
  background: #2b2b2d;
}

.video-list {
  background: #1f1f20;
  scrollbar-color: var(--accent) #181819;
}

.video-item {
  border-color: #3e3e42;
  background: #202021;
}

.video-item::before {
  width: 4px;
  background: var(--accent);
}

.video-item:hover {
  background: #2c2c2e;
}

.video-item.is-active {
  background:
    linear-gradient(90deg, rgba(255, 46, 145, 0.22), transparent 70%),
    #29292b;
}

.video-item__play {
  border-color: #59595e;
  border-radius: 0;
  color: var(--accent);
}

.video-item.is-active .video-item__play {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.video-item__copy strong {
  color: #fff;
  font-family: var(--serif);
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.video-item__copy span,
.video-item__duration {
  color: #94949d;
}

.player-card {
  border-top: 4px solid #4a4a4d;
  background: #19191a;
}

.player-stage {
  background:
    linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    #080808;
  background-size: 40px 40px;
}

.player-stage video {
  accent-color: var(--accent);
}

.player-placeholder {
  color: #9999a1;
  text-transform: uppercase;
}

.player-placeholder > span {
  border-color: var(--accent);
  border-radius: 0;
  background: var(--accent);
  color: #fff;
  transform: rotate(45deg);
}

.player-placeholder > span > span {
  display: block;
  transform: rotate(-45deg);
}

.player-meta {
  border-color: #454549;
  background: #2a2a2c;
}

.video-download {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: #fff;
}

.player-meta p:last-child {
  color: #9c9ca4;
}

.switch {
  color: #b9b9c0;
  font-family: var(--serif);
  font-weight: 700;
  text-transform: uppercase;
}

.switch__track {
  border-color: #5a5a5f;
  border-radius: 0;
  background: #161617;
}

.switch__track > span {
  border-radius: 0;
  background: #8a8a92;
}

.switch input:checked + .switch__track {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.switch input:checked + .switch__track > span {
  background: var(--accent);
}

.login-page {
  position: relative;
  background:
    linear-gradient(135deg, rgba(255, 46, 145, 0.19), transparent 45%),
    radial-gradient(circle at 80% 20%, rgba(255, 46, 145, 0.12), transparent 30rem),
    #161617;
}

.login-shell {
  width: min(540px, calc(100% - 40px));
}

.login-card {
  position: relative;
  overflow: hidden;
  padding: 42px 44px 46px;
  border-color: #4b4b50;
  border-top: 4px solid var(--accent);
  background:
    linear-gradient(145deg, rgba(255, 46, 145, 0.11), transparent 44%),
    #242426;
  box-shadow: 24px 24px 0 rgba(0, 0, 0, 0.3);
}

.login-card::after {
  position: absolute;
  right: -80px;
  bottom: -80px;
  width: 180px;
  height: 180px;
  border: 24px solid rgba(255, 46, 145, 0.08);
  content: "";
  transform: rotate(45deg);
  pointer-events: none;
}

.brand--login {
  position: relative;
  z-index: 1;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 36px;
  color: #fff;
  font-family: var(--serif);
  font-size: 15px;
  font-weight: 900;
  letter-spacing: 0.16em;
}

.brand--login .brand__logo {
  width: 118px;
  height: 112px;
}

.login-card .eyebrow {
  position: relative;
  z-index: 1;
  font-family: var(--serif);
  font-weight: 800;
}

.login-card h1 {
  position: relative;
  z-index: 1;
  color: #fff;
  font-family: var(--serif);
  font-size: clamp(42px, 9vw, 66px);
  font-weight: 900;
  letter-spacing: -0.02em;
  line-height: 0.9;
  text-transform: uppercase;
}

.login-form {
  position: relative;
  z-index: 1;
}

.login-form label {
  color: #b7b7bf;
  font-family: var(--serif);
  font-weight: 700;
}

.login-form input[type="password"] {
  border-color: #55555a;
  border-radius: 0;
  background: #19191a;
  color: #fff;
}

.login-form input[type="password"]:hover {
  border-color: #68686e;
}

.login-form input[type="password"]:focus,
.login-form input[type="password"]:focus-visible {
  border-color: var(--accent);
  outline: none;
  box-shadow: none;
}

@media (max-width: 680px) {
  .topbar {
    min-height: 64px;
    padding: 0 12px;
  }

  .topbar .brand {
    position: static;
    flex-direction: row;
    margin-right: auto;
    transform: none;
  }

  .topbar .brand__logo {
    width: 42px;
    height: 42px;
  }

  .topbar,
  .app-shell {
    width: 100%;
  }

  .app-shell {
    padding-inline: 12px;
  }

  .tabs {
    margin-top: 12px;
  }

  .tab {
    min-height: 46px;
    font-size: 13px;
  }

  .tab-panel {
    padding-top: 12px;
  }

  .metric-card,
  .chart-card {
    padding: 16px;
  }

  .metric-card {
    min-height: 112px;
  }

  .metric-card__value {
    font-size: clamp(52px, 16vw, 64px);
  }

  .card-header {
    padding-bottom: 14px;
  }

  .video-browser__header {
    padding: 13px 14px;
  }

  .player-meta {
    padding: 13px 14px;
  }

  .player-meta > .switch {
    flex-direction: column;
    gap: 6px;
    align-items: center;
    text-align: center;
  }

  .login-shell {
    width: min(100% - 28px, 540px);
  }

  .login-card {
    padding: 30px 24px 32px;
    box-shadow: 12px 12px 0 rgba(0, 0, 0, 0.32);
  }

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

  .brand--login .brand__logo {
    width: 96px;
    height: 92px;
  }

  .login-card h1 {
    font-size: 44px;
  }
}
