:root {
  color-scheme: light;
  --bg: #f4efe4;
  --bg-top: #efe4ce;
  --bg-bottom: #f7f3ea;
  --panel: rgba(255, 252, 246, 0.88);
  --panel-solid: #fffaf1;
  --line: #d4cab7;
  --line-strong: #bcae95;
  --text: #1f1a15;
  --muted: #6b6155;
  --accent: #0f6f66;
  --accent-dark: #0c544d;
  --accent-soft: rgba(15, 111, 102, 0.12);
  --warn: #aa531f;
  --input-bg: rgba(255, 255, 255, 0.9);
  --shadow: 0 18px 36px rgba(53, 42, 24, 0.08);
  --plot-paper: #fffaf1;
  --plot-bg: #fffdf9;
  --plot-grid: rgba(117, 104, 82, 0.18);
  --plot-speed: #0f6f66;
  --plot-fit-speed: #7b3fc4;
  --plot-power: #c05a1a;
  --plot-cadence: #8cba2b;
  --plot-marker: #bf5b27;
  --plot-marker-text: #8e3e12;
  --plot-tooltip: rgba(255, 250, 241, 0.96);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d171d;
  --bg-top: #14303a;
  --bg-bottom: #091117;
  --panel: rgba(13, 24, 31, 0.86);
  --panel-solid: #12212a;
  --line: rgba(117, 154, 168, 0.22);
  --line-strong: rgba(147, 187, 201, 0.34);
  --text: #eaf4f7;
  --muted: #9ab1bc;
  --accent: #67d0bd;
  --accent-dark: #3db59f;
  --accent-soft: rgba(103, 208, 189, 0.12);
  --warn: #ff9f6a;
  --input-bg: rgba(8, 17, 24, 0.88);
  --shadow: 0 18px 36px rgba(0, 0, 0, 0.28);
  --plot-paper: #12212a;
  --plot-bg: #0d171d;
  --plot-grid: rgba(154, 177, 188, 0.22);
  --plot-speed: #67d0bd;
  --plot-fit-speed: #c893ff;
  --plot-power: #ffb066;
  --plot-cadence: #d7ef78;
  --plot-marker: #ff9f6a;
  --plot-marker-text: #ffd3bb;
  --plot-tooltip: rgba(18, 33, 42, 0.96);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

html.record-video-html--immersive,
html.record-video-html--immersive body {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(103, 208, 189, 0.14), transparent 26%),
    radial-gradient(circle at top right, rgba(191, 91, 39, 0.12), transparent 18%),
    linear-gradient(180deg, var(--bg-top) 0%, var(--bg) 32%, var(--bg-bottom) 100%);
  transition: background 180ms ease, color 180ms ease;
}

.wrap {
  width: min(1420px, calc(100vw - 32px));
  margin: 0 auto;
}

.ride-detail-body main.wrap {
  width: min(100% - 32px, 1680px);
}

.ride-detail-page {
  display: grid;
  gap: 22px;
}

.ride-detail-page .panel {
  margin-bottom: 0;
}

.ride-detail-page .table-scroll {
  width: 100%;
}

.ride-detail-page .table-scroll table {
  min-width: 980px;
}

.ride-detail-page .table-scroll {
  overflow-x: auto;
  overflow-y: hidden;
}

.site-header {
  padding: 28px 0 18px;
}

.header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: inline-block;
  color: var(--text);
  text-decoration: none;
  font-family: "Space Grotesk", "IBM Plex Sans", sans-serif;
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.04em;
}

.subtitle,
.muted {
  color: var(--muted);
}

.site-nav {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.site-nav a {
  color: var(--muted);
  text-decoration: none;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid transparent;
}

.site-nav a:hover {
  color: var(--text);
  background: var(--accent-soft);
  border-color: var(--line);
}

.theme-toggle {
  min-width: 126px;
  background: var(--panel-solid);
  color: var(--text);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow);
}

.theme-toggle:hover {
  background: var(--accent-soft);
  color: var(--text);
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.flash-stack {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
}

.flash {
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--panel-solid);
  box-shadow: var(--shadow);
}

.flash-success {
  border-color: rgba(103, 208, 189, 0.4);
}

.flash-warning {
  border-color: rgba(191, 91, 39, 0.4);
}

