:root {
  color-scheme: light;
  --bg: #e8edf3;
  --panel: #edf1f6;
  --panel-raised: #f2f5f8;
  --panel-pressed: #e2e8ef;
  --line: #cdd6e1;
  --text: #1e2938;
  --muted: #5f6f82;
  --primary: #006666;
  --primary-dark: #004f4f;
  --primary-soft: #d8eded;
  --accent: #a66a13;
  --accent-soft: #f6ead3;
  --violet: #59469b;
  --violet-soft: #e5e0f4;
  --control: #b42318;
  --control-soft: #f3dcd9;
  --success: #007a3d;
  --warning: #a15c00;
  --danger: #c01845;
  --shadow: 9px 9px 20px rgb(163 174 188 / 42%), -9px -9px 20px rgb(255 255 255 / 88%);
  --shadow-sm: 5px 5px 12px rgb(163 174 188 / 36%), -5px -5px 12px rgb(255 255 255 / 82%);
  --shadow-inset: inset 5px 5px 10px rgb(163 174 188 / 34%), inset -5px -5px 10px rgb(255 255 255 / 84%);
  --shadow-pressed: inset 4px 4px 9px rgb(163 174 188 / 38%), inset -4px -4px 9px rgb(255 255 255 / 80%);
  --shadow-glow: 0 0 0 3px rgb(0 102 102 / 12%);
  --font-mono: "Space Mono", "JetBrains Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    radial-gradient(circle at 20% 0, rgb(255 255 255 / 70%), transparent 28%),
    linear-gradient(135deg, #eef3f8, var(--bg));
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  font-size: 14px;
}

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

body.live-focus-active {
  overflow: hidden;
}

.shell {
  width: min(1280px, calc(100vw - 28px));
  margin: 0 auto;
  padding: 24px 0 48px;
}

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

.topbar h1 {
  letter-spacing: 0;
  color: var(--text);
  font-weight: 900;
}

h1,
h2 {
  margin: 0;
  line-height: 1.25;
}

h1 {
  font-size: 24px;
}

h2 {
  font-size: 17px;
  margin-bottom: 16px;
}

h2,
.control-cluster-title,
.overview-item span,
th {
  font-family: var(--font-mono);
}

p {
  margin: 6px 0 0;
  color: var(--muted);
}

a {
  color: var(--primary);
  font-weight: 800;
  text-decoration: none;
}

a:hover {
  color: var(--primary-dark);
  text-decoration: underline;
}

input::placeholder,
textarea::placeholder {
  color: rgb(95 111 130 / 72%);
}

::-webkit-scrollbar {
  width: 11px;
  height: 11px;
}

::-webkit-scrollbar-thumb {
  border: 3px solid var(--bg);
  border-radius: 999px;
  background: #aab6c5;
}

::-webkit-scrollbar-track {
  background: transparent;
}

.grid {
  display: grid;
  gap: 16px;
  margin-bottom: 16px;
}

.grid.two {
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
}

.ops-grid {
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, .75fr);
}

.panel {
  background: linear-gradient(145deg, var(--panel-raised), var(--panel));
  border: 1px solid rgb(255 255 255 / 52%);
  border-radius: 8px;
  padding: 18px;
  box-shadow: var(--shadow);
}

[hidden] {
  display: none !important;
}

.overview-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 16px;
  overflow: hidden;
  border: 1px solid rgb(255 255 255 / 52%);
  border-radius: 8px;
  background: linear-gradient(145deg, var(--panel-raised), var(--panel));
  box-shadow: var(--shadow);
}

.overview-item {
  position: relative;
  min-height: 64px;
  padding: 12px 16px;
  background: linear-gradient(145deg, rgb(255 255 255 / 32%), rgb(226 232 239 / 24%));
}

.overview-item + .overview-item {
  border-left: 1px solid rgb(163 174 188 / 22%);
}

.overview-item span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.overview-item strong {
  display: block;
  margin-top: 4px;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 21px;
  font-weight: 900;
  line-height: 1;
}

.workspace-tabs {
  display: flex;
  gap: 8px;
  margin: 0 0 12px;
  overflow-x: auto;
  border: 1px solid rgb(255 255 255 / 46%);
  border-radius: 8px;
  padding: 6px;
  background: var(--panel);
  box-shadow: var(--shadow-inset);
}

