:root {
  --bg: #0b0f14;
  --bg-soft: #0f151c;
  --panel: #121a23;
  --panel-2: #17212c;
  --line: #263342;
  --line-soft: rgba(255, 255, 255, 0.055);
  --text: #e6edf3;
  --muted: #8b98a9;
  --accent: #58a6ff;
  --warn: #d29922;
  --danger: #f85149;
  --radius: 0;
  --build: "0.001 · 2026-12-05 03:18";
  --label-width: 122px;
  --control-height: 19px;
  --row-height: 135px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background:
    radial-gradient(1200px 600px at 20% -10%, rgba(88, 166, 255, 0.12), transparent 60%),
    radial-gradient(900px 500px at 100% 0%, rgba(63, 185, 80, 0.08), transparent 55%),
    var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
}

button,
input {
  font: inherit;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 4px 22px;
  background: rgba(11, 15, 20, 0.82);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 0;
  background: linear-gradient(135deg, #1f6feb, #58a6ff);
  color: #fff;
  font-size: 12px;
  box-shadow: 0 6px 18px rgba(31, 111, 235, 0.35);
}

.status {
  display: flex;
  align-items: baseline;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}

.build {
  color: #667486;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.page {
  width: 100%;
  margin: 0 auto;
  padding: 4px 20px 70px;
}

.notice {
  margin-bottom: 16px;
  padding: 12px 14px;
  border: 1px solid rgba(210, 153, 34, 0.45);
  border-radius: 0;
  background: rgba(210, 153, 34, 0.1);
  color: #f0c674;
}

.toolbar {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
  margin-bottom: 16px;
}

.date-nav {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: var(--control-height);
  min-height: var(--control-height);
  max-height: var(--control-height);
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--panel-2);
  color: var(--text);
  cursor: pointer;
  line-height: 1;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}

.btn:hover {
  border-color: #3a4c61;
  background: #1c2836;
}

.btn:active {
  transform: translateY(1px);
}

.btn:focus-visible,
.date-input:focus-visible,
.clip:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.btn-icon {
  width: 38px;
  padding: 0;
  font-size: 16px;
  line-height: 1;
}

.zoom-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.zoom-label,
.date-label {
  flex: 0 0 86px;
  width: 86px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.zoom {
  display: flex;
  align-items: center;
  gap: 6px;
}

.zoom-btn {
  padding: 0 11px;
  font-variant-numeric: tabular-nums;
}

.zoom-btn.is-active {
  border-color: var(--accent);
  background: rgba(88, 166, 255, 0.16);
  color: #cfe6ff;
}

.zoom-sep {
  width: 1px;
  height: var(--control-height);
  margin: 0 2px;
  background: var(--line);
}

.zoom-toggle {
  gap: 7px;
}

.zoom-toggle-dot {
  width: 8px;
  height: 8px;
  border: 1px solid var(--muted);
  border-radius: 0;
  background: transparent;
  transition: background 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.zoom-toggle.is-active .zoom-toggle-dot {
  border-color: var(--accent);
  background: var(--accent);
  box-shadow: 0 0 7px rgba(88, 166, 255, 0.8);
}

.date-input {
  height: var(--control-height);
  min-height: var(--control-height);
  max-height: var(--control-height);
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--panel-2);
  color: var(--text);
  color-scheme: inherit;
  line-height: 1;
  white-space: nowrap;
}

.date-input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.date-field {
  display: inline-flex;
  position: relative;
}

.date-display {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.date-picker-icon {
  font-size: 13px;
  line-height: 1;
}

.date-picker-native {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: 0;
  border: 0;
  opacity: 0;
  pointer-events: none;
}

.legend {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-left: auto;
  color: var(--muted);
  font-size: 13px;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.legend-dot {
  width: 9px;
  height: 9px;
  border-radius: 0;
  background: var(--dot-color);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--dot-color) 18%, transparent);
}

.timeline-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 0;
  background: linear-gradient(180deg, var(--panel), var(--bg-soft));
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.28);
}

.timeline-title {
  margin: 0;
  font-size: 19px;
  line-height: 1.2;
}

.toolbar-meta {
  margin-left: 4px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.timeline-body {
  display: grid;
  grid-template-columns: var(--label-width) minmax(0, 1fr);
  align-items: stretch;
}

.timeline-labels {
  position: relative;
  z-index: 5;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, var(--panel), var(--bg-soft));
}