.flash-error {
  border-color: rgba(191, 91, 39, 0.55);
  color: var(--warn);
}

.filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  align-items: end;
  flex: 1 1 auto;
}

.ride-list-toolbar {
  align-items: end;
}

.filters label {
  display: grid;
  gap: 6px;
  font-size: 0.95rem;
}

input,
select,
button {
  font: inherit;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--input-bg);
  color: var(--text);
  transition: border-color 160ms ease, background 160ms ease, color 160ms ease, transform 160ms ease;
}

input::placeholder {
  color: var(--muted);
}

input:focus,
select:focus,
button:focus {
  outline: 2px solid transparent;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

button {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  cursor: pointer;
}

button:hover {
  background: var(--accent-dark);
  transform: translateY(-1px);
}

.secondary-button {
  background: var(--panel-solid);
  color: var(--text);
  border-color: var(--line-strong);
}

.secondary-button:hover {
  background: var(--accent-soft);
  color: var(--text);
}

.table-scroll {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

th,
td {
  padding: 12px 10px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

tbody tr:hover {
  background: var(--accent-soft);
}

.clickable-row {
  cursor: pointer;
}

.clickable-row:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

th {
  font-size: 0.9rem;
  color: var(--muted);
}

td a,
.back-link {
  color: var(--accent);
  text-decoration: none;
}

.back-link:hover,
td a:hover {
  color: var(--accent-dark);
}

.date-main {
  font-weight: 600;
  line-height: 1.2;
}

.date-sub {
  color: var(--muted);
  font-size: 0.88rem;
  margin-top: 3px;
}

h1,
h2 {
  font-family: "Space Grotesk", "IBM Plex Sans", sans-serif;
  letter-spacing: -0.03em;
  margin-top: 0;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.ride-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: start;
}

.ride-header-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 12px;
}

.ride-header-status {
  margin: 10px 0 0;
}

.ride-overview-panel,
.ride-plot-panel,
.ride-samples-panel {
  width: 100%;
  margin: 0;
}

.ride-summary-table-wrap {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-solid);
  overflow: hidden;
}

.ride-summary-table {
  width: 100%;
  min-width: 0;
  border-collapse: collapse;
}

.ride-summary-table th,
.ride-summary-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

.ride-summary-table tbody tr:last-child th,
.ride-summary-table tbody tr:last-child td {
  border-bottom: 0;
}

.ride-summary-table th {
  width: 16%;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: rgba(0, 0, 0, 0.02);
}

.ride-summary-table td {
  width: 34%;
  font-weight: 600;
}

.plot {
  min-height: 460px;
}

.plot--xl {
  min-height: 620px;
}

.hidden {
  display: none !important;
}

.ride-plot-toolbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.ride-review-layout {
  display: grid;
  gap: 18px;
  align-items: stretch;
  min-width: 0;
}

.ride-review-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  min-width: 0;
  min-height: 0;
}

.ride-plot-frame {
  display: grid;
  min-width: 0;
  min-height: 0;
}

.ride-plot-frame .js-plotly-plot,
.ride-plot-frame .plot-container,
.ride-plot-frame .svg-container {
  width: 100% !important;
}

.ride-plot-frame .js-plotly-plot,
.ride-plot-frame .plot-container,
.ride-plot-frame .svg-container,
#ride-plot {
  min-width: 0;
  min-height: 0;
}

.ride-plot-toolbar h2 {
  margin-bottom: 0;
}

.axis-control {
  min-width: 230px;
  display: grid;
  gap: 6px;
  font-size: 0.95rem;
  font-weight: 600;
}

.axis-control span {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 0.76rem;
}

.danger-button {
  background: transparent;
  color: var(--warn);
  border-color: rgba(191, 91, 39, 0.35);
}

.danger-button:hover {
  background: rgba(191, 91, 39, 0.12);
  color: var(--warn);
}

.device-hero,
.status-header,
.section-heading,
.inline-actions,
.device-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.device-page {
  display: grid;
  gap: 20px;
}

.device-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.9fr);
  gap: 20px;
  align-items: start;
}

.device-layout > .panel {
  min-width: 0;
}