.workspace-tab {
  position: relative;
  flex: 0 0 auto;
  min-height: 38px;
  border: 0;
  border-radius: 6px;
  padding: 8px 12px 10px;
  color: var(--muted);
  background: transparent;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  transition: color 160ms ease, background-color 160ms ease, box-shadow 160ms ease;
}

.workspace-tab:hover {
  color: var(--text);
  background: rgb(255 255 255 / 34%);
}

.workspace-tab.is-active {
  color: var(--primary);
  background: var(--panel-raised);
  box-shadow: var(--shadow-sm);
}

.workspace-tab.is-active::after {
  display: none;
}

.workspace-panel {
  animation: panel-in 160ms ease-out;
}

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

.panel-heading h2 {
  margin-bottom: 0;
}

.live-panel {
  position: relative;
  display: grid;
  gap: 14px;
  margin-bottom: 16px;
  overflow: clip;
}

.live-panel::before {
  position: absolute;
  top: 23px;
  left: 18px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #aeb7c2;
  content: "";
  pointer-events: none;
}

[data-live-dashboard][data-mode="live"]::before {
  background: var(--success);
  box-shadow: 0 0 0 4px rgb(16 124 65 / 10%);
}

.live-panel .panel-heading {
  order: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  margin-bottom: 0;
}

.live-panel .panel-heading > div:first-child {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  flex-wrap: wrap;
}

.live-panel .panel-heading h2 {
  padding-left: 15px;
}

.live-workspace {
  order: 2;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 244px;
  min-height: 0;
  overflow: hidden;
  border: 1px solid #263244;
  border-radius: 8px;
  background: #0e1726;
}

.live-controls {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
  border-left: 1px solid rgb(163 174 188 / 24%);
  padding: 14px;
  background: linear-gradient(145deg, var(--panel), var(--panel-pressed));
  box-shadow: var(--shadow-inset);
}

.control-cluster {
  display: grid;
  gap: 7px;
  min-width: 0;
  min-height: 0;
  border: 0;
  border-bottom: 1px solid rgb(163 174 188 / 24%);
  border-radius: 0;
  padding: 0 0 14px;
  background: transparent;
}

.control-cluster:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.control-cluster-title {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.control-help {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.select-wrap {
  position: relative;
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
}

.select-wrap::after {
  position: absolute;
  right: 12px;
  top: 50%;
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  content: "";
  pointer-events: none;
  transform: translateY(-62%) rotate(45deg);
  transform-origin: center;
}

.access-cluster {
  grid-template-columns: 1fr;
}

.live-controls .button.compact {
  min-height: 34px;
  padding: 6px 8px;
  font-size: 12px;
}

.icon-button {
  position: relative;
  width: 34px;
  min-width: 34px;
  padding: 0;
  box-shadow: var(--shadow-sm);
}

.icon-button svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.icon-button[aria-pressed="true"] {
  color: #fff;
  background: var(--violet);
  border-color: var(--violet);
  box-shadow: var(--shadow-pressed);
}

@media (hover: hover) {
  .icon-button::after {
    position: absolute;
    right: 50%;
    bottom: calc(100% + 8px);
    z-index: 20;
    width: max-content;
    max-width: 180px;
    border: 1px solid rgb(255 255 255 / 54%);
    border-radius: 6px;
    padding: 5px 7px;
    color: var(--text);
    background: var(--panel-raised);
    box-shadow: var(--shadow-sm);
    content: attr(aria-label);
    font-size: 12px;
    font-weight: 800;
    opacity: 0;
    pointer-events: none;
    transform: translate(50%, 3px);
    transition: opacity 140ms ease, transform 140ms ease;
  }

  .icon-button:hover::after,
  .icon-button:focus-visible::after {
    opacity: 1;
    transform: translate(50%, 0);
  }
}

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

.live-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 0;
}

.live-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border: 1px solid rgb(255 255 255 / 50%);
  border-radius: 999px;
  padding: 3px 9px;
  color: var(--muted);
  background: var(--panel-raised);
  box-shadow: var(--shadow-sm);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 800;
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease;
}

.live-pill[data-state="ready"],
.live-pill[data-state="clear"] {
  color: var(--success);
  background: #e3f3ea;
  border-color: rgb(0 122 61 / 18%);
}

.live-pill[data-state="pending"],
.live-pill[data-state="paused"] {
  color: var(--warning);
  background: var(--accent-soft);
  border-color: #f5d48a;
}

.live-pill[data-state="live"] {
  color: var(--primary);
  background: var(--primary-soft);
  border-color: rgb(0 102 102 / 18%);
}

