:root {
  --bg: #f3f4f6;            /* gray-100 */
  --card: #ffffff;
  --surface: #ffffff;
  --surface2: #f9fafb;
  --surface3: #f3f4f6;
  --border: #e5e7eb;        /* gray-200 */
  --border2: #d1d5db;       /* gray-300 */
  --text: #111827;          /* gray-900 */
  --muted: #6b7280;         /* gray-500 */
  --muted2: #374151;        /* gray-700 */

  --accent: #ea580c;        /* orange-600 */
  --accentHover: #9a3412;   /* orange-800 */
  --accentRgb: 234, 88, 12;
  --accentSoft: #ffedd5;    /* orange-100 */
  --accentSoft2: #fff7ed;   /* orange-50 */

  --ok: #16a34a;            /* green-600 */
  --okHover: #166534;       /* green-800 */

  --bad: #e11d48;           /* rose-600 */
  --badHover: #9f1239;      /* rose-800 */

  --shadow: 0 10px 18px rgba(0, 0, 0, 0.08), 0 2px 6px rgba(0, 0, 0, 0.05);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.06);

  --radius: 14px;
}

:root[data-theme="dark"] {
  --bg: #0b1220;
  --card: #111827;
  --surface: #111827;
  --surface2: #1f2937;
  --surface3: #0f172a;
  --border: #334155;
  --border2: #475569;
  --text: #e5e7eb;
  --muted: #94a3b8;
  --muted2: #cbd5e1;
  --accentSoft: rgba(251, 146, 60, 0.16);
  --accentSoft2: rgba(251, 146, 60, 0.11);
  --shadow: 0 10px 20px rgba(0, 0, 0, 0.35), 0 2px 8px rgba(0, 0, 0, 0.28);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
}

:root[data-accent="orange"] {
  --accent: #ea580c;
  --accentHover: #9a3412;
  --accentRgb: 234, 88, 12;
  --accentSoft: #ffedd5;
  --accentSoft2: #fff7ed;
}

:root[data-accent="blue"] {
  --accent: #2563eb;
  --accentHover: #1e3a8a;
  --accentRgb: 37, 99, 235;
  --accentSoft: #dbeafe;
  --accentSoft2: #eff6ff;
}

:root[data-accent="green"] {
  --accent: #15803d;
  --accentHover: #14532d;
  --accentRgb: 21, 128, 61;
  --accentSoft: #dcfce7;
  --accentSoft2: #f0fdf4;
}

:root[data-accent="red"] {
  --accent: #dc2626;
  --accentHover: #991b1b;
  --accentRgb: 220, 38, 38;
  --accentSoft: #fee2e2;
  --accentSoft2: #fef2f2;
}

:root[data-theme="dark"][data-accent="orange"] {
  --accentSoft: rgba(251, 146, 60, 0.16);
  --accentSoft2: rgba(251, 146, 60, 0.11);
}

:root[data-theme="dark"][data-accent="blue"] {
  --accentSoft: rgba(96, 165, 250, 0.16);
  --accentSoft2: rgba(96, 165, 250, 0.11);
}

:root[data-theme="dark"][data-accent="green"] {
  --accentSoft: rgba(74, 222, 128, 0.16);
  --accentSoft2: rgba(74, 222, 128, 0.11);
}

:root[data-theme="dark"][data-accent="red"] {
  --accentSoft: rgba(248, 113, 113, 0.16);
  --accentSoft2: rgba(248, 113, 113, 0.11);
}

* {
  box-sizing: border-box;
  max-width: 100%;
}

html, body {
  height: 100%;
  width: 100%;
  margin: 0;
  overflow-x: hidden;
  color: var(--text);
  background: var(--bg);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
    'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: inherit;
  text-decoration: none;
}

a:hover {
  color: var(--accentHover);
}

code, pre, .mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono',
    'Courier New', monospace;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--card);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.topbarInner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  position: relative;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  min-width: 0;
}

.logo {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: none;
  background: transparent;
}

.logo img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

.title {
  font-size: 16px;
  font-weight: 900;
  letter-spacing: 0.2px;
}

.subtitle {
  font-size: 12px;
  color: var(--muted);
  margin-top: 1px;
}

.nav {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
}

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

.themeDrop {
  position: relative;
}

.themeDrop > summary {
  list-style: none;
  padding: 7px 10px;
  border-radius: 999px;
  border: 1px solid var(--border2);
  background: var(--surface);
  color: var(--muted2);
  box-shadow: var(--shadow-sm);
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  user-select: none;
}

