:root {
  color-scheme: dark;
  font-family: Inter, "Segoe UI", "Microsoft YaHei UI", system-ui, sans-serif;
  --bg: #07101a;
  --sidebar: #09131f;
  --panel: #0d1825;
  --panel-2: #111e2c;
  --panel-3: #07111c;
  --line: #243548;
  --line-soft: #1a2a3b;
  --text: #edf5fc;
  --muted: #8093a8;
  --subtle: #53677d;
  --accent: #2f8cff;
  --accent-2: #4aa7ff;
  --ok: #35d07f;
  --warn: #f2b84b;
  --danger: #f25b63;
  --info: #54bde8;
  --shadow: 0 18px 50px rgb(0 0 0 / 24%);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 980px;
  min-height: 100vh;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 45% -20%, rgb(30 89 142 / 12%), transparent 35rem),
    var(--bg);
  color: var(--text);
}
button, input, select, textarea { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent-2);
  outline-offset: 2px;
}
.hidden { display: none !important; }
.mobile-only { display: none !important; }
.app-shell { min-height: 100vh; }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 30;
  display: flex;
  width: 184px;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, #0a1725, #08111b 70%);
  box-shadow: 8px 0 30px rgb(0 0 0 / 14%);
}
.brand {
  display: flex;
  align-items: center;
  height: 70px;
  gap: 11px;
  padding: 0 17px;
  border-bottom: 1px solid var(--line);
}
.brand-mark {
  position: relative;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  border-radius: 11px;
  background: linear-gradient(145deg, #1174e8, #4aa7ff);
  box-shadow: 0 0 25px rgb(47 140 255 / 25%);
  transform: rotate(-8deg);
}
.brand-mark::before, .brand-mark::after, .brand-mark i {
  content: "";
  position: absolute;
  left: 7px;
  right: 7px;
  height: 3px;
  border-radius: 99px;
  background: white;
  transform: skewX(-24deg);
}
.brand-mark::before { top: 9px; }
.brand-mark i { top: 15px; }
.brand-mark::after { top: 21px; }
.brand strong { display: block; font-size: 17px; letter-spacing: -.02em; }
.brand span { display: block; margin-top: 2px; color: #6e849a; font-size: 9px; font-weight: 700; letter-spacing: .24em; }
.sidebar nav { display: grid; gap: 5px; padding: 16px 10px; }
.nav-item, .tree-file, .tree-folder {
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 43px;
  padding: 0 13px;
  border-radius: 8px;
  color: #91a5ba;
  font-size: 13px;
  transition: .16s ease;
}
.nav-item span { width: 18px; text-align: center; color: #7291ae; font-size: 16px; }
.nav-item:hover { background: #122437; color: #dce9f5; }
.nav-item.active {
  color: white;
  background: linear-gradient(90deg, #164f93, #153a63);
  box-shadow: inset 3px 0 var(--accent-2);
}
.nav-item.active span { color: #79bdff; }
.sidebar-foot { margin-top: auto; padding: 12px; }
.environment, .operator {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #0b1723;
}
.operator { margin-top: 8px; }
.environment small, .operator small { display: block; color: var(--muted); font-size: 10px; }
.environment strong, .operator strong { display: block; margin-top: 2px; font-size: 11px; font-weight: 600; }
.avatar {
  display: grid;
  width: 29px;
  height: 29px;
  place-items: center;
  border: 1px solid #36506a;
  border-radius: 50%;
  color: #a9d4ff;
  background: #15283b;
  font-size: 10px;
}

.workspace { margin-left: 184px; padding: 0 14px 24px; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  min-height: 70px;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin: 0 -14px;
  padding: 9px 18px 9px 22px;
  border-bottom: 1px solid var(--line);
  background: rgb(7 16 26 / 94%);
  backdrop-filter: blur(16px);
}
h1, h2, h3, p { margin: 0; }
h1 { font-size: 20px; line-height: 1.15; letter-spacing: -.025em; }
h2 { font-size: 15px; letter-spacing: -.01em; }
h3 { font-size: 13px; }
.eyebrow, .device-kicker { margin-bottom: 4px; color: #4f82ae; font-size: 8px; font-weight: 800; letter-spacing: .2em; }
.top-status { display: flex; align-items: center; gap: 7px; }
.health-chip {
  display: flex;
  min-width: 118px;
  height: 44px;
  align-items: center;
  gap: 9px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0b1723;
}
.health-chip small { display: block; color: var(--muted); font-size: 9px; }
.health-chip strong { display: block; margin-top: 2px; color: #b9c9d8; font-size: 11px; }
.health-chip.wide-status { min-width: 142px; }
.metric-icon { color: var(--accent-2); font-size: 18px; }
.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #617486;
  box-shadow: 0 0 0 3px rgb(97 116 134 / 10%);
}
.status-dot.ok { background: var(--ok); box-shadow: 0 0 0 3px rgb(53 208 127 / 11%), 0 0 14px rgb(53 208 127 / 35%); }
.status-dot.bad { background: var(--danger); box-shadow: 0 0 0 3px rgb(242 91 99 / 11%); }
.status-dot.warn { background: var(--warn); }

.button, .icon-button, .segmented button, .drawer-tabs button, .developer-tabs > button {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #122133;
  cursor: pointer;
  transition: .15s ease;
}
.button {
  min-height: 34px;
  padding: 0 12px;
  color: #b8c9da;
  font-size: 11px;
  font-weight: 600;
}
.button:hover:not(:disabled), .icon-button:hover:not(:disabled) { border-color: #3e5b78; background: #172b40; color: white; }
.button.primary { border-color: #337ecf; background: linear-gradient(180deg, #2787ef, #176ac2); color: white; }
.button.secondary { background: #142235; }
.button.ghost { background: transparent; }
.button.danger { border-color: #a83f47; background: linear-gradient(180deg, #d34650, #aa3039); color: white; }
.button:disabled { cursor: not-allowed; opacity: .43; }
.icon-button {
  display: inline-grid;
  width: 34px;
  height: 34px;
  place-items: center;
  color: #9fb2c5;
  font-size: 15px;
}
.toolbar { display: flex; align-items: center; gap: 7px; }
.preview-banner, .global-message {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
  padding: 9px 13px;
  border: 1px solid #725a25;
  border-radius: 8px;
  color: #dacb9e;
  background: #211d12;
  font-size: 11px;
}
.preview-banner strong { color: #ffd573; }
.global-message.error { border-color: #71353d; color: #ffc0c4; background: #241317; }
.global-message.success { border-color: #275c45; color: #a9f1c9; background: #10231b; }

.panel {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: linear-gradient(180deg, rgb(15 28 42 / 98%), rgb(11 22 34 / 98%));
  box-shadow: var(--shadow);
}
.screen-stage { margin-top: 12px; padding: 13px; }
.section-heading {
  display: flex;
  min-height: 40px;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.section-heading.compact { min-height: 38px; }
.section-heading p { margin-top: 4px; color: var(--muted); font-size: 10px; }
.title-line { display: flex; align-items: center; gap: 9px; }
.counter {
  padding: 3px 7px;
  border: 1px solid #31485e;
  border-radius: 99px;
  color: #86a4c0;
  font-size: 9px;
}
.device-grid {
  display: grid;
  min-width: 820px;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}
.compact-filter { width: 120px; min-width: 110px; }
#overview .section-heading { flex-wrap: wrap; }
.device-toolbar {
  flex: 1 1 720px;
  min-width: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.device-toolbar > input,
.device-toolbar > select,
.device-toolbar > button {
  flex: 0 0 auto;
}
.device-toolbar select { width: 142px; }
.device-toolbar #device-state-filter { width: 142px; }
.device-toolbar #select-online {
  min-width: 112px;
  white-space: nowrap;
}
.device-pagination {
  display: inline-grid;
  flex: 0 0 auto;
  grid-template-columns: 32px minmax(52px, auto) 32px;
  align-items: center;
  gap: 5px;
}
.device-pagination .button {
  width: 32px;
  min-width: 32px;
  padding: 0;
  font-size: 17px;
}
.device-pagination .counter {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}
.device-grid.compact { gap: 6px; }
.device-card {
  position: relative;
  display: flex;
  min-width: 0;
  flex-direction: column;
  padding: 7px;
  border: 1px solid #2a3d51;
  border-radius: 9px;
  background: linear-gradient(180deg, #0d1926, #0a141e);
  overflow: hidden;
  transition: border-color .15s, box-shadow .15s;
}
.device-card:hover { border-color: #426581; }
.device-card.selected { border-color: var(--accent); box-shadow: inset 0 0 0 1px rgb(47 140 255 / 35%), 0 0 20px rgb(47 140 255 / 10%); }
.device-card.offline { filter: saturate(.55); }
.device-card-head { display: flex; min-height: 28px; align-items: flex-start; justify-content: space-between; gap: 5px; margin-bottom: 5px; }
.device-identity { min-width: 0; }
.device-identity strong { display: block; overflow: hidden; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.device-meta { display: flex; gap: 5px; margin-top: 3px; color: var(--muted); font-size: 8px; }
.device-select { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.device-select input { width: auto; height: auto; flex: 0 0 auto; accent-color: var(--accent); }
.device-state { display: flex; align-items: center; gap: 5px; color: var(--ok); font-size: 9px; }
.device-screen {
  position: relative;
  display: grid;
  width: 100%;
  min-height: 0;
  max-height: 520px;
  aspect-ratio: 9 / 16;
  place-items: center;
  overflow: hidden;
  border: 1px solid #2b4054;
  border-radius: 10px;
  background:
    linear-gradient(135deg, rgb(49 101 149 / 15%), transparent 50%),
    #050a10;
}
.device-screen img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  object-fit: contain;
}
.device-preview-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  display: block;
  object-fit: contain;
  background: #02070d;
}
.device-preview-video.hidden { display: none; }
.device-screen img:not([src]), .device-screen img.hidden { display: none; }
.screen-placeholder {
  display: grid;
  gap: 8px;
  place-items: center;
  padding: 18px;
  color: #5d748b;
  text-align: center;
  font-size: 10px;
}
.screen-placeholder span { font-size: 30px; opacity: .55; }
.screen-badge {
  position: absolute;
  top: 7px;
  left: 7px;
  padding: 3px 6px;
  border: 1px solid rgb(255 255 255 / 12%);
  border-radius: 5px;
  color: #c8d8e8;
  background: rgb(4 10 16 / 76%);
  font-size: 8px;
}
.screen-badge.ok { color: #7ce5aa; border-color: rgb(75 201 126 / 35%); }
.screen-badge.idle { color: #9db0c7; border-color: rgb(157 176 199 / 30%); }
.screen-badge.warn { color: #f6c96c; border-color: rgb(246 201 108 / 35%); }
.screen-badge.bad { color: #ff9299; border-color: rgb(255 105 115 / 35%); }
.control-lock-hint {
  position: absolute;
  right: 7px;
  bottom: 7px;
  max-width: calc(100% - 14px);
  padding: 4px 7px;
  border: 1px solid rgb(246 201 108 / 32%);
  border-radius: 5px;
  color: #f6d68a;
  background: rgb(4 10 16 / 82%);
  font-size: 8px;
  line-height: 1.35;
  text-align: center;
  pointer-events: none;
}
.device-card.control-unlocked .control-lock-hint {
  color: #8eeeb6;
  border-color: rgb(75 201 126 / 30%);
  opacity: .72;
}
.device-telemetry { display: flex; min-height: 20px; align-items: center; justify-content: space-between; gap: 4px; margin: 4px 1px 0; color: #71879c; font-size: 8px; }
.device-card-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; margin-top: 4px; }
.device-card-actions button {
  min-width: 0;
  height: 25px;
  padding: 0 4px;
  border: 1px solid #2a3d51;
  border-radius: 6px;
  color: #93a8bc;
  background: #101d2a;
  font-size: 9px;
  cursor: pointer;
}
.device-card-actions button:hover { color: white; border-color: #3b5d7a; }
.device-card-actions button.primary-mini { color: #cfe7ff; border-color: #275b8d; background: #12365a; }
.device-system-actions { display: grid; grid-template-columns: 1.35fr repeat(3, 1fr); gap: 3px; margin-top: 4px; }
.device-system-actions button {
  min-width: 0;
  height: 23px;
  padding: 0 3px;
  overflow: hidden;
  border: 1px solid #293e52;
  border-radius: 5px;
  color: #7f95aa;
  background: #0d1925;
  font-size: 7px;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}
.device-system-actions button:disabled { cursor: not-allowed; opacity: .38; }
.device-card.control-unlocked { border-color: #2f8cff; box-shadow: inset 0 0 0 1px rgb(47 140 255 / 28%); }
.device-card.control-unlocked .device-screen { cursor: crosshair; touch-action: none; }
.device-screen.controlling, .drawer-screen.controlling { border-color: #4aa0ff; }
.screen-badge, .screen-placeholder, .control-lock-hint { pointer-events: none; }
.add-device-card {
  display: grid;
  min-height: 0;
  aspect-ratio: 9 / 16;
  place-items: center;
  border: 1px dashed #2c4257;
  border-radius: 9px;
  color: #60768c;
  background: rgb(8 17 27 / 35%);
  text-align: center;
  cursor: pointer;
}
.add-device-card:hover { color: #9eb6cd; border-color: #496984; }
.add-device-card span { display: block; margin-bottom: 10px; font-size: 36px; font-weight: 200; }
.add-device-card strong { font-size: 11px; }
.add-device-card small { display: block; margin-top: 5px; font-size: 9px; }
.device-skeleton {
  min-height: 390px;
  border: 1px solid var(--line-soft);
  border-radius: 9px;
  background: linear-gradient(100deg, #0b1723 25%, #122438 45%, #0b1723 65%);
  background-size: 240% 100%;
  animation: shimmer 1.5s infinite linear;
}
@keyframes shimmer { to { background-position-x: -240%; } }

.operations-grid { display: grid; grid-template-columns: minmax(420px, .92fr) minmax(520px, 1.08fr); gap: 10px; margin-top: 10px; }
.task-panel, .log-panel { min-height: 350px; padding: 14px; }
.segmented { display: flex; padding: 2px; border: 1px solid var(--line); border-radius: 7px; background: #09131e; }
.segmented button {
  min-height: 27px;
  padding: 0 10px;
  border: 0;
  color: var(--muted);
  background: transparent;
  font-size: 9px;
}
.segmented button.active { color: white; background: #1a3d63; }
.task-controls { display: grid; grid-template-columns: repeat(4, minmax(120px, 1fr)); align-items: end; gap: 7px; margin-bottom: 9px; }
.task-controls > button { align-self: end; }
.device-groups-page { scroll-margin-top: 84px; }
.device-groups-layout { display: grid; grid-template-columns: minmax(300px,.85fr) minmax(380px,1.15fr); gap: 12px; padding: 0 14px 14px; }
.device-groups-layout > section { min-width: 0; padding: 13px; border: 1px solid var(--line); border-radius: 9px; background: #0a1622; }
.group-device-filters { display: grid; grid-template-columns: 1fr 130px; gap: 7px; }
.group-device-list { max-height: 360px; }
.group-list { max-height: 430px; overflow: auto; }
.group-list article { align-items: flex-start; }
.group-list .toolbar { flex: 0 0 auto; }
.group-list .group-members { white-space: normal; line-height: 1.45; }
.runtime-config-panel { display: grid; gap: 9px; margin-bottom: 10px; padding: 10px; border: 1px solid #31506c; border-radius: 8px; background: #0a1927; }
.runtime-config-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.runtime-config-heading strong, .runtime-config-heading small { display: block; }
.runtime-config-heading small, #runtime-config-status { margin-top: 3px; color: var(--muted); font-size: 10px; }
.runtime-config-fields { display: grid; grid-template-columns: repeat(3, minmax(130px, 1fr)); gap: 8px; }
.runtime-config-fields .runtime-wide { grid-column: span 3; }
.runtime-config-fields textarea { min-height: 74px; }
.runtime-config-fields .switch-row { min-height: 52px; padding: 8px 10px; }
label { display: grid; gap: 5px; color: #8fa4b8; font-size: 9px; }
input, select, textarea {
  width: 100%;
  border: 1px solid #2b4055;
  border-radius: 6px;
  outline: none;
  color: #dbe8f4;
  background: #08131e;
}
input, select { height: 32px; padding: 0 9px; }
textarea { padding: 10px; resize: vertical; font: 11px/1.55 "Cascadia Code", Consolas, monospace; }
input:disabled, select:disabled { color: #52667a; }
.command-list { display: grid; max-height: 192px; gap: 5px; overflow: auto; padding: 1px 2px 1px 9px; border-left: 1px solid #32506d; }
.command-row {
  position: relative;
  display: grid;
  grid-template-columns: 20px 115px 1fr auto;
  align-items: center;
  gap: 6px;
  min-height: 37px;
  padding: 4px 5px;
  border: 1px solid #253a4e;
  border-radius: 6px;
  background: #0b1723;
}
.command-row::before {
  content: "";
  position: absolute;
  left: -14px;
  width: 7px;
  height: 7px;
  border: 2px solid #3b7fb6;
  border-radius: 50%;
  background: #0b1723;
}
.command-index { display: grid; width: 20px; height: 20px; place-items: center; border-radius: 5px; color: #92c7f6; background: #153652; font-size: 8px; }
.command-row select, .command-row input { height: 30px; font-size: 13px; }
.task-panel label { font-size: 12px; }
.task-panel input, .task-panel select { height: 34px; font-size: 13px; }
.task-panel textarea { font-size: 13px; }
.command-actions { display: flex; gap: 3px; }
.command-actions button {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border: 0;
  color: #6f8599;
  background: transparent;
  cursor: pointer;
}
.command-actions button:hover { color: white; background: #1b2d40; }
.task-json-pane textarea { min-height: 192px; max-height: 192px; }
.panel-footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 10px; }
.validation { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; }
.validation.success { color: var(--ok); }
.validation.error { color: var(--danger); }

.log-filters { display: grid; grid-template-columns: 125px 110px 1fr; gap: 6px; margin-bottom: 8px; }
.event-log {
  height: 255px;
  overflow: auto;
  border: 1px solid #1d3042;
  border-radius: 7px;
  background: #060e17;
  font: 12px/1.55 "Cascadia Code", Consolas, monospace;
}
.log-row {
  display: grid;
  grid-template-columns: 72px 106px 58px minmax(0, 1fr);
  gap: 8px;
  padding: 7px 9px;
  border-bottom: 1px solid rgb(36 53 72 / 42%);
  color: #8fa7bd;
}
.log-row:hover { background: #0d1b29; }
.log-time { color: #5f758a; }
.log-device { overflow: hidden; color: #5eb6eb; text-overflow: ellipsis; white-space: nowrap; }
.log-status { font-weight: 700; }
.log-status.success, .log-status.completed { color: var(--ok); }
.log-status.failed { color: var(--danger); }
.log-status.started { color: var(--info); }
.log-status.skipped { color: var(--warn); }
.log-message { min-width: 0; overflow-wrap: anywhere; white-space: normal; }
.empty-log { display: grid; place-items: center; }
.empty-state { display: grid; gap: 5px; place-items: center; color: #52677b; text-align: center; }
.empty-state span { font-size: 22px; }
.empty-state strong { font-size: 10px; }
.empty-state small { font-size: 8px; }

.studio-entry-panel {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(420px, 1.35fr) auto;
  align-items: center;
  gap: 24px;
  min-height: 132px;
  margin-top: 10px;
  padding: 20px 22px;
  border-color: #28557b;
  background: linear-gradient(120deg, #0b1b2a, #0c2337 58%, #102a42);
}
.studio-entry-panel h2 { margin: 2px 0 6px; font-size: 18px; }
.studio-entry-panel p:not(.eyebrow) { color: #8fa7bb; font-size: 12px; line-height: 1.6; }
.studio-workflow-summary { display: grid; gap: 7px; color: #9bb7cf; font-size: 12px; }
.studio-workflow-summary span::before { content: "✓"; margin-right: 8px; color: var(--ok); }
.studio-launch {
  display: grid;
  min-width: 180px;
  min-height: 40px;
  place-items: center;
  text-decoration: none;
}

.developer-panel { min-height: 300px; margin-top: 10px; resize: vertical; overflow: auto; }
.developer-tabs {
  display: flex;
  min-height: 42px;
  align-items: center;
  gap: 3px;
  padding: 0 10px;
  border-bottom: 1px solid var(--line);
  background: #0d1926;
}
.developer-tabs > button {
  height: 29px;
  padding: 0 9px;
  border-color: transparent;
  color: #74899d;
  background: transparent;
  font-size: 10px;
}
.developer-tabs > button.active { color: #dfeefc; border-color: #315c84; background: #122c45; }
.developer-tabs small { color: #7a6b45; font-size: 7px; }
.developer-actions { display: flex; gap: 6px; margin-left: auto; }
.developer-body { display: grid; min-height: 255px; grid-template-columns: 175px minmax(400px, 1fr) 230px; }
.workflow-meta {
  display: grid;
  grid-template-columns: minmax(120px, .8fr) minmax(150px, 1fr) minmax(220px, 1.5fr) minmax(110px, .7fr) auto;
  gap: 6px;
  align-items: end;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  background: #091521;
}
.workflow-meta label { display: grid; gap: 3px; color: var(--muted); font-size: 8px; }
.workflow-meta input, .workflow-meta select { width: 100%; }
.file-tree { padding: 9px; border-right: 1px solid var(--line); background: #09141f; }
.tree-heading { display: flex; align-items: center; justify-content: space-between; padding: 3px 6px 8px; color: #7890a6; font-size: 9px; font-weight: 700; text-transform: uppercase; }
.tree-heading button { border: 0; color: #7993aa; background: transparent; cursor: pointer; }
.tree-folder, .tree-file {
  width: 100%;
  min-height: 28px;
  padding: 0 7px;
  border-radius: 5px;
  color: #8196aa;
  font-size: 9px;
}
.tree-file { padding-left: 18px; }
.tree-file:hover, .tree-folder:hover { color: #c8d8e7; background: #102235; }
.tree-file.active { color: #bde0ff; background: #143658; }
.code-workspace { display: grid; min-width: 0; grid-template-rows: auto 31px 1fr 24px; background: #07111b; }
.editor-bar { display: flex; align-items: center; gap: 7px; padding: 0 10px; border-bottom: 1px solid var(--line-soft); color: #6f8498; font-size: 8px; }
.editor-bar strong { color: #a9bfd3; font-size: 9px; }
.unsaved-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--warn); }
.editor-shell { display: grid; min-height: 190px; grid-template-columns: 38px 1fr; overflow: hidden; }
#line-numbers {
  height: 100%;
  margin: 0;
  padding: 10px 8px 10px 0;
  overflow: hidden;
  border-right: 1px solid #17283a;
  color: #3f566c;
  background: #07101a;
  text-align: right;
  font: 10px/1.55 "Cascadia Code", Consolas, monospace;
  user-select: none;
}
#script-editor {
  height: 100%;
  min-height: 190px;
  padding: 10px 12px;
  resize: none;
  border: 0;
  border-radius: 0;
  color: #9dd1ff;
  background: #07111b;
  font-size: 10px;
  line-height: 1.55;
  tab-size: 2;
}
.editor-status { display: flex; align-items: center; justify-content: space-between; padding: 0 9px; border-top: 1px solid var(--line-soft); color: #536b80; font-size: 8px; }
.validation-panel { display: grid; align-content: start; gap: 10px; padding: 12px; border-left: 1px solid var(--line); background: #0a1521; }
.validation-card { display: flex; align-items: flex-start; gap: 9px; padding: 10px; border: 1px solid #293d51; border-radius: 7px; background: #0d1a27; }
.validation-card strong { display: block; font-size: 9px; }
.validation-card small { display: block; margin-top: 4px; color: #6f8498; font-size: 8px; line-height: 1.4; }
.validation-card.success { border-color: #245840; }
.validation-card.success .validation-icon { color: var(--ok); }
.validation-card.error { border-color: #6a343b; }
.validation-card.error .validation-icon { color: var(--danger); }
.capability-note { padding: 9px; border: 1px solid #2b4054; border-radius: 7px; color: #7b92a8; background: #0c1925; }
.capability-note strong { color: #9db2c5; font-size: 9px; }
.capability-note p { margin-top: 5px; font-size: 8px; line-height: 1.55; }

.device-drawer {
  position: fixed;
  z-index: 60;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(390px, 92vw);
  padding: 15px;
  overflow: auto;
  border-left: 1px solid #31475d;
  background: #0a1420;
  box-shadow: -24px 0 70px rgb(0 0 0 / 42%);
  transform: translateX(105%);
  transition: transform .24s ease;
}
.device-drawer.open { transform: translateX(0); }
.drawer-backdrop { position: fixed; z-index: 55; inset: 0; background: rgb(1 6 11 / 55%); backdrop-filter: blur(2px); }
.drawer-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.drawer-head h2 { font-size: 17px; }
.drawer-head p { margin-top: 4px; color: var(--muted); font-size: 10px; }
.drawer-tabs { display: grid; grid-template-columns: repeat(3, 1fr); margin: 13px 0; border-bottom: 1px solid var(--line); }
.drawer-tabs button { height: 34px; border: 0; border-radius: 0; color: #778ca0; background: transparent; font-size: 10px; }
.drawer-tabs button.active { color: #ddebfa; border-bottom: 2px solid var(--accent); }
.drawer-screen { position: relative; display: block; height: clamp(280px, 54vh, 560px); overflow: hidden; border: 1px solid #2d4358; border-radius: 10px; background: #04090e; cursor: crosshair; touch-action: none; }
.drawer-screen img,
.drawer-screen .device-preview-video { position: absolute; inset: 0; display: block; width: 100%; height: 100%; min-width: 0; min-height: 0; object-fit: contain; }
.drawer-screen img:not([src]) { display: none; }
.drawer-screen:fullscreen { width: 100vw; height: 100vh; border: 0; border-radius: 0; background: #000; }
.drawer-screen:fullscreen img { width: 100vw; height: 100vh; }
#drawer-screen-state { position: absolute; z-index: 3; inset: 50% auto auto 50%; color: #5f7488; font-size: 10px; transform: translate(-50%, -50%); }
.control-overlay { position: absolute; z-index: 2; inset: 0; pointer-events: none; }
.control-box { position: absolute; border: 1px solid #49a4ff; background: rgb(46 144 238 / 12%); box-shadow: 0 0 8px rgb(46 144 238 / 45%); }
.control-point { position: absolute; width: 13px; height: 13px; border: 2px solid #ffcf5b; border-radius: 50%; box-shadow: 0 0 8px #ffb52e; transform: translate(-50%, -50%); }
.drawer-actions { display: flex; align-items: center; gap: 7px; margin: 9px 0 12px; }
.drawer-actions .live-badge { margin-left: auto; }
.drawer-script-parameters-dialog { width: min(760px, calc(100vw - 28px)); }
.drawer-script-parameters-dialog .runtime-config-fields { margin: 16px 0; }
#drawer-script-runner { margin-bottom: 12px; }
#drawer-script-runner .inline-field button { min-height: 34px; }
#drawer-script-state { min-height: 30px; }
.live-badge { display: flex; align-items: center; gap: 6px; color: #7f96aa; font-size: 9px; }
fieldset { display: grid; gap: 9px; margin: 0; padding: 12px; border: 1px solid #263a4d; border-radius: 9px; }
fieldset legend { padding: 0 6px; color: #9db0c2; font-size: 10px; }
fieldset legend span { margin-left: 5px; color: var(--warn); font-size: 8px; }
.direction-pad { display: grid; width: 150px; grid-template-columns: repeat(3, 42px); gap: 4px; justify-content: center; margin: 4px auto; }
.direction-pad button { width: 42px; height: 42px; border: 1px solid #32495f; border-radius: 50%; color: #91a5b8; background: #132235; }
.direction-pad button:first-child { grid-column: 2; }
.direction-pad button:nth-child(2) { grid-column: 1; }
.direction-pad button:nth-child(5) { grid-column: 2; }
.control-row { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.system-key-row { grid-template-columns: repeat(3, 1fr); }
.control-row button, .inline-field button, .coordinate-fields button { border: 1px solid #31485e; border-radius: 6px; color: #9eb1c3; background: #142235; }
.inline-field { display: flex; gap: 5px; }
.inline-field input, .inline-field select { min-width: 0; flex: 1; }
.inline-field button { min-width: 48px; padding: 0 7px; }
.coordinate-fields { display: grid; grid-template-columns: 1fr 1fr 55px; gap: 5px; }
.control-result { min-height: 34px; padding: 8px; border: 1px solid #263e53; border-radius: 6px; color: #85a0b8; background: #08131e; font-size: 9px; line-height: 1.45; }
.drawer-status-grid { display: grid; gap: 7px; }
.drawer-status-row { display: flex; align-items: center; justify-content: space-between; padding: 11px; border: 1px solid var(--line); border-radius: 7px; color: #8298ad; background: #0d1a27; font-size: 10px; }
.drawer-status-row strong { color: #c9d8e6; }
.evidence-item { padding: 10px; border-bottom: 1px solid var(--line-soft); color: #8fa5b9; font-size: 9px; }
.evidence-item strong { display: block; margin-bottom: 4px; color: #c5d7e8; }

dialog {
  padding: 0;
  border: 1px solid #344b62;
  border-radius: 12px;
  color: var(--text);
  background: #0b1622;
  box-shadow: 0 30px 90px rgb(0 0 0 / 55%);
}
dialog::backdrop { background: rgb(0 5 10 / 76%); backdrop-filter: blur(3px); }
.modal { width: min(980px, 94vw); max-height: 86vh; }
.small-modal { width: min(560px, 92vw); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.modal-head h2 { font-size: 17px; }
.device-center-layout { display: grid; grid-template-columns: 1.3fr .7fr; gap: 12px; padding: 14px; }
.device-center-layout section { padding: 12px; border: 1px solid var(--line); border-radius: 9px; background: #0c1824; }
.ios-maintenance-panel { display: grid; gap: 9px; margin-bottom: 14px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.maintenance-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.maintenance-status { min-height: 74px; padding: 10px; border: 1px solid #2a4055; border-radius: 8px; color: #8fa7bb; background: #08131e; font-size: 11px; line-height: 1.55; }
.maintenance-status strong { display: block; color: #d2e3f1; }
.maintenance-status .maintenance-progress { height: 5px; margin: 8px 0; overflow: hidden; border-radius: 5px; background: #17293a; }
.maintenance-status .maintenance-progress i { display: block; height: 100%; background: #3c98f0; }
.maintenance-status .button { margin: 8px 6px 0 0; }
.device-wireless-health { margin-top: 5px; font-size: 12px; color: var(--muted); }
.device-wireless-health.healthy { color: var(--success); }
.device-wireless-health.registration_lost { color: #ffb84d; }
.device-wireless-health.recovering { color: #54b8ff; }
.device-wireless-health.lan_unreachable { color: var(--danger); }
.device-wireless-health.address_unknown { color: #ffb84d; }
.center-device-list { display: grid; max-height: 480px; gap: 7px; overflow: auto; }
.center-device-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 10px; border: 1px solid #263b4e; border-radius: 7px; background: #0a1520; }
.center-device-main { min-width: 0; flex: 1; }
.center-device-row strong { font-size: 10px; }
.center-device-row p { margin-top: 4px; color: var(--muted); font-size: 8px; overflow-wrap: anywhere; }
.center-device-actions { display: flex; align-items: flex-end; justify-content: flex-end; flex-direction: column; gap: 7px; }
.device-inline-settings { display: flex; align-items: end; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.device-inline-settings label { display: grid; gap: 4px; min-width: 170px; color: var(--muted); font-size: 11px; }
.device-inline-settings input,
.device-inline-settings select { min-height: 31px; padding: 5px 8px; font-size: 12px; }
.device-inline-settings .pending { border-color: #d69b37; color: #ffd27b; }
.device-identifier { display: flex; align-items: center; gap: 7px; }
.device-identifier span { min-width: 0; user-select: all; }
.text-button { padding: 0; border: 0; color: #69b9ff; background: transparent; font-size: 8px; cursor: pointer; }
.text-button:hover { color: #a4d7ff; }
.compact-button { min-height: 25px; padding: 4px 8px; font-size: 8px; white-space: nowrap; }
.pairing-panel { display: grid; justify-items: stretch; gap: 8px; margin-top: 12px; }
.pairing-panel img { width: 180px; height: 180px; justify-self: center; padding: 7px; border-radius: 7px; background: white; }
.pairing-panel strong, .pairing-panel p { text-align: center; }
.pairing-panel p { color: var(--muted); font-size: 9px; }
.pairing-panel textarea { min-height: 72px; word-break: break-all; }
.pairing-panel .pairing-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pairing-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-bottom: 10px; }
.pairing-tabs .active { border-color: var(--accent); color: #dff3ff; background: #12324a; }
.pairing-section > div:not(.section-heading):not(.pairing-tabs) { display: grid; gap: 9px; }
.pairing-section label { display: grid; gap: 5px; color: var(--muted); font-size: 12px; }
.pairing-section select { width: 100%; min-width: 0; }
.run-history { display: grid; max-height: 68vh; gap: 7px; overflow: auto; padding: 14px; }
.run-row { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 12px; padding: 11px; border: 1px solid var(--line); border-radius: 8px; background: #0c1824; }
.run-row strong { font-size: 10px; }
.run-row p { margin-top: 4px; color: var(--muted); font-size: 8px; }
.run-detail { display: grid; gap: 5px; margin-top: 9px; padding: 9px; border-left: 2px solid var(--accent); background: #08131e; }
.run-detail p { margin: 0; }
.history-filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.status-pill { padding: 4px 7px; border: 1px solid #375069; border-radius: 99px; color: #8ea5ba; font-size: 8px; }
.status-pill.completed { border-color: #2e6b4c; color: #6ce1a0; }
.status-pill.failed { border-color: #784047; color: #ff8f96; }
.status-pill.running, .status-pill.starting { border-color: #316898; color: #73baff; }
.settings-list { display: grid; gap: 13px; padding: 16px; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 11px; border: 1px solid var(--line); border-radius: 7px; }
.switch-row strong, .switch-row small { display: block; }
.switch-row small { margin-top: 4px; color: var(--muted); }
.switch-row input { width: auto; accent-color: var(--accent); }
.confirm-dialog { width: min(390px, 90vw); padding: 18px; }
.confirm-dialog h2 { font-size: 16px; }
.confirm-dialog p { margin: 10px 0 18px; color: #92a6b9; font-size: 11px; line-height: 1.6; white-space: pre-line; }
.confirm-dialog .toolbar { justify-content: flex-end; }
.alert-chip { appearance: none; color: inherit; text-align: left; cursor: pointer; }
.alert-chip.has-alerts { border-color: #714339; background: #251814; }
.alert-chip.has-alerts strong { color: #ff9279; }
.production-modal { width: min(1420px, 96vw); }
.settings-modal { width: min(980px, 94vw); }
.capacity-panel { display: grid; gap: 9px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: #08131e; }
.capacity-panel .section-title { padding: 0; }
.capacity-summary { display: grid; grid-template-columns: repeat(4, minmax(110px, 1fr)); gap: 7px; }
.capacity-summary article { padding: 8px; border: 1px solid var(--line); border-radius: 6px; background: #0b1926; }
.capacity-summary small, .capacity-summary strong { display: block; }
.capacity-summary small { color: var(--muted); font-size: 9px; }
.capacity-summary strong { margin-top: 4px; color: #e3eef8; font-size: 14px; }
.capacity-pools { display: grid; grid-template-columns: repeat(4, minmax(140px, 1fr)); gap: 6px; }
.capacity-pools article { padding: 7px; border: 1px solid var(--line); border-radius: 6px; }
.capacity-pools strong { display: block; font-size: 10px; }
.capacity-pools small { color: var(--muted); font-size: 8px; }
.production-columns { display: grid; grid-template-columns: repeat(3, minmax(260px, 1fr)); gap: 10px; padding: 12px; overflow: auto; max-height: 75vh; }
.production-columns > section { min-width: 0; padding: 12px; border: 1px solid var(--line); border-radius: 9px; background: #0a1622; }
.form-stack { display: grid; gap: 7px; }
.form-stack textarea { min-height: 78px; resize: vertical; }
.check-list { display: grid; gap: 5px; max-height: 145px; overflow: auto; padding: 7px; border: 1px solid var(--line); border-radius: 6px; }
.check-list label { display: flex; gap: 7px; align-items: center; font-size: 9px; }
.check-list input { width: auto; height: auto; flex: 0 0 auto; accent-color: var(--accent); }
.compact-list { display: grid; gap: 6px; margin-top: 10px; }
.compact-list article { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px; border: 1px solid var(--line); border-radius: 6px; background: #08131e; }
.compact-list article div { min-width: 0; }
.compact-list strong, .compact-list small { display: block; overflow: hidden; text-overflow: ellipsis; }
.compact-list strong { font-size: 9px; }
.compact-list small { margin-top: 3px; color: var(--muted); font-size: 8px; }
.metrics-grid { display: grid; grid-template-columns: repeat(5, minmax(120px, 1fr)); gap: 8px; padding: 12px 16px; }
.metrics-grid article { padding: 10px; border: 1px solid var(--line); border-radius: 7px; background: #0a1622; }
.metrics-grid small, .metrics-grid strong { display: block; }
.metrics-grid small { color: var(--muted); font-size: 8px; }
.metrics-grid strong { margin-top: 5px; color: #dbeaf7; font-size: 16px; }
.alert-list { display: grid; gap: 8px; padding: 12px 16px 18px; overflow: auto; max-height: 55vh; }
.alert-row { display: grid; grid-template-columns: 24px minmax(0,1fr) auto; align-items:start; gap: 10px; padding: 11px; border: 1px solid var(--line); border-left: 3px solid #607286; border-radius: 7px; background: #0a1622; }
.alert-select{display:grid;place-items:center;min-height:28px}.alert-select input{width:16px;height:16px}
.alert-row.severity-error { border-left-color: #ff6b57; }
.alert-row.severity-warning { border-left-color: #e5ad42; }
.alert-row strong { margin-left: 7px; font-size: 10px; }
.alert-row p { margin: 6px 0; color: #b7c5d3; font-size: 9px; }
.alert-row small { color: var(--muted); font-size: 8px; }

@media (min-width: 1700px) {
  .workspace { padding-right: 18px; padding-left: 18px; }
}
@media (max-width: 1250px) {
  .wide-status { display: none; }
  .device-card-actions button span { display: none; }
  .operations-grid { grid-template-columns: 1fr; }
  .task-panel, .log-panel { min-height: 310px; }
  .developer-body { grid-template-columns: 150px minmax(400px, 1fr); }
  .workflow-meta { grid-template-columns: repeat(2, minmax(150px, 1fr)); }
  .validation-panel { display: none; }
  .production-columns { grid-template-columns: 1fr; }
  .metrics-grid { grid-template-columns: repeat(3, 1fr); }
  .studio-entry-panel { grid-template-columns: 1fr; gap: 12px; }
  .device-groups-layout { grid-template-columns: 1fr; }
}
@media (max-width: 1040px) {
  body { min-width: 760px; }
  .sidebar { transform: translateX(-102%); transition: transform .2s ease; }
  .sidebar.open { transform: translateX(0); }
  .workspace { margin-left: 0; }
  .mobile-only { display: inline-grid !important; }
  .topbar > div:first-child { display: flex; align-items: center; gap: 10px; }
  .topbar .eyebrow { display: none; }
  .health-chip { min-width: 105px; }
  .screen-stage { overflow-x: auto; }
  .device-toolbar {
    flex-basis: 100%;
    justify-content: flex-start;
  }
  .device-grid { grid-template-columns: repeat(5, minmax(156px, 1fr)); }
  .device-center-layout { grid-template-columns: 1fr; }
  .task-controls { grid-template-columns: repeat(2, minmax(130px, 1fr)); }
  .history-filters { grid-template-columns: 1fr 1fr; }
}