.live-pill[data-state="error"] {
  color: var(--danger);
  background: #fdecec;
  border-color: #fac5c1;
}

.compact-label {
  min-width: 190px;
}

label:has(> select) {
  position: relative;
}

label:has(> select)::after {
  position: absolute;
  right: 12px;
  bottom: 16px;
  width: 8px;
  height: 8px;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  content: "";
  pointer-events: none;
  transform: rotate(45deg);
  transform-origin: center;
}

.compact-label:has(> select)::after {
  bottom: 14px;
}

.switch-row {
  display: inline-flex;
  grid-template-columns: none;
  align-items: center;
  justify-content: space-between;
  gap: 9px;
  width: 100%;
  min-height: 32px;
  border: 1px solid rgb(255 255 255 / 38%);
  border-radius: 6px;
  padding: 6px 8px;
  color: var(--text);
  background: var(--panel);
  box-shadow: var(--shadow-inset);
  white-space: nowrap;
  transition: border-color 160ms ease, background-color 160ms ease, color 160ms ease, box-shadow 160ms ease;
}

.switch-row input {
  position: relative;
  flex: 0 0 auto;
  width: 34px;
  height: 20px;
  margin: 0;
  border: 1px solid rgb(255 255 255 / 48%);
  border-radius: 999px;
  appearance: none;
  accent-color: var(--primary);
  background: var(--panel-pressed);
  box-shadow: var(--shadow-pressed);
  cursor: pointer;
  transition: background-color 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.switch-row input::before {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--panel-raised);
  box-shadow: var(--shadow-sm);
  content: "";
  transition: transform 160ms ease;
}

.switch-row input:checked {
  border-color: var(--primary);
  background: var(--primary);
  box-shadow: none;
}

.switch-row input:checked::before {
  transform: translateX(14px);
}

.switch-row input:disabled {
  cursor: not-allowed;
  opacity: .58;
}

.switch-row:has(input:checked) {
  color: var(--primary);
  background: var(--primary-soft);
  border-color: rgb(0 102 102 / 20%);
  box-shadow: var(--shadow-sm);
}

.segmented-control {
  display: inline-grid;
  grid-template-columns: repeat(3, minmax(52px, 1fr));
  width: 100%;
  min-width: 0;
  min-height: 36px;
  overflow: hidden;
  border: 1px solid rgb(255 255 255 / 44%);
  border-radius: 7px;
  background: var(--panel);
  box-shadow: var(--shadow-inset);
}

.segment {
  min-width: 54px;
  border: 0;
  border-right: 1px solid rgb(163 174 188 / 22%);
  padding: 8px 10px;
  color: var(--muted);
  background: transparent;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  transition: color 160ms ease, background-color 160ms ease, box-shadow 160ms ease;
}

.segment:last-child {
  border-right: 0;
}

.segment:hover {
  color: var(--text);
  background: rgb(255 255 255 / 34%);
}

.segment[aria-pressed="true"] {
  color: var(--primary);
  background: var(--panel-raised);
  box-shadow: var(--shadow-sm);
}

[data-live-dashboard][data-speed="eco"] .segment[data-live-speed="eco"][aria-pressed="true"] {
  color: var(--warning);
  box-shadow: var(--shadow-sm), inset 0 -2px 0 rgb(254 153 0 / 65%);
}

[data-live-dashboard][data-speed="burst"] .segment[data-live-speed="burst"][aria-pressed="true"] {
  color: var(--violet);
  box-shadow: var(--shadow-sm), inset 0 -2px 0 rgb(89 70 155 / 65%);
}

.segment:focus-visible,
.switch-row input:focus-visible {
  outline: 3px solid rgb(21 111 143 / 22%);
  outline-offset: 2px;
}

.live-viewer {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: #05080e;
}

.live-viewer.is-focus-mode {
  position: fixed;
  inset: 0;
  z-index: 1000;
  width: 100vw;
  height: 100dvh;
  background: #000;
}

.live-stage {
  position: relative;
  display: grid;
  height: clamp(360px, 52vh, 600px);
  min-height: 280px;
  overflow: hidden;
  place-items: center;
  border: 0;
  border-radius: 0;
  --live-pan-x: 0px;
  --live-pan-y: 0px;
  --live-zoom: 1;
  background:
    linear-gradient(180deg, rgb(255 255 255 / 4%), transparent 18%),
    #0e1726;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.live-stage::before {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgb(255 255 255 / 5%) 1px, transparent 1px),
    linear-gradient(90deg, rgb(255 255 255 / 5%) 1px, transparent 1px);
  background-size: 72px 72px;
  content: "";
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
}