.ntp-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.ntp-card h2 {
  font-size: clamp(2rem, 5vw, 4rem);
  margin-bottom: 0;
  font-variant-numeric: tabular-nums;
}

.ntp-meta {
  display: grid;
  gap: 12px;
  margin: 18px 0 0;
}

.ntp-meta div {
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr);
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.ntp-meta dt {
  color: var(--muted);
  font-weight: 600;
}

.ntp-meta dd {
  margin: 0;
  overflow-wrap: anywhere;
  font-variant-numeric: tabular-nums;
}

.precision-control {
  display: grid;
  gap: 6px;
}

.power-upload-form {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.video-ready-button[disabled] {
  opacity: 0.7;
  cursor: not-allowed;
}

.record-video-body {
  --record-top-pad: max(12px, env(safe-area-inset-top));
  --record-bottom-pad: max(16px, env(safe-area-inset-bottom));
  --record-left-pad: max(12px, env(safe-area-inset-left));
  --record-right-pad: max(12px, env(safe-area-inset-right));
}

.record-video-body.record-video-body--immersive {
  overflow: hidden;
  width: 100%;
  position: fixed;
  inset: 0;
  overscroll-behavior: none;
  touch-action: none;
}

.record-video-body .site-header {
  padding: var(--record-top-pad) 0 8px;
}

.record-video-body .subtitle {
  display: none;
}

.record-video-body main.wrap {
  width: min(100vw, 1600px);
}

.record-video-page {
  width: 100%;
}

.record-video-stage {
  position: relative;
  width: 100%;
  min-height: calc(100dvh - 88px);
  min-height: calc(100vh - 88px);
  border-radius: 28px;
  overflow: hidden;
  background:
    radial-gradient(circle at top, rgba(15, 111, 102, 0.12), transparent 30%),
    linear-gradient(180deg, rgba(9, 14, 18, 0.96), rgba(8, 10, 12, 0.99));
  box-shadow: var(--shadow);
}

.record-video-stage::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.45) 0%, rgba(0, 0, 0, 0.08) 24%, rgba(0, 0, 0, 0.18) 64%, rgba(0, 0, 0, 0.7) 100%);
}

.record-video-preview,
.record-video-playback,
#ride-video-player {
  width: 100%;
  height: 100%;
  border-radius: 14px;
  background: #000;
  object-fit: cover;
}

.record-video-overlay,
.record-video-support-banner,
.record-video-drawer,
.record-video-review {
  position: absolute;
  z-index: 2;
}

.record-video-overlay {
  inset-inline: 0;
  padding-inline: calc(var(--record-left-pad) + 6px) calc(var(--record-right-pad) + 6px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.record-video-overlay--top {
  top: 0;
  padding-top: calc(var(--record-top-pad) + 6px);
}

.record-video-overlay--bottom {
  bottom: 0;
  padding-bottom: calc(var(--record-bottom-pad) + 8px);
  flex-direction: column;
  align-items: stretch;
}

.record-video-nav-button,
.record-video-icon-button,
.record-video-trigger {
  min-width: 44px;
  min-height: 44px;
}

.record-video-nav-button,
.record-video-icon-button {
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(12, 17, 21, 0.76);
  color: #fff;
  text-decoration: none;
  backdrop-filter: blur(12px);
}

.record-video-nav-button,
.record-video-icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.record-video-nav-button {
  padding: 0 16px;
  font-weight: 700;
}

.record-video-nav-button--mode {
  min-width: 112px;
}

.record-video-icon-button {
  width: 48px;
  padding: 0;
  font-size: 1.15rem;
}

.record-video-icon-button--plain {
  width: auto;
  padding: 0 16px;
  font-size: 0.95rem;
}

.record-video-top-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.record-video-top-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.record-video-timer {
  min-width: 86px;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.48);
  color: #fff;
  text-align: center;
  font-family: "Space Grotesk", "IBM Plex Sans", sans-serif;
  font-size: clamp(1rem, 3vw, 1.4rem);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.03em;
}

.record-video-pill {
  min-height: 44px;
  padding: 10px 14px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: rgba(0, 0, 0, 0.48);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.92rem;
  font-weight: 700;
  white-space: nowrap;
}

.record-video-pill--good {
  background: rgba(9, 140, 96, 0.88);
}

.record-video-pill--ok {
  background: rgba(196, 132, 29, 0.88);
}

.record-video-pill--poor,
.record-video-pill--error {
  background: rgba(166, 72, 27, 0.92);
}

.record-video-pill--idle {
  background: rgba(0, 0, 0, 0.52);
}

.record-video-status-stack {
  display: grid;
  gap: 6px;
  max-width: min(100%, 620px);
}

.record-video-status,
.record-video-substatus {
  margin: 0;
  color: #fff;
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.5);
}