.themeDrop > summary::-webkit-details-marker {
  display: none;
}

.themeMenu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 40;
  width: 230px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--card);
  box-shadow: var(--shadow);
  display: grid;
  gap: 8px;
}

.themeDrop:not([open]) .themeMenu {
  display: none;
}

.themeMenu label {
  display: grid;
  gap: 6px;
  color: var(--muted2);
  font-size: 12px;
  font-weight: 800;
}

.themeMenu select {
  width: 100%;
}

.hamburger {
  display: none;
  width: 42px;
  height: 42px;
  padding: 0;
  border-radius: 12px;
  border: 1px solid var(--border2);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 4px;
}

.hamburger span {
  width: 18px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  display: block;
  transition: transform 120ms ease-out, opacity 120ms ease-out;
}

.topbar.navOpen .hamburger span:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}

.topbar.navOpen .hamburger span:nth-child(2) {
  opacity: 0;
}

.topbar.navOpen .hamburger span:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

.nav a {
  padding: 8px 10px;
  border-radius: 12px;
  border: 2px solid transparent;
  color: var(--muted2);
  transition: background 120ms ease-out, border-color 120ms ease-out, color 120ms ease-out;
}

.nav a:hover {
  background: var(--surface2);
  color: var(--accentHover);
}

.nav a.active {
  background: var(--accentSoft);
  color: var(--accent);
  border-color: var(--accent);
}

.status {
  padding: 7px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface2);
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

.main {
  padding: 16px;
  max-width: 1280px;
  margin: 0 auto;
}

.page {
  display: none;
  animation: fadeIn 150ms ease-out;
}