[data-live-dashboard][data-grid="on"] .live-stage::before {
  opacity: 1;
}

.live-stage:focus-visible {
  outline: 3px solid rgb(21 111 143 / 24%);
  outline-offset: 3px;
}

.live-viewer.is-focus-mode .live-stage {
  height: 100%;
  min-height: 0;
  border-radius: 0;
}

[data-live-dashboard][data-mode="live"] .live-stage {
  border-color: #7bc4d9;
  box-shadow: inset 0 0 0 1px rgb(123 196 217 / 45%);
}

[data-live-dashboard][data-control="on"] .live-stage {
  border-color: var(--control);
  box-shadow:
    inset 0 0 0 1px rgb(180 35 24 / 55%),
    0 0 0 3px rgb(180 35 24 / 10%);
}

.live-stage img {
  display: none;
  width: 100%;
  height: 100%;
  object-fit: contain;
  transform: translate(var(--live-pan-x), var(--live-pan-y)) scale(var(--live-zoom));
  transform-origin: center;
  cursor: default;
  user-select: none;
  will-change: transform;
}

[data-live-dashboard][data-control="on"] .live-stage img.ready {
  cursor: crosshair;
}

[data-live-dashboard][data-zoom="manual"] .live-stage img.ready {
  cursor: grab;
}

[data-live-dashboard][data-zoom="manual"][data-control="on"] .live-stage img.ready {
  cursor: crosshair;
}

.live-stage img.ready {
  display: block;
}

.touch-indicator {
  position: absolute;
  z-index: 2;
  width: 34px;
  height: 34px;
  border: 2px solid #7dd3fc;
  border-radius: 50%;
  background: rgb(14 165 233 / 16%);
  box-shadow: 0 0 0 7px rgb(14 165 233 / 10%);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(.55);
}

.touch-indicator[data-tone="control"] {
  border-color: #86efac;
  background: rgb(34 197 94 / 18%);
  box-shadow: 0 0 0 7px rgb(34 197 94 / 10%);
}

.touch-indicator.is-visible {
  animation: touch-feedback 480ms ease-out;
}

@keyframes touch-feedback {
  0% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(.55);
  }

  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1.25);
  }
}

.live-stage:has(img.ready) .live-empty {
  display: none;
}

.live-empty {
  color: #cbd5e1;
  font-weight: 700;
}

.live-viewer-bar {
  position: absolute;
  z-index: 3;
  right: 0;
  bottom: 0;
  left: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 54px;
  padding: 10px 12px;
  background: linear-gradient(180deg, transparent, rgb(0 0 0 / 82%));
  opacity: .2;
  transition: opacity 160ms ease;
}

.live-viewer:hover .live-viewer-bar,
.live-viewer:focus-within .live-viewer-bar,
.live-viewer.is-focus-mode .live-viewer-bar,
[data-live-dashboard][data-control="on"] .live-viewer-bar {
  opacity: 1;
}

.live-viewer.is-focus-mode .live-viewer-bar {
  top: 50%;
  right: 12px;
  bottom: auto;
  left: auto;
  width: min(244px, calc(100% - 24px));
  max-height: calc(100dvh - 48px);
  min-height: 44px;
  border: 1px solid rgb(255 255 255 / 12%);
  border-radius: 8px;
  padding: 8px;
  background: rgb(2 6 23 / 62%);
  box-shadow: 0 10px 30px rgb(0 0 0 / 26%);
  opacity: .12;
  overflow: auto;
  flex-wrap: wrap;
  pointer-events: none;
  transform: translate(6px, -50%);
}

.live-viewer.is-focus-mode:hover .live-viewer-bar,
.live-viewer.is-focus-mode:focus-within .live-viewer-bar {
  opacity: .94;
  transform: translate(0, -50%);
}

.live-viewer.is-focus-mode .live-status {
  flex: 1 1 100%;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  pointer-events: none;
}

.live-viewer.is-focus-mode .live-view-actions,
.live-viewer.is-focus-mode .live-view-actions * {
  pointer-events: auto;
}

.live-viewer.is-focus-mode .live-view-actions {
  width: 100%;
  justify-content: flex-start;
}

.live-status {
  min-width: 0;
  margin: 0;
  color: #e2e8f0;
  font-size: 13px;
  font-weight: 700;
  overflow-wrap: anywhere;
}