.record-video-status {
  font-size: clamp(1rem, 3.2vw, 1.2rem);
  font-weight: 700;
}

.record-video-substatus {
  font-size: 0.92rem;
  color: rgba(255, 255, 255, 0.82);
}

.record-video-control-row {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 110px;
}

.record-video-trigger {
  position: relative;
  width: clamp(82px, 16vw, 108px);
  height: clamp(82px, 16vw, 108px);
  min-width: 82px;
  min-height: 82px;
  border-radius: 999px;
  border: 6px solid rgba(255, 255, 255, 0.95);
  background: rgba(255, 255, 255, 0.12);
  box-shadow: 0 18px 36px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(12px);
}

.record-video-trigger:disabled {
  opacity: 0.55;
}

.record-video-trigger__inner {
  display: block;
  width: calc(100% - 18px);
  height: calc(100% - 18px);
  margin: 9px;
  border-radius: 999px;
  background: #dd4636;
  transition: border-radius 140ms ease, transform 140ms ease, background 140ms ease;
}

.record-video-trigger--recording .record-video-trigger__inner {
  border-radius: 22px;
  transform: scale(0.68);
  background: #f4f7fb;
}

.record-video-support-banner {
  left: 50%;
  top: 50%;
  width: min(92%, 520px);
  transform: translate(-50%, -50%);
  padding: 16px 18px;
  border-radius: 18px;
  background: rgba(10, 15, 18, 0.9);
  color: #fff;
  text-align: center;
  border: 1px solid rgba(255, 255, 255, 0.16);
}

.record-video-drawer,
.record-video-review {
  left: 0;
  right: 0;
  bottom: 0;
  padding: 18px calc(var(--record-right-pad) + 8px) calc(var(--record-bottom-pad) + 12px) calc(var(--record-left-pad) + 8px);
  background: linear-gradient(180deg, rgba(17, 24, 29, 0.97), rgba(10, 14, 18, 0.99));
  border-top-left-radius: 24px;
  border-top-right-radius: 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  max-height: min(70dvh, 720px);
  overflow: auto;
}

.record-video-drawer__header,
.record-video-review__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.record-video-drawer__header h2,
.record-video-review__header h2 {
  margin-bottom: 0;
  color: #fff;
}

.record-video-drawer .eyebrow,
.record-video-review .eyebrow {
  color: rgba(255, 255, 255, 0.72);
}

.record-video-drawer__body {
  display: grid;
  gap: 14px;
}

.record-video-field {
  display: grid;
  gap: 8px;
  color: #fff;
  font-weight: 600;
}

.record-video-field span {
  font-size: 0.92rem;
}

.record-video-field small {
  color: rgba(255, 255, 255, 0.72);
}

.record-video-status-card {
  padding: 16px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
}

.record-video-status-card h3 {
  margin: 0 0 12px;
  color: #fff;
}

.record-video-status-list {
  display: grid;
  gap: 10px;
  margin: 0;
}

.record-video-status-list div {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 10px;
  color: rgba(255, 255, 255, 0.88);
}

.record-video-status-list dt {
  color: rgba(255, 255, 255, 0.62);
}

.record-video-status-list dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.record-video-review {
  display: grid;
  gap: 14px;
}

.record-video-review__meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.record-video-review__meta div {
  padding: 14px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.record-video-review__meta span {
  display: block;
  color: rgba(255, 255, 255, 0.66);
  font-size: 0.82rem;
  margin-bottom: 8px;
}

.record-video-review__meta strong {
  color: #fff;
  overflow-wrap: anywhere;
}

.record-video-review__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.record-video-review__actions > * {
  flex: 1 1 180px;
}

.record-video-review .secondary-button {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.18);
  text-align: center;
}

.record-video-review .secondary-button:hover {
  background: rgba(255, 255, 255, 0.15);
}