.ruler-corner {
  flex: 0 0 36px;
  height: 36px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.015);
}

.labels {
  display: flex;
  flex-direction: column;
}

.timeline-scroll {
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-color: #31445a transparent;
  scrollbar-width: auto;
}

.timeline-scroll::-webkit-scrollbar {
  height: 16px;
}

.timeline-scroll::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.03);
}

.timeline-scroll::-webkit-scrollbar-thumb {
  border: 4px solid transparent;
  border-radius: 0;
  background: #31445a;
  background-clip: padding-box;
}

.timeline-scroll::-webkit-scrollbar-thumb:hover {
  background: #3d5570;
  background-clip: padding-box;
}

.timeline-inner {
  width: var(--timeline-width, 2160px);
  min-width: 100%;
}

.ruler {
  position: relative;
  width: 100%;
  height: 36px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.015);
}

.ruler-tick {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--line-soft);
  z-index: 3;
}

.ruler-tick span {
  position: absolute;
  top: 10px;
  left: 0;
  transform: translateX(-50%);
  color: var(--muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.ruler-tick-sub {
  top: 50%;
  bottom: auto;
  height: 50%;
}

.break-line {
  position: absolute;
  top: 0;
  height: 100%;
  z-index: 6;
  width: 0;
  border-left: 1px dashed rgba(210, 153, 34, 0.95);
  pointer-events: none;
}

.break-line::before,
.break-line::after {
  content: "";
  position: absolute;
  left: -3px;
  width: 7px;
  height: 7px;
  border-left: 1px solid rgba(139, 152, 169, 0.85);
  border-right: 1px solid rgba(139, 152, 169, 0.85);
}

.break-line::before {
  top: 0;
  transform: skewX(-30deg);
}

.break-line::after {
  bottom: 0;
  transform: skewX(-30deg);
}

.break-mark {
  position: absolute;
  top: 0;
  height: 100%;
  width: 0;
  border-left: 1px dashed rgba(210, 153, 34, 0.9);
  z-index: 5;
}

.active-band {
  position: absolute;
  top: 0;
  height: 100%;
  min-width: 3px;
  background: #2a3440;
}

.plus-band {
  position: absolute;
  top: 0;
  height: 100%;
  background: #2a3440;
  z-index: 2;
}

.plus-gap {
  position: absolute;
  top: 0;
  height: 100%;
  background: transparent;
  z-index: 1;
  border-left: 1px dashed rgba(210, 153, 34, 0.9);
  border-right: 1px dashed rgba(210, 153, 34, 0.9);
}

.ruler:not(.smart) .ruler-tick:last-child span {
  transform: translateX(-100%);
}

.ruler-tick-start span {
  transform: translateX(0);
}

.ruler-tick-end span {
  transform: translateX(-100%);
}

.ruler.smart-plus .ruler-tick-plus-start span {
  top: 4px;
  transform: translateX(0);
}

.ruler.smart-plus .ruler-tick-plus-end {
  background: transparent;
}

.ruler.smart-plus .ruler-tick-plus-end span {
  top: 20px;
  transform: translateX(-100%);
}

.rows {
  position: relative;
}

.camera-row {
  height: var(--row-height);
  border-bottom: 1px solid var(--line);
}

.camera-label {
  display: flex;
  flex: 0 0 var(--row-height);
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  height: var(--row-height);
  padding: 8px 12px;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.camera-name {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  font-weight: 650;
  font-size: 13px;
  white-space: nowrap;
}

.camera-name span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
}

.camera-dot {
  width: 8px;
  height: 8px;
  border-radius: 0;
  background: var(--dot-color);
  flex: 0 0 auto;
}

.camera-count {
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.camera-codec {
  overflow: hidden;
  color: #667486;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.track {
  position: relative;
  height: 100%;
  background-image: repeating-linear-gradient(
      to right,
      rgba(255, 255, 255, 0.045) 0,
      rgba(255, 255, 255, 0.045) 1px,
      transparent 1px,
      transparent var(--grid-step, 4.1667%)
    );
  background-size: 100% 100%;
  background-position: left top;
  background-repeat: repeat-x;
}

.timeline-inner.smart-plus .track {
  background-image: none;
}

.track-empty {
  position: absolute;
  top: 50%;
  left: 16px;
  transform: translateY(-50%);
  color: #667486;
  font-size: 12px;
  pointer-events: none;
}

.clip {
  position: absolute;
  top: var(--clip-top, 0);
  height: 35px;
  min-width: 3px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 0;
  background: var(--clip-color, var(--accent));
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.28);
  cursor: pointer;
  transition: transform 0.12s ease, filter 0.12s ease, box-shadow 0.12s ease;
}

.clip:hover,
.clip:focus-visible {
  z-index: 6;
  transform: translateY(-2px);
  filter: brightness(1.16);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.4);
}

.clip.hevc {
  border-color: rgba(210, 153, 34, 0.8);
}

.empty {
  margin: 22px 0 0;
  color: var(--muted);
  text-align: center;
}

.player-dialog {
  width: min(1040px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--bg-soft);
  color: var(--text);
  box-shadow: 0 30px 100px rgba(0, 0, 0, 0.65);
}

.player-dialog::backdrop {
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(4px);
}

.player-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.player-titles {
  min-width: 0;
}

.player-titles h2 {
  margin: 0;
  overflow: hidden;
  font-size: 17px;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-meta {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.video-wrap {
  background: #000;
}

.player-dialog video {
  display: block;
  width: 100%;
  max-height: 70vh;
  background: #000;
}

.player-footer {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  border-top: 1px solid var(--line);
}

.hint {
  color: var(--muted);
  font-size: 12px;
}

@media (max-width: 700px) {
  :root {
    --label-width: 104px;
  }

  .topbar {
    padding: 12px 14px;
  }

  .page {
    padding: 18px 12px 50px;
  }

  .legend {
    margin-left: 0;
  }

  .camera-label {
    padding: 8px;
  }

  .camera-name {
    font-size: 12px;
  }

  .player-dialog {
    width: calc(100vw - 16px);
    max-height: calc(100vh - 16px);
  }

  .player-header,
  .player-footer {
    padding: 12px;
  }

  .player-titles h2 {
    font-size: 15px;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}

/* --- Theme: dunkel (Standard) / hell ------------------------------------- */
html {
  color-scheme: dark;
}

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

html[data-theme="light"] {
  color-scheme: light;
  --bg: #f3f5f8;
  --bg-soft: #e9edf2;
  --panel: #ffffff;
  --panel-2: #f0f3f7;
  --line: #d0d7e0;
  --line-soft: rgba(0, 0, 0, 0.06);
  --text: #1a2330;
  --muted: #5c6b7e;
  --accent: #0969da;
  --warn: #9a6700;
  --danger: #cf222e;
}

html[data-theme="light"] body {
  background:
    radial-gradient(1200px 600px at 20% -10%, rgba(9, 105, 218, 0.07), transparent 60%),
    radial-gradient(900px 500px at 100% 0%, rgba(46, 160, 67, 0.06), transparent 55%),
    var(--bg);
}

html[data-theme="light"] .topbar {
  background: rgba(255, 255, 255, 0.85);
}

html[data-theme="light"] .zoom-btn.is-active {
  border-color: var(--accent);
  background: rgba(9, 105, 218, 0.14);
  color: #0550ae;
}

html[data-theme="light"] .zoom-btn.is-active .zoom-toggle-dot {
  background: var(--accent);
  border-color: var(--accent);
}

html[data-theme="light"] .plus-band {
  background: #d7dde5;
}

html[data-theme="light"] .track {
  background-image: repeating-linear-gradient(
    to right,
    rgba(0, 0, 0, 0.07) 0,
    rgba(0, 0, 0, 0.07) 1px,
    transparent 1px,
    transparent var(--grid-step, 4.1667%)
  );
}

html[data-theme="light"] .timeline-card {
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.12);
}

html[data-theme="light"] .ruler-corner {
  background: rgba(0, 0, 0, 0.03);
}

html[data-theme="light"] .timeline-scroll {
  scrollbar-color: #9aa7b8 transparent;
}

html[data-theme="light"] .timeline-scroll::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.05);
}

html[data-theme="light"] .timeline-scroll::-webkit-scrollbar-thumb {
  background: #9aa7b8;
  background-clip: padding-box;
}

html[data-theme="light"] .timeline-scroll::-webkit-scrollbar-thumb:hover {
  background: #7c8ba0;
  background-clip: padding-box;
}