[data-live-dashboard][data-agent-state="online"] .live-status {
  color: #7ee2aa;
}

[data-live-dashboard][data-agent-state="offline"] .live-status,
[data-live-dashboard][data-agent-state="error"] .live-status {
  color: var(--danger);
}

.live-view-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 7px;
}

.live-view-actions .icon-button {
  width: 38px;
  min-width: 38px;
  height: 38px;
  border-color: rgb(255 255 255 / 18%);
  color: #fff;
  background: rgb(15 23 42 / 72%);
  box-shadow: 0 10px 24px rgb(0 0 0 / 20%);
  backdrop-filter: blur(8px);
}

.live-view-actions .icon-button:hover {
  color: #fff;
  background: rgb(15 23 42 / 96%);
  box-shadow: 0 12px 28px rgb(0 0 0 / 28%);
}

.live-view-actions .icon-button:focus-visible,
.zoom-chip:focus-visible {
  border-color: rgb(255 255 255 / 42%);
  box-shadow: 0 10px 24px rgb(0 0 0 / 26%), 0 0 0 3px rgb(255 255 255 / 18%);
}

.live-view-actions .icon-button:disabled,
.live-view-actions .icon-button:disabled:hover {
  color: #94a3b8;
  background: rgb(15 23 42 / 44%);
  transform: none;
}

.zoom-chip {
  min-width: 52px;
  height: 38px;
  border: 1px solid rgb(255 255 255 / 18%);
  color: #fff;
  background: rgb(15 23 42 / 72%);
  font-size: 12px;
  font-weight: 800;
  box-shadow: 0 10px 24px rgb(0 0 0 / 20%);
  backdrop-filter: blur(8px);
}

.zoom-chip:hover {
  color: #fff;
  background: rgb(15 23 42 / 96%);
}

.zoom-chip:disabled,
.zoom-chip:disabled:hover {
  color: #94a3b8;
  background: rgb(15 23 42 / 44%);
  transform: none;
}

.live-view-actions .button.danger {
  color: #fecaca;
  background: rgb(127 29 29 / 72%);
}

.device-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}

.device-card {
  border: 1px solid rgb(255 255 255 / 52%);
  border-radius: 8px;
  padding: 12px;
  background: linear-gradient(145deg, var(--panel-raised), var(--panel));
  box-shadow: var(--shadow-sm);
}

.device-card[hidden] {
  display: none;
}

.device-card-top,
.device-meta,
.file-list-head,
.file-row,
.inline-fields {
  display: flex;
  align-items: center;
  gap: 10px;
}

.device-card-top {
  justify-content: space-between;
  margin-bottom: 10px;
}

.favorite-toggle {
  display: inline-flex;
  grid-template-columns: none;
  align-items: center;
  gap: 7px;
  color: var(--accent);
  font-size: 12px;
}