.ride-video-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.ride-video-frame {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 10px;
  min-width: 0;
  min-height: 0;
}

.ride-video-live-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 12px;
  padding: 16px 18px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(7, 15, 21, 0.88), rgba(10, 22, 29, 0.95));
  box-shadow: var(--shadow);
  color: #f4fbfd;
}

.ride-live-metric {
  min-width: 0;
}

.ride-live-metric span {
  display: block;
  margin-bottom: 6px;
  color: rgba(234, 244, 247, 0.68);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.ride-live-metric strong {
  display: block;
  font-size: clamp(1rem, 2vw, 1.24rem);
  font-weight: 700;
  overflow-wrap: anywhere;
}

#ride-video-player {
  width: 100%;
  min-height: 360px;
  height: 100%;
  max-height: none;
  object-fit: contain;
  background: rgba(0, 0, 0, 0.82);
}

#ride-video-message {
  margin: 0;
}

.ride-samples-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
}

.ride-samples-header h2 {
  margin-bottom: 0;
}

.ride-raw-data-content {
  max-height: 0;
  margin-top: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 220ms ease, opacity 180ms ease, margin-top 220ms ease;
}

.ride-raw-data-content--open {
  max-height: 75vh;
  margin-top: 14px;
  opacity: 1;
}

.ride-raw-data-scroll {
  max-width: 100%;
  max-height: 56vh;
  overflow: auto;
}

.ride-detail-page .ride-raw-data-scroll table {
  min-width: 1040px;
}

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

.imported-data-button {
  min-width: 240px;
}

.imported-data-button--upload {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.imported-data-button--remove {
  background: rgba(191, 91, 39, 0.12);
  border-color: rgba(191, 91, 39, 0.35);
  color: var(--warn);
}

.imported-data-button--remove:hover {
  background: rgba(191, 91, 39, 0.2);
  color: var(--warn);
}

.page-link {
  display: inline-block;
  text-decoration: none;
}

.videos-page {
  display: grid;
  gap: 22px;
}

.videos-panel-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 18px;
}

.videos-panel-header h1 {
  margin-bottom: 0;
}

.videos-count-card {
  min-width: 140px;
  padding: 16px 18px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--panel-solid);
  text-align: right;
}

.videos-count-card span {
  display: block;
  color: var(--muted);
  font-size: 0.84rem;
}

.videos-count-card strong {
  display: block;
  margin-top: 6px;
  font-size: 2rem;
  font-family: "Space Grotesk", "IBM Plex Sans", sans-serif;
}

.videos-list {
  display: grid;
  gap: 14px;
}

.video-list-item {
  padding-block: 18px;
}

.video-list-row {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 18px;
}

.video-list-main {
  min-width: 0;
  flex: 1 1 auto;
}

.video-list-main h2 {
  margin-bottom: 4px;
  font-size: 1.1rem;
}

.video-list-status {
  margin: 0 0 10px;
  font-size: 0.88rem;
}

.video-list-meta,
.video-list-details-meta {
  margin: 0;
  display: grid;
  gap: 6px;
}

.video-list-meta div,
.video-list-details-meta div {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}

.video-list-meta dt,
.video-list-details-meta dt {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.video-list-meta dd,
.video-list-details-meta dd {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 500;
  overflow-wrap: anywhere;
}

.video-list-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: stretch;
  flex: 0 0 auto;
}

.video-list-actions .secondary-button,
.video-list-actions button {
  text-align: center;
  text-decoration: none;
}

.video-list-details {
  margin-top: 12px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.video-list-details summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 0.9rem;
}

.video-list-details__body {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.video-list-details__body video {
  width: min(100%, 560px);
  max-height: 320px;
  border-radius: 14px;
  background: #000;
  object-fit: contain;
}

.power-panel {
  display: grid;
  gap: 16px;
}

.device-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
}

.device-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.status-header,
.section-heading {
  align-items: start;
}

.status-pill-group {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.status-pill {
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel-solid);
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 600;
}

.power-state {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel-solid);
  font-size: 0.92rem;
  font-weight: 700;
}

.power-state-enabled {
  color: #0d8f6f;
  border-color: rgba(13, 143, 111, 0.25);
  background: rgba(13, 143, 111, 0.12);
}