.page.active {
  display: block;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.pageHead {
  margin-bottom: 14px;
}

.pageHead h1 {
  margin: 0;
  font-size: 26px;
  font-weight: 900;
  color: var(--text);
}

.subhead {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.card, .panel {
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
}

.cards .card .k {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.cards .card .v {
  font-size: 28px;
  font-weight: 900;
  margin-top: 6px;
}

.cards .card:nth-child(1) .v { color: var(--text); }
.cards .card:nth-child(2) .v { color: var(--accent); }
.cards .card:nth-child(3) .v { color: var(--ok); }
.cards .card:nth-child(4) .v { color: var(--bad); }
.cards .card:nth-child(5) .v { color: var(--ok); }
.cards .card:nth-child(6) .v { color: var(--bad); }

.panelHead {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.panelHead h2 {
  margin: 0;
}

.dashHealth {
  margin-bottom: 14px;
}

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

.healthBlock {
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}

.healthK {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.healthV {
  margin-top: 6px;
  font-size: 16px;
  font-weight: 900;
}

.bar {
  position: relative;
  margin-top: 10px;
  height: 20px;
  border-radius: 999px;
  border: 1px solid var(--border2);
  background: linear-gradient(180deg, var(--surface), var(--surface3));
  overflow: hidden;
}

.barFill {
  position: absolute;
  inset: 0 auto 0 0;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accentHover));
  transition: width 220ms ease-out;
}

.barText {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.2px;
  color: var(--text);
  text-shadow: 0 1px 0 var(--surface);
  pointer-events: none;
}

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

h2 {
  margin: 0 0 10px 0;
  font-size: 16px;
  font-weight: 900;
  color: var(--text);
}

.list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.list .row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  transition: background 120ms ease-out, border-color 120ms ease-out;
}

.list .row:hover {
  background: var(--surface2);
  border-color: var(--border2);
}

.list .row .left {
  display: flex;
  gap: 10px;
  align-items: center;
  min-width: 0;
}

.cameraRow {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto auto;
  gap: 8px;
  width: 100%;
  justify-content: stretch;
}

.cameraRow.cameraRowModelError {
  border-color: rgba(225, 29, 72, 0.5);
  box-shadow: inset 0 0 0 1px rgba(225, 29, 72, 0.25);
}

.cameraRow .camLine {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  gap: 12px;
  align-items: center;
  width: 100%;
  min-width: 0;
}

.cameraRow .camLine.camLineTop {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  gap: 12px;
  align-items: start;
  min-width: 0;
}

.cameraRow .camLine.camLineTop > .camTopMain,
.cameraRow .camLine.camLineTop > .camTopMeta,
.cameraRow .camLine.camLineTop > .camTopInfo {
  grid-column: 1;
  min-width: 0;
}

.cameraRow .camLine.camLineTop > .camActions {
  grid-column: 2;
  justify-self: end;
  align-self: flex-start;
  margin-left: 0;
}

.camTopMain {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 6px;
  min-width: 0;
}

.camTopMeta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  row-gap: 6px;
  align-items: center;
  min-width: 0;
  overflow: visible;
}

.camTopMeta > * {
  flex: 0 0 auto;
}

.camTopInfo {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  min-width: 0;
}

.camTopInfo .pill {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.camSerialPill {
  white-space: nowrap;
}

.camAddrPill {
  max-width: clamp(140px, 18vw, 220px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.camSocPill {
  max-width: clamp(90px, 11vw, 140px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.camNamePill {
  max-width: clamp(130px, 16vw, 210px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.camLocPill {
  max-width: clamp(120px, 15vw, 190px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.camActions {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 24px;
  gap: 8px;
  align-items: center;
  align-self: center;
  justify-self: end;
  justify-content: flex-end;
  justify-items: center;
  margin-left: auto;
}

.camActions > button {
  width: 24px;
  height: 24px;
  margin: 0;
  padding: 0;
}

.camLineBottom {
  grid-template-columns: minmax(0, 1fr) max-content;
  align-items: center;
}

.camFields {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 8px;
  align-items: center;
  min-width: 0;
}

.camCounts {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
}

.camSnapshot {
  border: 1px dashed var(--border2);
  border-radius: 12px;
  background: var(--accentSoft2);
  padding: 12px;
  display: grid;
  gap: 10px;
}

.camSnapshotHead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.camSnapshotStage {
  position: relative;
  width: 100%;
  max-width: 860px;
}

.camSnapshotCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.camRulesPanel {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: linear-gradient(180deg, #ffffff 0%, #fff8f2 100%);
  box-shadow: var(--shadow-sm);
  padding: 10px;
  display: grid;
  gap: 9px;
}

.camRulesHead {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.camRulesTitle {
  font-size: 12px;
  font-weight: 900;
  color: var(--muted2);
}

.camRuleBlock {
  display: grid;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}

.camRuleRow {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.camRuleName {
  min-width: 110px;
  color: var(--muted2);
  font-size: 12px;
  font-weight: 900;
}

.camClassList {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 6px 10px;
  max-height: 170px;
  overflow: auto;
  padding: 6px 2px 2px;
}

.camClassItem {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted2);
}

.camRoiHelp {
  font-size: 12px;
}

.camBboxHelp {
  font-size: 12px;
}

.camTimeList {
  display: grid;
  gap: 8px;
}

.camTimeRow {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto auto;
  gap: 8px;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface2);
  padding: 8px;
}

.camTimeDays {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.camTimeDay {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #ffffff;
  color: var(--muted2);
  font-size: 12px;
  font-weight: 800;
}

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

.camTimeInput {
  border: 1px solid var(--border2);
  border-radius: 10px;
  padding: 4px 6px;
  font-size: 12px;
  color: var(--text);
  background: #ffffff;
}

.camTimeHelp {
  font-size: 12px;
}

.camInlineField {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted2);
  font-size: 12px;
  font-weight: 800;
}

.camInlineField input {
  width: 82px;
  padding: 4px 6px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font-size: 12px;
}

.camSnapshotActionStatus {
  min-height: 18px;
}

.camClassStatus {
  width: 100%;
}

.camTimeStatus {
  width: 100%;
}

.camSnapAuth {
  border: 1px dashed var(--border2);
  border-radius: 12px;
  background: var(--surface2);
  padding: 10px;
}

.camSnapAuthHead {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.camSnapAuthTitle {
  font-size: 12px;
  font-weight: 900;
  color: var(--muted2);
}

.camSnapAuthFields {
  display: grid;
  grid-template-columns: repeat(3, minmax(140px, 1fr));
  gap: 8px;
}

.camSnapshotStatus {
  margin-bottom: 8px;
  font-size: 12px;
}

.camSnapshotImg {
  display: block;
  width: 100%;
  max-width: 860px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface3);
  box-shadow: var(--shadow-sm);
}

.camDesc,
.camCategory,
.camAddr,
.camSnapUser,
.camSnapPass {
  width: 100%;
  min-width: 0;
  max-width: none;
  padding: 6px 10px;
  border-radius: 12px;
  font-size: 12px;
}

.camIconBtn {
  appearance: none;
  -webkit-appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: var(--muted2);
  line-height: 1;
  cursor: pointer;
}

.camIconBtn svg {
  width: 24px;
  height: 24px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.camIconBtn i[data-lucide] {
  width: 24px;
  height: 24px;
  display: block;
}

.camStateIcon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  margin: 0;
  padding: 0;
  line-height: 1;
  flex: 0 0 auto;
}

.camStateIcon svg,
.camStateIcon i[data-lucide] {
  width: 24px;
  height: 24px;
  display: block;
}

.camStateIcon.is-online {
  color: var(--ok);
}

.camStateIcon.is-offline {
  color: var(--bad);
}

.camStateIcon.is-collecting {
  color: var(--ok);
}

.camStateIcon.is-paused {
  color: var(--bad);
}

.camStateIcon.is-model-ok {
  color: var(--ok);
}

.camStateIcon.is-model-error {
  color: var(--bad);
}

.camStateIcon.is-model-pending {
  color: var(--accent);
}

.camStateIcon.is-model-unknown {
  color: var(--muted2);
}

.camStateIcon.is-collecting svg,
.camStateIcon.is-collecting i[data-lucide] {
  animation: camStateSpin 1.1s linear infinite;
  transform-origin: center;
}

.camStateIcon.is-model-pending svg,
.camStateIcon.is-model-pending i[data-lucide] {
  animation: camStateSpin 1.1s linear infinite;
  transform-origin: center;
}

.camMiniBtn {
  appearance: none;
  -webkit-appearance: none;
  width: 24px;
  height: 24px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: var(--muted2);
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.camMiniBtn svg,
.camMiniBtn i[data-lucide] {
  width: 24px;
  height: 24px;
  display: block;
}

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

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

.camIconBtn:focus-visible {
  outline: 2px solid rgba(var(--accentRgb), 0.55);
  outline-offset: 3px;
}

.camMiniBtn:focus-visible {
  outline: 2px solid rgba(var(--accentRgb), 0.55);
  outline-offset: 3px;
}

.camIconBtn:disabled,
.camMiniBtn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.camToggleBtn.is-collecting {
  color: var(--ok);
}

.camToggleBtn.is-paused {
  color: var(--bad);
}

.camDeployBtn {
  color: var(--accent);
}

.camSimBtn {
  color: var(--ok);
}

.camClearBtn {
  color: var(--muted2);
}

.camResetBtn {
  color: var(--bad);
}

.camToggleBtn.is-collecting:hover,
.camToggleBtn.is-paused:hover {
  color: inherit;
}

.camDeployBtn:hover,
.camClearBtn:hover,
.camResetBtn:hover {
  color: inherit;
}

@keyframes camStateSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.camFields .pill {
  white-space: nowrap;
}

.camDesc:focus,
.camCategory:focus,
.camAddr:focus,
.camSnapUser:focus,
.camSnapPass:focus,
.sysCamUser:focus,
.sysCamPass:focus {
  outline: none;
  border-color: rgba(var(--accentRgb), 0.55);
  box-shadow: 0 0 0 3px rgba(var(--accentRgb), 0.14);
}

.camModel {
  display: inline-block;
  max-width: 100%;
  flex: 0 1 auto;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.exportMeta {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

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

.exportSub {
  font-size: 12px;
}

.exportSub b {
  color: var(--muted2);
}

.pill {
  padding: 3px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 12px;
  color: var(--muted2);
  background: var(--surface2);
}

.pill.ok {
  border-color: rgba(22, 163, 74, 0.35);
  background: rgba(22, 163, 74, 0.10);
  color: var(--okHover);
}

.pill.bad {
  border-color: rgba(225, 29, 72, 0.35);
  background: rgba(225, 29, 72, 0.08);
  color: var(--badHover);
}

.pill.neutral {
  border-color: rgba(107, 114, 128, 0.35);
  background: rgba(107, 114, 128, 0.08);
  color: var(--muted2);
}

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

.toolbar {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 12px;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: end;
}

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted2);
}

/* Multi-select dropdown (used for camera filters) */
.multiDrop {
  position: relative;
  width: 100%;
  min-width: 220px;
}

.multiDrop > summary {
  padding: 9px 10px;
  border-radius: 12px;
  border: 1px solid var(--border2);
  background: var(--surface);
  color: var(--text);
  outline: none;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  user-select: none;
}

.multiDrop > summary:focus {
  border-color: rgba(var(--accentRgb), 0.55);
  box-shadow: 0 0 0 4px rgba(var(--accentRgb), 0.15);
}

.multiDrop > summary::-webkit-details-marker {
  display: none;
}

.multiDrop .multiMenu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 320px;
  max-width: 460px;
  max-height: 360px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 10px;
  z-index: 50;
}

.multiDrop:not([open]) .multiMenu {
  display: none;
}

.multiBtns {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-bottom: 8px;
}

.multiList {
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow: auto;
  max-height: 280px;
  padding-right: 4px;
}

.multiItem {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 800;
  color: var(--muted2);
}

.multiItem span {
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.multiItem:hover {
  background: var(--surface2);
}

.multiItem input[type="checkbox"] {
  transform: scale(1.05);
}

select, input, textarea {
  padding: 9px 10px;
  border-radius: 12px;
  border: 1px solid var(--border2);
  background: var(--surface);
  color: var(--text);
  outline: none;
  box-shadow: var(--shadow-sm);
}

input[type="range"] {
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.form-check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.form-check-input {
  width: 1.1em;
  height: 1.1em;
  margin: 0;
  padding: 0;
  border: 1px solid var(--border2);
  border-radius: 0.25em;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
}

.form-check-input:focus {
  border-color: rgba(var(--accentRgb), 0.55);
  box-shadow: 0 0 0 4px rgba(var(--accentRgb), 0.15);
}

.form-check-input:checked {
  background-color: rgba(var(--accentRgb), 0.95);
  border-color: rgba(var(--accentRgb), 0.95);
}

.form-check-label {
  font-size: 12px;
  font-weight: 800;
  color: var(--muted2);
}

.form-check.form-switch .form-check-input {
  width: 2.15em;
  height: 1.2em;
  border-radius: 999px;
  border-color: var(--border2);
  background-color: #d1d5db;
  background-image: radial-gradient(circle at center, #ffffff 0 47%, transparent 50%);
  background-repeat: no-repeat;
  background-position: 2px center;
  background-size: 0.9em 0.9em;
  transition: background-color 130ms ease-out, border-color 130ms ease-out, background-position 130ms ease-out;
}

.form-check.form-switch .form-check-input:checked {
  border-color: rgba(var(--accentRgb), 0.92);
  background-color: rgba(var(--accentRgb), 0.92);
  background-position: calc(100% - 2px) center;
}

select:focus, input:focus, textarea:focus {
  border-color: rgba(var(--accentRgb), 0.55);
  box-shadow: 0 0 0 4px rgba(var(--accentRgb), 0.15);
}

textarea {
  resize: vertical;
}

.actions {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.actions.actionsSecondary {
  justify-content: flex-start;
}

.inlineControl {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 800;
  color: var(--muted2);
}

.inlineControl input[type="checkbox"] {
  transform: scale(1.1);
}

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

kbd {
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface2);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 12px;
  border-radius: 12px;
  border: 1px solid var(--border2);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: background 120ms ease-out, border-color 120ms ease-out, transform 80ms ease-out;
}

.btn.small {
  padding: 6px 10px;
  font-size: 12px;
}

.btn.btn-sm {
  padding: 5px 10px;
  border-radius: 10px;
  font-size: 12px;
}

.btn.btn-outline-secondary {
  background: var(--surface);
  border-color: var(--border2);
  color: var(--muted2);
}

.btn.btn-outline-secondary:hover {
  background: var(--surface2);
  border-color: var(--border2);
  color: var(--text);
}

.btn.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

.btn:hover {
  background: var(--surface2);
  border-color: var(--border2);
}

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

.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

.btn.primary:hover {
  background: var(--accentHover);
  border-color: var(--accentHover);
}

.btn.ok {
  background: var(--ok);
  border-color: var(--ok);
  color: #ffffff;
}

.btn.ok:hover {
  background: var(--okHover);
  border-color: var(--okHover);
}

.btn.bad {
  background: var(--bad);
  border-color: var(--bad);
  color: #ffffff;
}

.btn.bad:hover {
  background: var(--badHover);
  border-color: var(--badHover);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.labeling {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 12px;
  align-items: start;
}

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

.det {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  min-height: 220px;
  box-shadow: var(--shadow-sm);
  transition: border-color 120ms ease-out, transform 120ms ease-out;
}

.det:hover {
  border-color: rgba(var(--accentRgb), 0.35);
  transform: translateY(-1px);
}

.det.isChecked {
  border-color: rgba(22, 163, 74, 0.55);
  outline: 2px solid rgba(22, 163, 74, 0.18);
}

.det.selected {
  outline: 2px solid rgba(var(--accentRgb), 0.45);
}

.det img {
  width: 100%;
  height: 140px;
  object-fit: cover;
  display: block;
  background: var(--surface3);
}

.det .meta {
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.det .meta .line {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.det .meta .name {
  font-weight: 900;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.det .meta .small {
  font-size: 12px;
  color: var(--muted);
}

.chkRow {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chkRow input {
  transform: scale(1.1);
}

.detail {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.detailHead {
  padding: 12px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.detailTitle {
  font-weight: 900;
}

.detailBtns {
  display: flex;
  gap: 8px;
}

.detailBody {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.imgRow {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.imgLabel {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}

.imgCol img {
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface3);
}

.imgWrap {
  position: relative;
}

.imgWrap canvas {
  display: block;
}

.bbox {
  position: absolute;
  border: 2px solid rgba(var(--accentRgb), 0.95);
  border-radius: 0;
  box-shadow: none;
  pointer-events: none;
  display: none;
}

.imgOverlay {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 2;
  padding: 4px 9px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(17, 24, 39, 0.55);
  color: #ffffff;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.2px;
  pointer-events: none;
}

.notes textarea {
  min-height: 70px;
}

.pager {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

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

.exportRow {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
  align-items: start;
}

.exportReviewPanel .rowActions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

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

.exportReviewQuickRow {
  margin-top: 10px;
  display: grid;
  gap: 8px;
}

.exportReviewQuickClasses {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

#classHotkeyHint {
  font-size: 12px;
}

#eReviewStatus {
  margin-top: 8px;
}

#eClsDeleteStatus {
  margin-top: 8px;
  min-height: 1.25em;
  font-size: 12px;
}

.exportReviewBody {
  margin-top: 10px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  align-items: start;
}

#eReviewCropImg,
#eReviewFullImg {
  width: 100%;
  max-height: 360px;
  object-fit: contain;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface3);
  display: block;
}

.exportReviewWrap {
  position: relative;
}

#eReviewCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border-radius: 12px;
  pointer-events: auto;
  cursor: crosshair;
  touch-action: none;
}

.pickTop {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.pickTitle {
  font-size: 12px;
  font-weight: 900;
  color: var(--muted2);
}

.pickTitleLarge {
  font-size: 16px;
  color: var(--text);
}

.pickBtns {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.pickList {
  min-height: 180px;
  max-height: 240px;
  overflow: auto;
  padding: 8px;
  border-radius: 12px;
  border: 1px solid var(--border2);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.pickItem {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 12px;
  border: 1px solid transparent;
  cursor: pointer;
  user-select: none;
}

.pickItem:hover {
  background: var(--surface2);
  border-color: var(--border);
}

.pickItem input[type="checkbox"] {
  flex: 0 0 auto;
  margin: 0;
  transform: scale(1.05);
}

.pickMeta {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  min-width: 0;
  flex: 1 1 auto;
}

.pickBody {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  flex: 1 1 auto;
}

.pickDescInput {
  width: 100%;
  font-size: 12px;
  padding: 7px 10px;
}

.pickLabel {
  font-size: 12px;
  font-weight: 900;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.sysPickMeta {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 6px;
  width: 100%;
}

.sysPickTop {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(180px, 360px) auto;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.sysPickName {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sysPickDescWrap {
  min-width: 0;
}

.sysPickDescInput {
  width: 100%;
  margin: 0;
}

.sysPickItem {
  align-items: center;
}

.sysPickItem.sysPickItemModelError {
  border-color: rgba(225, 29, 72, 0.35);
  background: rgba(225, 29, 72, 0.04);
}

.sysPickItem > input[type="checkbox"] {
  align-self: center;
}

.sysPickChips {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}

.sysCamAuthBtn {
  flex: 0 0 auto;
}

.sysCamAuth {
  border: 1px dashed var(--border2);
  border-radius: 12px;
  background: var(--surface2);
  padding: 10px;
}

.sysCamAuthHead {
  margin-bottom: 8px;
  font-size: 12px;
  font-weight: 900;
}

.sysCamAuthFields {
  display: grid;
  grid-template-columns: repeat(2, minmax(140px, 1fr));
  gap: 8px;
}

.sysCamUser,
.sysCamPass {
  width: 100%;
  min-width: 0;
  max-width: none;
  padding: 6px 10px;
  border-radius: 12px;
  font-size: 12px;
}

.exportActions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 24px;
}

.exportSplit {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px dashed rgba(var(--accentRgb), 0.35);
  background: var(--accentSoft2);
}

.exportAug {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px dashed var(--border2);
  background: var(--surface2);
  display: grid;
  gap: 8px;
}

.exportAugCropControls {
  display: grid;
  gap: 6px;
}

.exportAugCropControls label {
  display: grid;
  gap: 6px;
  color: var(--muted2);
  font-size: 12px;
  font-weight: 800;
}

.exportSplitControls {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.exportSplitRow {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) 48px;
  gap: 10px;
  align-items: center;
}

.exportSplitK {
  font-size: 12px;
  font-weight: 900;
  color: var(--muted2);
}

.exportSplitV {
  text-align: right;
  font-size: 12px;
  font-weight: 900;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.exportSplitFoot b {
  color: var(--text);
}

.page[data-page="export"] .panel + .panel {
  margin-top: 12px;
}

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

.connectGrid > .card,
.modelGrid > .card {
  min-width: 0;
}

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

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

.pickCard {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
}

.pickCard .pickList {
  flex: 1 1 auto;
  min-height: 0;
}

.page[data-page="system"] .pickCard .pickList {
  max-height: none;
}

.systemResultPanel {
  margin-top: 12px;
  min-width: 0;
}

.systemObsGrid {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

#sysSloJson,
#sysTimelineJson {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x pan-y;
}

#sysSloJson,
#sysTimelineJson,
#sysResultJson {
  min-width: 0;
}

#sysCamNote {
  margin-top: 8px;
}

#sysSloJson,
#sysTimelineJson,
#sysResultJson {
  max-height: 320px;
}

.sysMqttFields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 4px;
  padding: 10px;
  border: 1px dashed var(--border2);
  border-radius: 12px;
  background: var(--surface2);
}

.sysMqttFields > label {
  margin: 0;
}

.rowActions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 10px;
}

.camBulkBar {
  margin-top: 10px;
  margin-bottom: 10px;
}

.camNavBar {
  margin-top: 8px;
  display: grid;
  grid-template-columns: minmax(240px, 1.6fr) repeat(3, minmax(170px, 1fr)) auto;
  gap: 8px;
  align-items: end;
}

.camNavBar > label {
  margin: 0;
}

.camNavBar #camNavStatus {
  grid-column: 1 / -1;
  min-height: 1.2em;
}

.camGroupHeader {
  margin: 4px 0 2px;
  padding: 4px 6px;
  font-size: 12px;
  font-weight: 900;
  color: var(--muted2);
  border-left: 3px solid rgba(var(--accentRgb), 0.45);
}

.camSelect {
  transform: scale(1.05);
}

.deployCamBlock .pickList {
  min-height: 120px;
  max-height: 200px;
}

.warnBox {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid #fecdd3; /* rose-200 */
  background: #fff1f2; /* rose-50 */
  color: #9f1239; /* rose-800 */
  font-size: 13px;
  white-space: pre-wrap;
}

.steps {
  margin: 0 0 12px 18px;
  padding: 0;
  color: var(--muted2);
  font-size: 13px;
}

.steps li {
  margin: 6px 0;
}

.kv {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 10px;
  align-items: center;
  padding: 8px 0;
  border-top: 1px dashed var(--border);
}

.kv:first-of-type {
  border-top: 0;
}

.kv .k {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.kv .v {
  color: var(--muted2);
  font-size: 13px;
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.kv .v code {
  white-space: normal;
}

.callout {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid #fed7aa; /* orange-200 */
  background: var(--accentSoft2);
  color: #9a3412; /* orange-800 */
  font-size: 13px;
}

.code {
  margin: 10px 0;
  background: #111827;
  color: #86efac;
  padding: 12px;
  border-radius: 12px;
  font-size: 12px;
  overflow-x: auto;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
}

.modalBackdrop {
  position: absolute;
  inset: 0;
  background: rgba(17, 24, 39, 0.40);
  backdrop-filter: blur(2px);
}

.modalCard {
  position: relative;
  margin: 6vh auto;
  width: min(760px, calc(100vw - 24px));
  max-height: 88vh;
  overflow: auto;
  padding: 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--card);
  box-shadow: var(--shadow);
}

.modalHead {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.modalTitle {
  font-size: 14px;
  font-weight: 900;
  color: var(--text);
}

.modalBody {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.deploySettingsBox {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px dashed rgba(var(--accentRgb), 0.35);
  background: var(--accentSoft2);
}

.deploySettingsControls {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.deployGroup {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  overflow: hidden;
}

.deployGroup summary {
  cursor: pointer;
  list-style: none;
  padding: 10px 12px;
  font-size: 12px;
  font-weight: 900;
  color: var(--muted2);
  background: var(--surface2);
  border-bottom: 1px solid transparent;
}

.deployGroup[open] summary {
  border-bottom-color: var(--border);
}

.deployGroup summary::-webkit-details-marker {
  display: none;
}

.deployFields {
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.deployField {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}

.deployFieldTall {
  align-items: start;
}

.deployToggle {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 800;
  color: var(--muted2);
}

.deployToggle input[type="checkbox"] {
  transform: scale(1.1);
}

@media (max-width: 1100px) {
  .labeling {
    grid-template-columns: 1fr;
  }
  .grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .healthGrid {
    grid-template-columns: 1fr;
  }
  .split {
    grid-template-columns: 1fr;
  }
  .exportRow {
    grid-template-columns: 1fr;
  }
  .exportReviewBody {
    grid-template-columns: 1fr;
  }
  .connectGrid {
    grid-template-columns: 1fr;
  }
  .modelGrid {
    grid-template-columns: 1fr;
  }
  .systemGrid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }
}

@media (max-width: 1200px) {
  .camAddrPill {
    max-width: clamp(130px, 22vw, 190px);
  }
  .camNavBar {
    grid-template-columns: minmax(0, 1fr) repeat(2, minmax(160px, 1fr));
  }
  .camNavBar #camNavReset {
    justify-self: start;
  }
  .camFields {
    grid-template-columns: minmax(280px, 1fr);
  }
}

@media (max-width: 900px) {
  .systemGrid {
    grid-template-columns: 1fr;
  }
  .systemObsGrid {
    grid-template-columns: 1fr;
  }
  #sysSloJson,
  #sysTimelineJson {
    max-height: 42vh;
  }
  .cameraRow .camLine.camLineBottom {
    grid-template-columns: minmax(0, 1fr) max-content;
  }
  .camNavBar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .camNavBar #camNavReset {
    justify-self: start;
  }
  .camFields {
    grid-template-columns: 1fr;
  }
  .camSnapAuthFields {
    grid-template-columns: repeat(2, minmax(140px, 1fr));
  }
  .sysCamAuthFields {
    grid-template-columns: repeat(2, minmax(140px, 1fr));
  }
  .sysMqttFields {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .camTimeRow {
    grid-template-columns: 1fr;
    align-items: start;
  }
  .camTimeTimes {
    flex-wrap: wrap;
  }
}

@media (max-width: 680px) {
  .topRight {
    width: 100%;
    justify-content: flex-end;
  }
  .modalCard {
    margin: 0;
    width: 100%;
    height: 100%;
    max-height: none;
    border-radius: 0;
  }
  .deployField {
    grid-template-columns: 1fr;
    gap: 6px;
    align-items: start;
  }
  .grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .imgRow {
    grid-template-columns: 1fr;
  }
  .kv {
    grid-template-columns: 1fr;
    gap: 4px;
    align-items: start;
  }
  .exportSplitRow {
    grid-template-columns: 1fr;
    gap: 6px;
    align-items: start;
  }
  .exportSplitV {
    text-align: left;
  }
  .cameraRow .camLine {
    grid-template-columns: 1fr;
  }
  .camNavBar {
    grid-template-columns: 1fr;
  }
  .cameraRow .camLine.camLineTop {
    grid-template-columns: 1fr;
    align-items: start;
  }
  .cameraRow .camLine.camLineTop > .camActions {
    grid-column: 1;
    align-self: flex-end;
    margin-left: 0;
  }
  .camSnapAuthFields {
    grid-template-columns: 1fr;
  }
  .sysCamAuthFields {
    grid-template-columns: 1fr;
  }
  .sysMqttFields {
    grid-template-columns: 1fr;
  }
  .sysPickTop {
    grid-template-columns: 1fr;
  }
  .cameraRow .camActions,
  .cameraRow .camCounts {
    justify-content: flex-end;
  }
  .cameraRow .camActions {
    grid-auto-columns: 24px;
    justify-self: stretch;
  }
  .themeDrop > summary {
    padding: 7px 9px;
    font-size: 11px;
  }
  .themeMenu {
    right: auto;
    left: 0;
    width: min(260px, 92vw);
  }
  .hamburger {
    display: inline-flex;
  }
  .nav {
    display: none;
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    margin-top: 10px;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--card);
    box-shadow: var(--shadow);
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
  }
  .topbar.navOpen .nav {
    display: flex;
  }
  .nav a {
    width: 100%;
  }
  .actions {
    flex-direction: column;
    align-items: stretch;
  }
  .hint {
    order: 3;
  }
  .list .row {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .list .row .left {
    flex-wrap: wrap;
    align-items: flex-start;
  }
}