.favorite-toggle input {
  position: relative;
  width: 18px;
  height: 18px;
  min-width: 18px;
  border: 1px solid rgb(255 255 255 / 50%);
  border-radius: 4px;
  appearance: none;
  accent-color: var(--accent);
  background: var(--panel-raised);
  box-shadow: var(--shadow-inset);
  cursor: pointer;
  transition: background-color 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.favorite-toggle input::before {
  position: absolute;
  inset: 4px;
  border-radius: 2px;
  background: var(--accent);
  content: "";
  opacity: 0;
  transform: scale(.55);
  transition: opacity 160ms ease, transform 160ms ease;
}

.favorite-toggle input:checked {
  border-color: rgb(166 106 19 / 28%);
  background: var(--accent-soft);
  box-shadow: var(--shadow-sm);
}

.favorite-toggle input:checked::before {
  opacity: 1;
  transform: scale(1);
}

.profile-badge,
.file-kind {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 3px 8px;
  color: var(--violet);
  background: var(--violet-soft);
  border: 1px solid rgb(255 255 255 / 48%);
  box-shadow: var(--shadow-sm);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.device-meta {
  justify-content: space-between;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.file-list {
  display: grid;
  gap: 8px;
  margin: 14px 0;
}

.file-list-head {
  justify-content: space-between;
  border-bottom: 1px solid rgb(163 174 188 / 24%);
  padding-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
}

.file-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  min-height: 42px;
  border: 1px solid rgb(255 255 255 / 52%);
  border-radius: 7px;
  padding: 7px;
  background: var(--panel-raised);
  box-shadow: var(--shadow-sm);
}

.file-name {
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-size {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.upload-form {
  border-top: 1px solid rgb(163 174 188 / 24%);
  padding-top: 14px;
}

.drop-upload {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  min-height: 96px;
  border: 1.5px dashed rgb(95 111 130 / 42%);
  border-radius: 8px;
  padding: 14px;
  color: var(--muted);
  background:
    linear-gradient(145deg, rgb(255 255 255 / 42%), rgb(226 232 239 / 44%)),
    var(--panel);
  box-shadow: var(--shadow-inset);
  cursor: pointer;
  transition: border-color 160ms ease, background-color 160ms ease, box-shadow 160ms ease, color 160ms ease;
}

.drop-upload:hover,
.drop-upload.is-dragging {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-soft);
  box-shadow: var(--shadow-sm), inset 0 0 0 1px rgb(0 102 102 / 12%);
}

.drop-upload:focus-visible {
  outline: 3px solid rgb(21 111 143 / 22%);
  outline-offset: 2px;
}

.drop-upload.has-file {
  border-style: solid;
  border-color: rgb(0 102 102 / 24%);
  color: var(--text);
  background: var(--primary-soft);
}

.drop-upload-input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
  padding: 0;
}

.drop-upload-icon {
  display: inline-grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid rgb(255 255 255 / 54%);
  border-radius: 8px;
  color: var(--primary);
  background: var(--panel-raised);
  box-shadow: var(--shadow-sm);
}

.drop-upload-icon svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.drop-upload-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.drop-upload-copy strong {
  color: var(--text);
}

.drop-upload-copy span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.inline-fields {
  align-items: stretch;
}

.inline-fields label {
  flex: 1;
}

.login-panel {
  width: min(420px, 100%);
  margin: 0 auto;
}

form {
  display: grid;
  gap: 12px;
}

.logout-form {
  display: block;
  margin: 0;
}

.inline-form {
  display: inline-flex;
  margin: 0;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid rgb(255 255 255 / 48%);
  border-radius: 6px;
  padding: 10px 11px;
  color: var(--text);
  background: var(--panel-raised);
  box-shadow: var(--shadow-inset);
  font: inherit;
  transition: background-color 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

select {
  appearance: none;
  padding-right: 34px;
  cursor: pointer;
}

.favorite-toggle input {
  width: 18px;
  height: 18px;
  min-height: 18px;
  padding: 0;
}

textarea {
  resize: vertical;
  font-family: var(--font-mono);
}

.button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-height: 40px;
  border: 1px solid rgb(255 255 255 / 36%);
  border-radius: 6px;
  padding: 10px 14px;
  color: #fff;
  background: var(--primary);
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  font: inherit;
  box-shadow: var(--shadow-sm);
  transition: background-color 160ms ease, border-color 160ms ease, box-shadow 160ms ease, color 160ms ease, transform 160ms ease;
}

.button[aria-pressed="true"] {
  color: #fff;
  background: var(--violet);
  box-shadow: var(--shadow-pressed);
}

.button:hover {
  background: var(--primary-dark);
  box-shadow: 4px 4px 10px rgb(163 174 188 / 30%), -4px -4px 10px rgb(255 255 255 / 78%);
  transform: translateY(-1px);
}

.button:active {
  box-shadow: var(--shadow-pressed);
  transform: translateY(0);
}

.button:disabled,
.button:disabled:hover {
  color: #98a2b3;
  background: #eef2f6;
  border-color: var(--line);
  box-shadow: var(--shadow-inset);
  cursor: not-allowed;
  transform: none;
}

.button:focus-visible {
  outline: 0;
  border-color: rgb(0 102 102 / 45%);
  box-shadow: var(--shadow-sm), var(--shadow-glow);
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 0;
  border-color: rgb(0 102 102 / 45%);
  box-shadow: var(--shadow-inset), var(--shadow-glow);
  outline-offset: 2px;
}

.button.compact {
  min-height: 32px;
  padding: 7px 10px;
  font-size: 13px;
}

.button.secondary {
  color: var(--primary);
  background: var(--panel-raised);
  border: 1px solid rgb(255 255 255 / 50%);
}

.button.secondary:hover {
  color: var(--primary-dark);
  background: var(--primary-soft);
}

.button.danger {
  color: var(--control);
  background: var(--control-soft);
  border: 1px solid rgb(180 35 24 / 18%);
}

.button.danger:hover {
  color: #8f1f16;
  background: #fde2df;
}

[data-live-dashboard][data-control="on"] .button.danger {
  color: #fff;
  background: var(--control);
  border-color: var(--control);
}

[data-live-dashboard][data-control="on"] .switch-row:has([data-control-toggle]) {
  color: var(--control);
}

[data-live-dashboard][data-keyboard="on"] .switch-row:has([data-keyboard-toggle]) {
  color: var(--primary);
}

[data-live-dashboard][data-fullscreen="on"] .button[data-live-fullscreen] {
  color: #fff;
  background: var(--primary-dark);
}

[data-live-dashboard][data-detail-status="on"] .button[data-live-verbose] {
  color: #fff;
  background: var(--violet);
}

.notice {
  border: 1px solid rgb(255 255 255 / 48%);
  border-radius: 6px;
  padding: 10px 12px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-sm);
  font-weight: 700;
}

.notice.success {
  background: #e8f6ee;
  color: var(--success);
}

.notice.error {
  background: #fdecec;
  color: var(--danger);
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid rgb(255 255 255 / 50%);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow-inset);
}