.power-state-disabled {
  color: #c46b1d;
  border-color: rgba(196, 107, 29, 0.28);
  background: rgba(196, 107, 29, 0.13);
}

.power-state-unknown {
  color: var(--muted);
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 14px;
  align-items: stretch;
}

.status-card {
  grid-column: span 4;
  padding: 16px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, var(--panel-solid), rgba(255, 255, 255, 0.02));
  min-height: 156px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.status-card--wide {
  grid-column: span 6;
}

.status-card--compact {
  grid-column: span 4;
}

.power-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 0.9fr);
  gap: 16px;
  align-items: center;
  padding: 16px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, var(--panel-solid), rgba(255, 255, 255, 0.02));
}

.power-label {
  display: block;
  color: var(--muted);
  margin-bottom: 6px;
}

.power-summary strong {
  font-size: 1.4rem;
}

.status-card span,
.status-card small {
  display: block;
}

.status-card span,
.status-card small {
  color: var(--muted);
}

.status-card strong {
  display: block;
  font-size: 1.35rem;
  margin: 8px 0 10px;
}

.device-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.field-span-2 {
  grid-column: 1 / -1;
}

.device-form label:not(.checkbox-row) {
  display: grid;
  gap: 6px;
}

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

.checkbox-row input {
  width: auto;
}

.device-table {
  min-width: 0;
}

.device-table th:last-child,
.device-table td:last-child {
  text-align: right;
}

.table-action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.device-log {
  display: grid;
  gap: 8px;
}

.device-log-entry {
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--panel-solid);
  border: 1px solid var(--line);
  font-size: 0.92rem;
}

.device-log-error {
  border-color: rgba(191, 91, 39, 0.45);
  color: var(--warn);
}

@media (min-width: 768px) {
  .ride-detail-page {
    gap: 24px;
  }

  .ride-overview-panel {
    padding: 24px;
  }

  .ride-plot-panel {
    padding: 24px;
  }

  .plot--xl {
    min-height: 520px;
  }
}

@media (min-width: 1200px) {
  .ride-detail-page {
    gap: 26px;
  }

  .ride-header {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 24px;
  }

  .ride-header-actions {
    align-items: start;
    justify-content: flex-end;
  }

  .ride-header-actions .power-upload-form {
    flex-wrap: nowrap;
  }

  .ride-summary-table-wrap {
    margin-top: 18px;
  }

  .ride-review-main--video-active {
    grid-template-columns: minmax(0, 1fr) minmax(360px, 0.75fr);
    gap: 16px;
    height: clamp(560px, 62vh, 700px);
    align-items: stretch;
  }

  .ride-review-main--video-active .ride-video-layout {
    height: 100%;
    min-height: 0;
  }

  .ride-review-main--video-active .ride-video-frame {
    min-height: 0;
    align-content: start;
  }

  .ride-review-main--video-active .ride-plot-frame,
  .ride-review-main--video-active .ride-video-layout {
    height: 100%;
    min-height: 0;
  }

  .ride-review-main--video-active #ride-video-player {
    min-height: 0;
    max-height: 100%;
  }

  .ride-review-main--video-active #ride-plot.plot--xl {
    min-height: 100%;
    height: 100%;
  }

  .ride-plot-panel:not(.ride-plot-panel--video-active) #ride-plot.plot--xl {
    min-height: 620px;
  }

  .ride-samples-panel {
    padding: 24px;
  }
}

@media (min-width: 1440px) {
  .ride-detail-body main.wrap {
    width: min(100% - 40px, 1760px);
  }

  .ride-review-main--video-active {
    grid-template-columns: minmax(0, 1fr) minmax(400px, 0.82fr);
    height: clamp(580px, 64vh, 720px);
  }

  .ride-review-main--video-active #ride-plot.plot--xl {
    min-height: 100%;
  }
}