.result-count {
  flex: 0 0 auto;
  border: 1px solid rgb(255 255 255 / 50%);
  border-radius: 999px;
  padding: 6px 10px;
  color: var(--muted);
  background: var(--panel-raised);
  box-shadow: var(--shadow-sm);
  font-size: 12px;
  font-weight: 800;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 14px;
}

.pagination-summary {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.pagination-pages {
  display: flex;
  align-items: center;
  gap: 5px;
}

.page-link,
.pagination-gap {
  display: inline-grid;
  min-width: 36px;
  min-height: 36px;
  place-items: center;
  border-radius: 6px;
  font-weight: 800;
}

.page-link {
  border: 1px solid rgb(255 255 255 / 50%);
  color: var(--text);
  background: var(--panel-raised);
  box-shadow: var(--shadow-sm);
  text-decoration: none;
  transition: color 150ms ease, box-shadow 150ms ease, transform 150ms ease;
}

.page-link:hover {
  color: var(--primary);
  transform: translateY(-1px);
}

.page-link.is-current {
  border-color: var(--primary);
  color: white;
  background: var(--primary);
  box-shadow: var(--shadow-inset);
}

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

table {
  width: 100%;
  border-collapse: collapse;
  background: transparent;
}

th,
td {
  border-bottom: 1px solid rgb(163 174 188 / 24%);
  padding: 10px;
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  white-space: nowrap;
}

tbody tr {
  transition: background-color 160ms ease;
}

tbody tr:hover {
  background: rgb(255 255 255 / 30%);
}

code {
  font-family: var(--font-mono);
}

pre {
  width: min(480px, 62vw);
  max-height: 180px;
  margin: 0;
  overflow: auto;
  white-space: pre-wrap;
  font-family: var(--font-mono);
  font-size: 12px;
}

.artifact-preview-link {
  display: block;
  width: min(280px, 100%);
  margin-top: 8px;
}

.artifact-preview {
  display: block;
  width: 100%;
  max-height: 180px;
  object-fit: contain;
  border: 1px solid rgb(255 255 255 / 28%);
  border-radius: 6px;
  background: #0f172a;
}

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

.status {
  display: inline-flex;
  border-radius: 999px;
  border: 1px solid rgb(255 255 255 / 48%);
  padding: 3px 8px;
  box-shadow: var(--shadow-sm);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
}

.status.queued {
  background: #eef2f6;
  color: #475467;
}

.status.running {
  background: var(--accent-soft);
  color: var(--warning);
}

.status.succeeded {
  background: #e8f6ee;
  color: var(--success);
}

.status.failed {
  background: #fdecec;
  color: var(--danger);
}

.status.cancelled {
  background: #eceff3;
  color: #344054;
}

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

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

  .overview-item:nth-child(odd) {
    border-left: 0;
  }

  .overview-item:nth-child(n + 3) {
    border-top: 1px solid var(--line);
  }

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

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar .button {
    width: 100%;
  }

  .panel-heading {
    flex-direction: column;
  }

  .live-workspace {
    grid-template-columns: 1fr;
  }

  .live-controls {
    order: 2;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 18px;
    width: 100%;
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .live-stage {
    order: 1;
  }

  .control-cluster {
    width: 100%;
    padding-top: 12px;
  }

  .access-cluster {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .access-cluster .control-cluster-title {
    grid-column: 1 / -1;
  }

  .access-cluster .switch-row {
    width: auto;
  }

  .compact-label,
  .segmented-control,
  .live-controls .button,
  .switch-row {
    width: 100%;
  }

  .compact-label,
  .segmented-control {
    grid-column: 1 / -1;
  }

  .switch-row {
    min-height: 34px;
  }

  .live-stage {
    height: min(38vh, 380px);
  }
}

@media (max-width: 680px) {
  .shell {
    width: min(100vw - 20px, 100%);
    padding: 14px 0 36px;
  }

  h1 {
    font-size: 21px;
  }

  .panel {
    padding: 14px;
  }

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

  .overview-item {
    min-height: 62px;
    padding: 10px;
  }

  .overview-item strong {
    font-size: 21px;
  }

  .workspace-tabs {
    margin-left: -2px;
    margin-right: -2px;
  }

  .live-panel {
    padding: 12px;
  }

  .live-controls {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .live-stage {
    height: min(42vh, 360px);
  }

  .live-viewer-bar {
    position: static;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-content: end;
    gap: 6px;
    min-height: 50px;
    padding: 7px 8px;
    background: #08111e;
    opacity: 1;
  }

  .live-viewer.is-focus-mode .live-viewer-bar {
    position: absolute;
    top: 50%;
    right: 8px;
    bottom: auto;
    left: auto;
    width: min(184px, calc(100% - 16px));
    max-height: calc(100dvh - 24px);
    transform: translate(6px, -50%);
  }

  .live-viewer.is-focus-mode:hover .live-viewer-bar,
  .live-viewer.is-focus-mode:focus-within .live-viewer-bar {
    transform: translate(0, -50%);
  }

  .live-status {
    width: 100%;
    font-size: 11px;
  }

  .live-view-actions {
    width: 100%;
    min-width: 0;
    gap: 4px;
    justify-content: flex-start;
  }

  .live-view-actions .icon-button {
    flex: 0 0 34px;
    width: 34px;
    min-width: 34px;
    height: 34px;
  }

  .zoom-chip {
    flex: 0 0 44px;
    min-width: 44px;
    height: 34px;
    padding-left: 8px;
    padding-right: 8px;
  }

  .live-viewer.is-focus-mode .live-status {
    display: none;
  }

  .control-cluster {
    padding-top: 12px;
  }

  .access-cluster {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .access-cluster .control-cluster-title {
    grid-column: 1 / -1;
  }

  .segmented-control {
    grid-template-columns: repeat(3, 1fr);
    width: 100%;
    min-width: 0;
  }

  .live-controls .button,
  .switch-row {
    width: auto;
  }

  .file-row {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .file-size,
  .file-row .button {
    grid-column: 2;
  }

  .inline-fields {
    flex-direction: column;
  }

  input,
  select,
  textarea,
  .button {
    min-height: 42px;
  }

  .table-wrap {
    overflow: visible;
    border: 0;
  }

  .pagination {
    align-items: stretch;
    flex-direction: column;
  }

  .pagination-pages {
    max-width: 100%;
    overflow-x: auto;
    padding: 2px;
  }

  table,
  thead,
  tbody,
  tr,
  td {
    display: block;
    width: 100%;
  }

  thead {
    display: none;
  }

  tr {
    margin-bottom: 12px;
    overflow: hidden;
    border: 1px solid rgb(255 255 255 / 52%);
    border-radius: 8px;
    background: linear-gradient(145deg, var(--panel-raised), var(--panel));
    box-shadow: var(--shadow-sm);
  }

  td {
    display: grid;
    grid-template-columns: minmax(92px, 34%) minmax(0, 1fr);
    gap: 10px;
    border-bottom: 1px solid rgb(163 174 188 / 24%);
    padding: 11px 12px;
  }

  td:last-child {
    border-bottom: 0;
  }

  td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
  }

  td.no-label,
  td[colspan] {
    display: block;
  }

  td.no-label::before,
  td[colspan]::before {
    content: none;
  }

  pre {
    width: 100%;
    max-width: none;
  }
}

@media (hover: none) {
  .live-viewer-bar {
    opacity: 1;
  }
}

@media (max-width: 420px) {
  td {
    grid-template-columns: 1fr;
    gap: 5px;
  }
}

@keyframes live-sweep {
  from {
    background-position: 0% 0;
  }
  to {
    background-position: 220% 0;
  }
}

@keyframes panel-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

  .button:hover {
    transform: none;
  }
}