@media (max-width: 720px) {
  .header-row {
    align-items: stretch;
    flex-direction: column;
  }

  .brand {
    font-size: 1.6rem;
  }

  .panel {
    padding: 16px;
  }

  .theme-toggle {
    width: 100%;
  }

  .device-hero,
  .ride-header,
  .status-header,
  .section-heading,
  .inline-actions,
  .device-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .ride-header {
    grid-template-columns: 1fr;
  }

  .ride-overview-panel,
  .ride-plot-panel,
  .ride-samples-panel {
    width: 100%;
  }

  .ride-plot-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .axis-control {
    min-width: 0;
    width: 100%;
  }

  .ride-header-actions {
    justify-content: stretch;
  }

  .ride-summary-table th,
  .ride-summary-table td {
    display: block;
    width: auto;
  }

  .ride-summary-table tr {
    display: grid;
    grid-template-columns: 1fr;
  }

  .imported-data-button {
    width: 100%;
    min-width: 0;
  }

  .plot--xl {
    min-height: 520px;
  }

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

  .record-video-grid,
  .ride-video-layout {
    grid-template-columns: 1fr;
  }

  .record-video-body .site-nav,
  .record-video-body .theme-toggle {
    display: none;
  }

  .record-video-body .site-header {
    padding-bottom: 0;
  }

  .record-video-body main.wrap {
    width: 100vw;
  }

  .record-video-stage {
    min-height: calc(100dvh - 52px);
    border-radius: 0;
  }

  .record-video-overlay {
    padding-inline: calc(var(--record-left-pad) + 2px) calc(var(--record-right-pad) + 2px);
  }

  .record-video-top-actions {
    gap: 8px;
  }

  .record-video-top-left {
    gap: 8px;
  }

  .record-video-pill {
    font-size: 0.82rem;
    padding-inline: 12px;
  }

  .record-video-timer {
    min-width: 78px;
    font-size: 1rem;
  }

  .record-video-review__meta {
    grid-template-columns: 1fr;
  }

  .record-video-status-list div {
    grid-template-columns: 1fr;
  }

  .record-video-review__actions > * {
    flex-basis: 100%;
  }

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

  .power-summary {
    grid-template-columns: 1fr;
  }

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

  .status-card,
  .status-card--wide,
  .status-card--compact {
    grid-column: span 1;
    min-height: 142px;
  }

  .device-form {
    grid-template-columns: 1fr;
  }

  .field-span-2 {
    grid-column: auto;
  }

  .status-pill-group {
    justify-content: flex-start;
  }

  .device-table th:last-child,
  .device-table td:last-child,
  .table-action-row {
    text-align: left;
    justify-content: flex-start;
  }

  .ride-samples-header,
  .videos-panel-header,
  .video-list-row {
    flex-direction: column;
    align-items: stretch;
  }

  .video-list-actions {
    flex-direction: row;
    flex-wrap: wrap;
  }
}

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

  .record-video-nav-button {
    padding-inline: 13px;
  }

  .record-video-drawer,
  .record-video-review {
    max-height: min(78dvh, 760px);
  }
}

@media (orientation: portrait) and (max-width: 900px) {
  .record-video-control-row {
    min-height: 124px;
  }
}

@media (orientation: landscape) and (max-width: 980px) {
  .record-video-stage {
    min-height: calc(100dvh - 44px);
  }

  .record-video-overlay--bottom {
    flex-direction: row;
    align-items: end;
    justify-content: space-between;
  }

  .record-video-status-stack {
    max-width: 44%;
  }

  .record-video-control-row {
    min-height: 0;
    justify-content: flex-end;
  }

  .record-video-trigger {
    width: 84px;
    height: 84px;
  }

  .record-video-drawer,
  .record-video-review {
    left: auto;
    width: min(420px, 42vw);
    top: 0;
    bottom: 0;
    border-top-left-radius: 24px;
    border-top-right-radius: 0;
    border-bottom-left-radius: 24px;
    max-height: none;
  }
}

.record-video-body--immersive .site-header,
.record-video-body--immersive .flash-stack {
  display: none;
}

.record-video-body--immersive main.wrap {
  width: 100dvw;
  width: 100vw;
  max-width: none;
  padding: 0;
  margin: 0;
  overflow: hidden;
}

.record-video-body--immersive .record-video-stage {
  position: fixed;
  inset: 0;
  z-index: 2000;
  width: 100dvw;
  width: 100vw;
  height: 100dvh;
  height: 100vh;
  min-height: 100dvh;
  min-height: 100vh;
  border-radius: 0;
  overscroll-behavior: none;
}
