:root {
  color-scheme: light;
  --bg: #f5f7fa;
  --panel: #ffffff;
  --panel-soft: #f9fbfd;
  --text: #1e252f;
  --muted: #657286;
  --line: #d9e0ea;
  --blue: #2364aa;
  --blue-dark: #174c83;
  --green: #16865b;
  --red: #c2412d;
  --amber: #b07105;
  --violet: #7048a8;
  --shadow: 0 12px 28px rgba(40, 51, 70, 0.08);
  --duration-instant: 50ms;
  --duration-fast: 120ms;
  --duration-normal: 220ms;
  --duration-enter: 260ms;
  --duration-exit: 180ms;
  --duration-slow: 420ms;
  --ease-enter: cubic-bezier(0.2, 0, 0, 1);
  --ease-exit: cubic-bezier(0.3, 0, 0.8, 0.15);
  --ease-standard: cubic-bezier(0.2, 0, 0, 1);
  --ease-spring: cubic-bezier(0.22, 1.4, 0.36, 1);
  font-family: "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--text);
  background:
    linear-gradient(180deg, rgba(35, 100, 170, 0.07), transparent 220px),
    var(--bg);
}

button,
input,
select,
textarea {
  font: inherit;
  min-width: 0;
}

button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
  color: var(--text);
  background: #fff;
  cursor: pointer;
  transition:
    transform var(--duration-fast) var(--ease-standard),
    border-color var(--duration-fast) var(--ease-standard),
    background var(--duration-fast) var(--ease-standard);
}

button:hover {
  border-color: #a8b6c8;
  background: #f6f9fc;
}

button:active {
  transform: translateY(1px);
}

button:disabled {
  color: #9aa7b8;
  cursor: not-allowed;
  background: #f0f3f7;
  opacity: 0.68;
  transform: none;
}

button:disabled:hover,
button:disabled:active {
  border-color: var(--line);
  background: #f0f3f7;
  transform: none;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid #2f75bd;
  outline-offset: 2px;
}

button.primary {
  color: #fff;
  border-color: var(--blue);
  background: var(--blue);
}

button.primary:hover {
  border-color: var(--blue-dark);
  background: var(--blue-dark);
}

button.primary:disabled,
button.primary:disabled:hover,
button.primary:disabled:active {
  color: #9aa7b8;
  border-color: var(--line);
  background: #f0f3f7;
}

button.run:disabled,
button.run:disabled:hover,
button.run:disabled:active,
button.stop:disabled,
button.stop:disabled:hover,
button.stop:disabled:active {
  color: #9aa7b8;
  border-color: var(--line);
  background: #f0f3f7;
}

button.run {
  color: #fff;
  border-color: var(--green);
  background: var(--green);
}

button.stop {
  color: #fff;
  border-color: var(--red);
  background: var(--red);
}

.app-shell {
  width: min(1760px, 100%);
  margin: 0 auto;
  padding: 16px;
}

.app-workspace {
  display: grid;
  grid-template-columns: 164px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
  transition: grid-template-columns 0.16s ease;
}

.app-nav {
  position: sticky;
  top: 16px;
  display: grid;
  gap: 6px;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: var(--shadow);
}

.app-nav-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.app-nav-title {
  padding: 4px 8px 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.app-nav-collapse {
  display: inline-grid;
  place-items: center;
  width: 30px;
  min-width: 30px;
  min-height: 30px;
  padding: 0;
  border-color: #c7d2e0;
  color: var(--blue-dark);
  background: #f7fbff;
  font: 900 18px/1 "Segoe UI", Arial, sans-serif;
}

.nav-collapsed .app-workspace {
  grid-template-columns: 56px minmax(0, 1fr);
}

.nav-collapsed .app-nav {
  padding: 8px;
}

.nav-collapsed .app-nav-head {
  justify-content: center;
}

.nav-collapsed .app-nav-title,
.nav-collapsed .app-nav-footer,
.nav-collapsed .app-nav-item > span:last-child {
  display: none;
}

.nav-collapsed .app-nav-item {
  grid-template-columns: 1fr;
  justify-items: center;
  padding: 0;
}

.nav-collapsed .app-nav-item.active::before {
  left: -3px;
}

.app-nav-item {
  position: relative;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 46px;
  padding: 0 8px;
  border-color: transparent;
  color: var(--muted);
  background: transparent;
  text-align: left;
}

.app-nav-item.active::before {
  content: "";
  position: absolute;
  top: 9px;
  bottom: 9px;
  left: 0;
  width: 3px;
  border-radius: 999px;
  background: var(--blue);
}

.app-nav-item:hover {
  border-color: #c7d2e0;
  color: var(--text);
  background: #f4f7fb;
}

.app-nav-item.active {
  border-color: #b8cde4;
  color: var(--blue-dark);
  background: #eaf2fb;
}

.nav-icon {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 26px;
  border: 1px solid currentColor;
  border-radius: 6px;
  font: 800 9px/1 Consolas, "Cascadia Mono", monospace;
  letter-spacing: 0;
}

.app-nav-item > span:last-child {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 13px;
  font-weight: 800;
}

.app-nav-footer {
  display: grid;
  gap: 4px;
  margin-top: 12px;
  padding: 10px 8px 4px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.app-nav-footer span:first-child {
  color: var(--text);
  font-weight: 800;
}

.app-content {
  min-width: 0;
}

.app-page {
  min-width: 0;
}

.page-intro {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  min-height: 74px;
  margin-bottom: 14px;
  padding: 2px 2px 12px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  display: block;
  margin-bottom: 5px;
  color: var(--blue);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.page-intro h2 {
  margin: 0;
  font-size: 24px;
  line-height: 1.2;
}

.page-intro p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.page-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex: 0 1 auto;
  max-width: min(360px, 48vw);
  min-width: 0;
  min-height: 28px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: #fff;
  font-size: 12px;
  font-weight: 700;
}

.page-status span:last-child {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.status-dot {
  flex: 0 0 8px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--amber);
}

.status-dot.ready {
  background: var(--green);
}

.page-grid {
  display: grid;
  gap: 16px;
}

.page-grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
}

.workspace-section {
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: var(--shadow);
}

.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.section-heading h3 {
  margin: 0;
  font-size: 16px;
  line-height: 1.25;
}

.section-heading span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.section-heading .file-meta {
  max-width: min(560px, 72vw);
  margin-top: 8px;
  overflow: hidden;
  color: #3d4b5f;
  cursor: help;
  font-family: Consolas, "Cascadia Mono", "Microsoft YaHei", monospace;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.field-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
}

.field-grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.field-full {
  grid-column: 1 / -1;
}

.field span strong {
  float: right;
  color: var(--blue-dark);
  font: 700 12px/1.2 Consolas, "Cascadia Mono", monospace;
}

input[type="range"] {
  min-height: 28px;
  padding: 0;
  accent-color: var(--blue);
  cursor: pointer;
}

.context-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.context-chip {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 8px;
  border: 1px solid #cbd9e8;
  border-radius: 999px;
  color: var(--blue-dark);
  background: #eef5fc;
  font-size: 11px;
  font-weight: 700;
}

.clipboard-proxy {
  position: fixed;
  top: 0;
  left: -9999px;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.agent-knowledge-panel {
  display: grid;
  gap: 10px;
  margin-top: 14px;
  padding: 12px;
  border: 1px solid #dfe8f2;
  border-radius: 8px;
  background: #f8fbfe;
}

.agent-knowledge-panel > div:first-child {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.agent-knowledge-panel strong {
  flex: 0 0 auto;
  font-size: 13px;
  white-space: nowrap;
}

.agent-knowledge-panel span {
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.agent-cloud-panel {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
  padding: 13px;
  border: 1px solid #cfe0f2;
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(247, 251, 255, 0.98), rgba(239, 246, 253, 0.98));
}

.agent-cloud-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.agent-cloud-head strong {
  display: block;
  color: var(--blue-dark);
  font-size: 13px;
}

.agent-cloud-head span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.agent-cloud-head .status-tag {
  flex: 0 0 auto;
  margin-top: 0;
}

.agent-cloud-toggle {
  margin-top: 0;
}

.agent-cloud-note {
  margin: 0;
  color: #5c6d82;
  font-size: 11px;
  line-height: 1.5;
}

.agent-learning-panel {
  display: grid;
  gap: 10px;
  margin-top: 14px;
  padding: 12px;
  border: 1px solid #dfe8f2;
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(248, 251, 254, 0.98), rgba(241, 247, 253, 0.98));
}

.agent-learning-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.agent-learning-head strong {
  display: block;
  color: var(--blue-dark);
  font-size: 13px;
}

.agent-learning-head span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

#agentLearningProgress {
  flex: 0 0 auto;
  padding-top: 2px;
  color: #315d8e;
  font: 800 11px/1.3 Consolas, "Cascadia Mono", monospace;
  white-space: nowrap;
}

.learning-plan-list {
  display: grid;
  gap: 6px;
}

.learning-step {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 9px;
  align-items: start;
  min-width: 0;
  padding: 9px 0 0;
  border-top: 1px solid rgba(196, 211, 228, 0.82);
}

.learning-step:first-child {
  padding-top: 0;
  border-top: 0;
}

.learning-step-index {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 24px;
  border: 1px solid #b9cbe0;
  border-radius: 6px;
  color: #315d8e;
  background: #fff;
  font: 900 11px/1 Consolas, "Cascadia Mono", monospace;
}

.learning-step.ready .learning-step-index {
  border-color: rgba(22, 134, 91, 0.32);
  color: #126b4b;
  background: #edf8f3;
}

.learning-step.waiting .learning-step-index {
  border-color: rgba(205, 126, 42, 0.36);
  color: #a76218;
  background: #fff8ed;
}

.learning-step strong,
.learning-step em,
.learning-step p {
  min-width: 0;
}

.learning-step strong {
  display: inline;
  color: #203b5a;
  font-size: 12px;
}

.learning-step em {
  display: inline;
  margin-left: 7px;
  color: #4e647d;
  font-size: 11px;
  font-style: normal;
  font-weight: 800;
}

.learning-step p {
  margin: 4px 0 0;
  color: #5c6d82;
  font-size: 11px;
  line-height: 1.45;
}

.agent-chat-box {
  display: grid;
  gap: 10px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.agent-chat-log {
  max-height: 240px;
  min-height: 94px;
  overflow: auto;
  padding: 11px;
  border: 1px solid #dfe6ef;
  border-radius: 8px;
  color: #26384f;
  background: #f8fafc;
  font: 12px/1.55 Consolas, "Cascadia Mono", "Microsoft YaHei", monospace;
  white-space: pre-wrap;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  white-space: nowrap !important;
  clip-path: inset(50%) !important;
}

.agent-chat-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 328px;
  gap: 14px;
  align-items: start;
}

.agent-conversation {
  display: grid;
  grid-template-rows: auto minmax(420px, 1fr) auto;
  justify-self: stretch;
  width: 100%;
  max-width: none;
  min-height: min(780px, calc(100dvh - 210px));
  overflow: hidden;
  padding: 0;
}

.agent-thread-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px 12px;
  border-bottom: 1px solid #d9e4ee;
  background:
    linear-gradient(180deg, rgba(251, 253, 255, 0.98), rgba(244, 248, 252, 0.98));
}

.agent-thread-head h3 {
  margin: 2px 0 3px;
  color: #172b44;
  font-size: 18px;
}

.agent-thread-head span:last-child {
  color: #5c6d82;
  font-size: 12px;
}

.agent-context-strip {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  margin: 0;
  padding: 0;
  border-bottom: 0;
  background: transparent;
  scrollbar-width: thin;
}

.agent-context-rail {
  display: grid;
  gap: 12px;
  align-content: start;
  min-width: 0;
}

.agent-drawer-body {
  display: grid;
  gap: 10px;
}

.agent-drawer-body .agent-context-strip {
  padding: 0;
}

.agent-quick-prompts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.agent-quick-prompts button {
  min-height: 36px;
  padding: 0 10px;
  border-color: #c8d8e8;
  color: #173b63;
  background: #fff;
  text-align: left;
  font-size: 12px;
  font-weight: 800;
}

.agent-quick-prompts button:hover {
  border-color: #9fb6cc;
  background: #f5f9fd;
}

.agent-thread {
  display: grid;
  align-content: start;
  gap: 12px;
  min-height: 0;
  overflow: auto;
  padding: 18px;
  background:
    radial-gradient(circle at 16px 16px, rgba(20, 184, 166, 0.08) 0 1px, transparent 1px),
    linear-gradient(180deg, #f7fafd 0%, #eef4fa 100%);
  background-size: 32px 32px, auto;
}

.agent-message-list {
  display: grid;
  align-content: start;
  gap: 14px;
}

.agent-message {
  display: flex;
  gap: 10px;
  align-items: start;
  justify-self: start;
  max-width: min(790px, 84%);
}

.agent-message.user {
  flex-direction: row-reverse;
  justify-self: end;
  max-width: min(620px, 72%);
}

.agent-message.user .agent-avatar {
  color: #fff;
  border-color: #1f6fd0;
  background: linear-gradient(180deg, #2c7ee1, #1559aa);
}

.agent-message.user .agent-bubble {
  color: #f8fbff;
  border-color: #2167bc;
  background: linear-gradient(180deg, #2876d2, #175aa3);
  box-shadow: 0 12px 26px rgba(28, 91, 168, 0.18);
}

.agent-avatar {
  display: inline-grid;
  flex: 0 0 auto;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid #b9cbe0;
  border-radius: 8px;
  color: #174e87;
  background: #fff;
  font: 900 11px/1 Consolas, "Cascadia Mono", monospace;
}

.agent-bubble {
  min-width: 0;
  max-width: 100%;
  padding: 11px 13px;
  border: 1px solid #d5e2f0;
  border-radius: 8px;
  color: #26384f;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 12px 26px rgba(35, 73, 118, 0.07);
}

.agent-bubble strong {
  display: block;
  margin-bottom: 5px;
  color: #163b63;
  font-size: 13px;
}

.agent-message.user .agent-bubble strong {
  color: #fff;
}

.agent-bubble p {
  margin: 0;
  color: #52677e;
  font-size: 12px;
  line-height: 1.55;
}

.agent-response-text {
  display: grid;
  gap: 8px;
  min-width: 0;
  color: #26384f;
  font: 13px/1.68 "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
  overflow-wrap: anywhere;
}

.agent-response-text p {
  margin: 0;
  white-space: pre-wrap;
}

.agent-message.user .agent-response-text,
.agent-message.user .agent-response-text p {
  color: #f8fbff;
}

.agent-code-block {
  max-width: 100%;
  margin: 2px 0 0;
  padding: 10px;
  overflow: auto;
  border: 1px solid #c7d6e6;
  border-radius: 8px;
  color: #dcecff;
  background: #13263b;
  font: 12px/1.55 Consolas, "Cascadia Mono", monospace;
  white-space: pre;
}

.agent-output-store {
  display: none;
}

.agent-thread .code-preview {
  min-height: 280px;
  margin: 0;
  border-color: #cddbea;
  border-radius: 8px;
  color: #193553;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.97), rgba(249, 252, 255, 0.97));
  box-shadow: 0 14px 34px rgba(35, 73, 118, 0.08);
}

.agent-thread .code-preview.empty {
  display: grid;
  place-items: center;
  min-height: 220px;
  color: #6c7b8e;
  text-align: center;
}

.agent-thread .agent-output-store,
.agent-thread .agent-output-store.empty {
  display: none;
}

.agent-composer {
  display: grid;
  gap: 8px;
  padding: 12px 16px 14px;
  border-top: 1px solid #dce6f1;
  background: rgba(255, 255, 255, 0.98);
}

.agent-input-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
  padding: 8px;
  border: 1px solid #c8d8e8;
  border-radius: 8px;
  background: #fbfdff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9), 0 12px 26px rgba(28, 60, 100, 0.06);
}

.agent-composer textarea {
  min-height: 42px;
  max-height: 150px;
  padding: 10px 6px 8px 8px;
  overflow: auto;
  border: 0;
  background: transparent;
  box-shadow: none;
  resize: none;
}

.agent-composer textarea:focus {
  outline: 2px solid rgba(37, 99, 235, 0.18);
  outline-offset: 2px;
}

.agent-send-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.agent-send-actions button {
  min-height: 38px;
  white-space: nowrap;
}

.agent-composer-tools {
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.agent-cloud-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.agent-cloud-actions button {
  min-height: 34px;
  padding-right: 8px;
  padding-left: 8px;
  white-space: nowrap;
}

.settings-agent-panel {
  align-content: start;
}

.settings-agent-panel .agent-cloud-toggle {
  margin-bottom: 10px;
}

.settings-agent-panel .agent-cloud-note {
  margin: 8px 0 0;
}

.text-action {
  justify-self: end;
  min-height: auto;
  padding: 0;
  border: 0;
  color: #52677e;
  background: transparent;
  box-shadow: none;
  font-size: 12px;
}

.text-action:hover {
  color: var(--blue-dark);
  background: transparent;
}

.agent-context-rail {
  display: grid;
  gap: 12px;
  padding: 0;
  overflow: visible;
}

.agent-drawer {
  border-bottom: 1px solid #dfe8f2;
}

.agent-drawer:last-child {
  border-bottom: 0;
}

.agent-drawer summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 50px;
  padding: 0 14px;
  color: #1f3956;
  cursor: pointer;
  list-style: none;
  font-size: 13px;
  font-weight: 900;
}

.agent-drawer summary::-webkit-details-marker {
  display: none;
}

.agent-drawer summary::before {
  content: "";
  width: 6px;
  height: 6px;
  border-right: 2px solid #7890aa;
  border-bottom: 2px solid #7890aa;
  transform: rotate(-45deg);
  transition: transform 150ms ease;
}

.agent-drawer[open] summary::before {
  transform: rotate(45deg);
}

.agent-drawer summary > span:first-child {
  grid-column: 1;
  grid-row: 1;
  padding-left: 16px;
}

.agent-drawer summary > span:last-child {
  grid-column: 2;
  grid-row: 1;
  min-width: 0;
  max-width: 190px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agent-drawer-body {
  display: grid;
  gap: 10px;
  padding: 0 14px 14px;
}

.compact-grid {
  gap: 8px;
}

.compact-grid .field input,
.compact-grid .field select {
  min-height: 34px;
  padding-right: 8px;
  padding-left: 8px;
  font-size: 13px;
}

.agent-drawer-body.agent-cloud-panel,
.agent-drawer-body.agent-learning-panel,
.agent-drawer-body.agent-knowledge-panel {
  margin: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.agent-drawer-body.agent-knowledge-panel {
  padding-top: 0;
}

.agent-drawer-body .knowledge-list {
  max-height: 210px;
  overflow: auto;
}

.local-tool-list {
  display: grid;
  gap: 8px;
  margin: 0 0 12px;
}

.local-tool-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 12px;
  align-items: center;
  min-height: 52px;
  padding: 10px 11px;
  border: 1px solid #dfe8f2;
  border-radius: 8px;
  background: #f8fbfe;
}

.local-tool-card strong {
  color: var(--blue-dark);
  font-size: 13px;
}

.local-tool-card span {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.local-tool-card code {
  grid-column: 1 / -1;
  overflow: hidden;
  color: #26384f;
  font: 11px/1.35 Consolas, "Cascadia Mono", monospace;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.local-tool-card .badge {
  justify-self: end;
}

.knowledge-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.knowledge-chip {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  max-width: 100%;
  padding: 0 9px;
  overflow: hidden;
  border: 1px solid #b9cbe0;
  border-radius: 999px;
  color: #203b5a;
  background: #fff;
  font-size: 12px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.knowledge-chip:hover {
  border-color: #8fb0d2;
  background: #eef5fc;
}

.code-preview {
  min-height: 330px;
  max-height: clamp(320px, calc(100dvh - 300px), 820px);
  margin: 0;
  padding: 12px;
  overflow: auto;
  border: 1px solid #dfe6ef;
  border-radius: 8px;
  color: #23344a;
  background: #f8fafc;
  font: 12px/1.55 Consolas, "Cascadia Mono", monospace;
  white-space: pre-wrap;
}

.code-preview.empty {
  display: grid;
  place-items: center;
  color: var(--muted);
  font: 13px/1.5 "Microsoft YaHei", "Segoe UI", Arial, sans-serif;
}

.remote-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 328px;
  gap: 14px;
  align-items: start;
}

.section-heading.compact {
  align-items: center;
  margin-bottom: 10px;
}

.remote-board {
  display: grid;
  gap: 12px;
  align-content: start;
  min-width: 0;
}

.remote-side-rail {
  display: grid;
  gap: 12px;
  align-content: start;
  min-width: 0;
}

.remote-hud {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.remote-hud div {
  min-width: 0;
  padding: 10px;
  border: 1px solid #dbe5f0;
  border-radius: 8px;
  background: #f8fbfe;
}

.remote-hud span,
.remote-hud strong {
  display: block;
  min-width: 0;
}

.remote-hud span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.remote-hud strong {
  margin-top: 5px;
  overflow-wrap: anywhere;
  color: var(--blue-dark);
  font-size: 14px;
}

.remote-cockpit {
  display: grid;
  grid-template-columns: minmax(150px, 0.8fr) minmax(260px, 1.2fr);
  gap: 12px;
  padding: 12px;
  border: 1px solid #243244;
  border-radius: 8px;
  color: #e8eef7;
  background:
    linear-gradient(135deg, #1d2735 0%, #111827 54%, #253246 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.remote-wheel {
  display: grid;
  place-items: center;
  min-height: 136px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  text-align: center;
}

.remote-wheel span,
.remote-meter span,
.remote-keyboard-hint {
  color: #aebbd0;
  font-size: 11px;
  font-weight: 800;
}

.remote-wheel strong {
  color: #fff;
  font-size: 18px;
}

.remote-wheel i {
  display: block;
  width: 78px;
  height: 28px;
  margin-top: 8px;
  border: 4px solid #d7e1ef;
  border-radius: 999px;
  transform-origin: center;
  transition: transform 0.12s ease;
}

.remote-pedals {
  display: grid;
  gap: 10px;
  align-content: center;
}

.remote-meter {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr) 72px;
  align-items: center;
  gap: 10px;
  min-height: 34px;
}

.remote-meter strong {
  color: #fff;
  font: 800 12px/1.2 Consolas, "Cascadia Mono", monospace;
  text-align: right;
}

.remote-meter i {
  position: relative;
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
}

.remote-meter i::after {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, #2fbf71, #f5b63f);
  content: "";
}

.remote-meter.meter-p10 i::after {
  width: 10%;
}

.remote-meter.meter-p20 i::after {
  width: 20%;
}

.remote-meter.meter-p30 i::after {
  width: 30%;
}

.remote-meter.meter-p40 i::after {
  width: 40%;
}

.remote-meter.meter-p50 i::after {
  width: 50%;
}

.remote-meter.meter-p60 i::after {
  width: 60%;
}

.remote-meter.meter-p70 i::after {
  width: 70%;
}

.remote-meter.meter-p80 i::after {
  width: 80%;
}

.remote-meter.meter-p90 i::after {
  width: 90%;
}

.remote-meter.meter-p100 i::after {
  width: 100%;
}

.remote-meter.danger i::after {
  background: linear-gradient(90deg, #f5b63f, #d6422b);
}

.remote-wheel.steer-left i {
  transform: rotate(-24deg);
}

.remote-wheel.steer-right i {
  transform: rotate(24deg);
}

.remote-wheel.steer-center i {
  transform: rotate(0deg);
}

.remote-keyboard-hint {
  grid-column: 1 / -1;
  padding-top: 2px;
  color: #c9d4e5;
  line-height: 1.45;
}

.remote-key {
  display: grid;
  place-items: center;
  gap: 5px;
  min-height: 72px;
  padding: 10px;
  color: var(--blue-dark);
  border-color: #b9cbe0;
  background: #f3f8fd;
  font-weight: 800;
  touch-action: none;
}

.remote-key span {
  color: currentColor;
  font: 800 10px/1 Consolas, "Cascadia Mono", monospace;
  opacity: 0.72;
}

.remote-key strong {
  font-size: 15px;
  line-height: 1.2;
}

.remote-key.active {
  transform: translateY(1px);
  color: #fff;
  border-color: var(--blue-dark);
  background: var(--blue-dark);
  box-shadow: inset 0 0 0 999px rgba(0, 0, 0, 0.08);
}

.remote-key-boost {
  color: #fff;
  border-color: var(--blue);
  background: var(--blue);
}

.remote-key-brake {
  color: #fff;
  border-color: var(--red);
  background: var(--red);
}

.remote-command-panel {
  min-width: 0;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.command-preview {
  min-height: 94px;
  max-height: 180px;
  margin: 0;
  padding: 12px;
  overflow-x: auto;
  overflow-y: auto;
  border: 1px solid #dfe6ef;
  border-radius: 8px;
  color: #17202c;
  background: #f8fafc;
  font: 12px/1.55 Consolas, "Cascadia Mono", monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.remote-command-panel .small-btn {
  min-width: 72px;
  min-height: 34px;
}

.remote-pin-grid {
  display: grid;
  gap: 8px;
}

.remote-pin-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.remote-pin-grid input {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.remote-map-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 12px;
}

.remote-map-actions span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.remote-map-actions span.pending {
  color: var(--amber);
  font-weight: 800;
}

.replay-summary,
.session-grid,
.security-list {
  display: grid;
  gap: 8px;
  margin-top: 18px;
}

.replay-summary div,
.session-grid div,
.security-list div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid #e6ebf2;
  border-radius: 8px;
  background: var(--panel-soft);
}

.replay-summary span,
.session-grid span,
.security-list span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.replay-summary strong,
.session-grid strong,
.security-list strong {
  min-width: 0;
  overflow-wrap: anywhere;
  text-align: right;
}

.session-grid,
.security-list {
  margin-top: 0;
}

.session-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.session-grid div {
  display: grid;
  align-content: center;
  min-height: 80px;
}

.session-grid strong {
  margin-top: 5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--blue-dark);
  font: 700 12px/1.35 Consolas, "Cascadia Mono", monospace;
  text-align: left;
}

.security-list strong {
  color: #203047;
  font-size: 12px;
}

.setting-control-mode {
  margin: 12px 0;
}

.session-actions {
  margin-top: 14px;
}

.workspace-sync-strip {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.workspace-sync-copy {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.workspace-sync-copy strong {
  color: var(--blue-dark);
  font-size: 13px;
  font-weight: 800;
}

.workspace-sync-copy small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.workspace-sync-strip button {
  min-width: 112px;
}

.file-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--blue);
  border-radius: 8px;
  color: #fff;
  background: var(--blue);
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
}

.file-button:hover {
  background: var(--blue-dark);
}

.file-button span {
  white-space: nowrap;
}

.file-button input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.replay-summary {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.replay-summary div {
  display: grid;
  align-content: center;
  justify-items: start;
  min-height: 78px;
}

.replay-summary strong {
  margin-top: 6px;
  font-size: 20px;
  font-variant-numeric: tabular-nums;
  text-align: left;
}

.replay-chart-panel {
  position: relative;
  min-width: 0;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.replay-toolbox {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 8px;
  margin: 8px 0 10px;
}

.field.compact {
  flex: 0 1 112px;
  gap: 4px;
}

.field.compact input {
  min-height: 34px;
  padding: 7px 9px;
}

.replay-toolbox button {
  min-height: 34px;
  padding: 0 11px;
}

.replay-hover-readout {
  display: flex;
  align-items: center;
  min-height: 34px;
  margin-bottom: 8px;
  padding: 7px 10px;
  overflow-wrap: anywhere;
  border: 1px solid #dbe5f0;
  border-radius: 8px;
  color: #203047;
  background: #f8fbfe;
  font: 700 12px/1.45 Consolas, "Cascadia Mono", "Microsoft YaHei", monospace;
}

#replayChart {
  display: block;
  width: 100%;
  min-height: 260px;
  border: 1px solid #dfe6ef;
  border-radius: 8px;
  background: #f8fafc;
}

.replay-chart-panel.empty #replayChart {
  display: none;
}

.replay-empty {
  display: grid;
  place-items: center;
  min-height: 240px;
  margin-top: 16px;
  padding: 20px;
  border: 1px dashed #c7d2e0;
  border-radius: 8px;
  color: var(--muted);
  background: #fbfcfe;
  text-align: center;
}

.replay-chart-panel:not(.empty) .replay-empty {
  display: none;
}

.setting-toggle {
  margin-top: 0;
  margin-bottom: 12px;
}

.topbar {
  display: grid;
  align-items: stretch;
  grid-template-columns:
    minmax(240px, 0.62fr)
    minmax(0, 1.38fr);
  min-width: 0;
  gap: 12px 14px;
  margin-bottom: 16px;
  padding: 16px 18px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
}

.brand-block h1,
.panel h2,
.chart-title h2 {
  margin: 0;
  letter-spacing: 0;
}

.brand-block,
.top-actions {
  min-width: 0;
}

.brand-block {
  align-self: center;
}

.brand-block h1 {
  font-size: 24px;
  line-height: 1.2;
}

.brand-block span,
.chart-toolbar span,
.sensor-heading span,
.field span,
.metric-item span,
.mini-stats span,
.panel-heading p {
  color: var(--muted);
}

.brand-block span {
  display: block;
  margin-top: 5px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  line-height: 1.35;
}

.top-page-nav {
  display: flex;
  align-items: stretch;
  gap: 6px;
  min-width: 0;
  padding: 4px;
  overflow-x: auto;
  border: 1px solid #d9e3ee;
  border-radius: 8px;
  background: #f7fafc;
}

.top-page-tab {
  display: grid;
  grid-template-columns: 30px minmax(52px, auto);
  align-items: center;
  justify-content: center;
  gap: 7px;
  flex: 1 0 82px;
  min-height: 48px;
  min-width: 0;
  padding: 0 8px;
  border-color: transparent;
  color: var(--muted);
  background: transparent;
  white-space: nowrap;
}

.top-page-tab:hover {
  border-color: #c7d2e0;
  color: var(--text);
  background: #fff;
}

.top-page-tab.active {
  border-color: #b8cde4;
  color: var(--blue-dark);
  background: #eaf2fb;
  box-shadow: 0 6px 16px rgba(35, 100, 170, 0.12);
}

.top-page-tab > span:last-child {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 13px;
  font-weight: 800;
}

.top-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: flex-end;
  gap: 8px;
}

.top-actions > .field {
  flex: 1 1 132px;
  min-width: 132px;
}

.top-actions > .wireless-field {
  flex: 2 1 240px;
  min-width: 220px;
}

.top-actions > button {
  flex: 0 0 auto;
  width: auto;
  min-width: 76px;
}

.top-actions input {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.native-device-field {
  display: none;
}

.topbar-meta {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding-top: 2px;
  border-top: 1px solid #e3eaf2;
}

.topbar-meta-item {
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid #dde5ef;
  border-radius: 8px;
  background: #f8fbfe;
}

.topbar-meta-item span {
  display: block;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.topbar-meta-item strong {
  display: block;
  margin-top: 4px;
  overflow: hidden;
  color: var(--blue-dark);
  font-size: 12px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-meta-item-action {
  min-width: 0;
}

.topbar-origin-link {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 0;
  overflow: hidden;
  border: 0;
  color: var(--blue-dark);
  background: transparent;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.35;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}

.topbar-origin-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  margin-top: 4px;
}

.topbar-origin-row .topbar-origin-link {
  flex: 1 1 auto;
  margin-top: 0;
}

.topbar-origin-copy {
  flex: 0 0 auto;
  min-width: 48px;
  height: 26px;
  padding: 0 10px;
  border: 1px solid rgba(35, 100, 170, 0.22);
  border-radius: 999px;
  color: #2364aa;
  background: #f5f9ff;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
}

.topbar-origin-copy:hover {
  background: #ebf3ff;
}

.topbar-origin-copy:focus-visible {
  outline: 2px solid rgba(35, 100, 170, 0.35);
  outline-offset: 2px;
}

.topbar-origin-link:hover {
  color: #124a88;
}

.topbar-origin-link:focus-visible {
  outline: 2px solid rgba(35, 100, 170, 0.35);
  outline-offset: 2px;
  border-radius: 4px;
}

.app-toast-stack {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 80;
  display: grid;
  gap: 8px;
  width: min(360px, calc(100vw - 36px));
  pointer-events: none;
}

.app-toast {
  display: grid;
  gap: 3px;
  padding: 11px 13px;
  border: 1px solid #d7e0eb;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 12px 34px rgba(20, 41, 66, 0.12);
  color: #1d3554;
  opacity: 0;
  transform: translateY(8px);
  transition:
    opacity var(--duration-fast) var(--ease-enter),
    transform var(--duration-fast) var(--ease-enter),
    border-color var(--duration-fast) var(--ease-standard),
    background-color var(--duration-fast) var(--ease-standard);
}

.app-toast.show {
  opacity: 1;
  transform: translateY(0);
}

.app-toast strong {
  font-size: 12px;
  line-height: 1.25;
}

.app-toast small {
  color: #5f6f82;
  font-size: 11px;
  line-height: 1.35;
}

.app-toast.success {
  border-color: rgba(22, 134, 91, 0.24);
  background: rgba(242, 251, 246, 0.98);
}

.app-toast.warning {
  border-color: rgba(174, 115, 0, 0.24);
  background: rgba(255, 249, 237, 0.98);
}

.app-toast.error {
  border-color: rgba(190, 62, 49, 0.24);
  background: rgba(255, 244, 242, 0.98);
}

.wiring-panel {
  margin-bottom: 14px;
  padding: 0;
}

.workbench-details-summary,
.replay-compare-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 56px;
  padding: 10px 14px;
  cursor: pointer;
  list-style: none;
}

.workbench-details-summary::-webkit-details-marker,
.replay-compare-summary::-webkit-details-marker {
  display: none;
}

.workbench-details-summary > span:first-child,
.replay-compare-summary > span:first-child {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.workbench-details-summary strong,
.replay-compare-summary strong {
  color: #183b61;
  font-size: 14px;
}

.workbench-details-summary small,
.replay-compare-summary small {
  overflow: hidden;
  color: var(--muted);
  font: 700 11px/1.35 Consolas, "Cascadia Mono", "Microsoft YaHei", monospace;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.details-summary-action {
  flex: 0 0 auto;
  color: var(--blue-dark);
  font-size: 12px;
  font-weight: 800;
}

.workbench-details-summary::after,
.replay-compare-summary::after,
.compact-details-summary::after {
  width: 7px;
  height: 7px;
  border-right: 2px solid #7890aa;
  border-bottom: 2px solid #7890aa;
  content: "";
  transform: rotate(45deg) translateY(-2px);
  transition: transform var(--duration-enter-fast, 150ms) var(--ease-enter);
}

.wiring-panel[open] .workbench-details-summary::after,
.replay-compare-panel[open] .replay-compare-summary::after,
.tune-maintenance[open] .compact-details-summary::after {
  transform: rotate(225deg) translate(-2px, -1px);
}

.wiring-panel-body {
  padding: 0 14px 14px;
  border-top: 1px solid var(--line);
  animation: compact-reveal var(--duration-enter) var(--ease-enter);
}

.wiring-panel .panel-heading {
  margin: 12px 0 10px;
}

.wiring-panel .panel-heading p {
  max-width: 900px;
}

.wiring-grid {
  display: grid;
  gap: 8px;
}

.wiring-row {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) 28px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
}

.wiring-label {
  align-self: center;
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
  text-align: right;
}

.wiring-arrow {
  align-self: center;
  color: var(--muted);
  font: 700 14px/1 Consolas, "Cascadia Mono", monospace;
  text-align: center;
}

.wiring-note {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.dashboard {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 356px;
  gap: 14px;
  align-items: start;
}

.tune-main-column {
  display: grid;
  gap: 14px;
  min-width: 0;
  align-content: start;
}

.dashboard > .side-panel {
  grid-column: 2;
  grid-row: 1;
}

.panel,
.chart-card,
.metric-strip {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: var(--shadow);
}

.panel {
  padding: 16px;
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.panel-heading.inline {
  align-items: center;
  margin-bottom: 10px;
}

.panel-heading h2,
.side-section h2,
.chart-title h2 {
  font-size: 16px;
  line-height: 1.25;
}

.panel-heading p {
  margin: 4px 0 0;
  font-size: 13px;
}

.param-sync-text {
  color: #657286;
}

.status-badges {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 58px;
  height: 26px;
  border-radius: 999px;
  padding: 0 10px;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}

.badge.stopped {
  background: var(--red);
}

.badge.running {
  background: var(--green);
}

.badge.idle {
  background: #7c8796;
}

.badge.recording {
  background: var(--amber);
}

.badge.boosting {
  background: linear-gradient(180deg, #41e8d2, #179c87);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08), 0 0 16px rgba(65, 232, 210, 0.26);
}

.badge.dirty {
  background: #b07105;
}

.badge.waiting {
  background: #7c8796;
}

.badge.healthy {
  background: var(--green);
}

.badge.stale,
.badge.error {
  background: var(--red);
}

.status-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  max-width: 100%;
  min-height: 24px;
  padding: 3px 9px;
  border: 1px solid #cfd9e6;
  border-radius: 999px;
  color: #4e5b6d;
  background: #f4f7fb;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.2;
  text-align: center;
  white-space: nowrap;
}

.status-tag.healthy {
  border-color: #b6dfcf;
  color: #126343;
  background: #e9f7f1;
}

.status-tag.waiting {
  border-color: #cfd9e6;
  color: #657286;
  background: #f4f7fb;
}

.status-tag.error {
  border-color: #efc6be;
  color: #a63a2b;
  background: #fff1ee;
}

.param-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
}

.control-panel .param-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.param-section-title {
  grid-column: 1 / -1;
  margin-top: 4px;
  padding: 5px 0 4px;
  border-bottom: 1px solid var(--line);
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
}

.param-section-title:first-child {
  margin-top: 0;
}

.field {
  display: grid;
  gap: 5px;
}

.field.compact {
  min-width: 108px;
}

.wireless-field {
  min-width: min(260px, 100%);
}

.field input.inactive {
  color: #94a0b0;
  background: #f0f3f7;
}

.field span {
  font-size: 12px;
  font-weight: 700;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  color: var(--text);
  background: #fff;
  outline: none;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(35, 100, 170, 0.14);
}

.field textarea {
  min-height: 98px;
  padding-top: 9px;
  padding-bottom: 9px;
  line-height: 1.45;
  resize: vertical;
}

.toggle-line {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  margin-top: 19px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.toggle-line input {
  width: 18px;
  height: 18px;
}

.param-grid > .toggle-line {
  align-self: end;
  margin-top: 0;
}

.control-panel > .panel-heading {
  margin-bottom: 12px;
}

.control-panel .field {
  gap: 4px;
}

.control-panel .field input,
.control-panel .field select {
  min-height: 34px;
  padding-right: 8px;
  padding-left: 8px;
  font-size: 13px;
}

.tune-action-bar {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.tune-action-bar button {
  min-height: 36px;
  padding: 0 10px;
  font-size: 13px;
  font-weight: 800;
}

.tune-maintenance {
  margin-top: 10px;
  border-top: 1px solid var(--line);
}

.compact-details-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 42px;
  cursor: pointer;
  list-style: none;
}

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

.compact-details-summary span {
  color: #294e76;
  font-size: 12px;
  font-weight: 900;
}

.compact-details-summary small {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tune-maintenance-body {
  padding: 2px 0 2px;
  animation: compact-reveal var(--duration-enter) var(--ease-enter);
}

.button-row {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.button-row.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.button-row.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.command-box {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 70px;
  gap: 8px;
  align-items: end;
  margin-top: 14px;
}

.recording-box {
  display: grid;
  grid-template-columns: minmax(128px, 0.8fr) minmax(250px, 1.35fr) minmax(150px, 0.72fr);
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

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

.recording-box .panel-heading,
.recording-box .button-row,
.recording-box .mini-stats {
  margin: 0;
}

.recording-box .panel-heading.inline {
  align-items: center;
}

.recording-box .panel-heading h2 {
  font-size: 13px;
}

.recording-box .mini-stats {
  gap: 6px;
}

.recording-box .mini-stats div {
  min-height: 52px;
  padding: 7px 8px;
}

.recording-box .mini-stats span {
  margin-bottom: 2px;
  font-size: 11px;
}

.recording-box .mini-stats strong {
  font-size: 16px;
}

.mini-stats div,
.metric-item {
  padding: 10px;
  border: 1px solid #e6ebf2;
  border-radius: 8px;
  background: var(--panel-soft);
}

.mini-stats span,
.metric-item span {
  display: block;
  margin-bottom: 4px;
  font-size: 12px;
}

.mini-stats strong,
.metric-item strong {
  display: block;
  overflow-wrap: anywhere;
  font-size: 18px;
}

.metric-strip {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  padding: 12px;
  margin-bottom: 16px;
}

.chart-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 70px;
  margin-bottom: 16px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.95);
  box-shadow: var(--shadow);
}

.chart-toolbar h2 {
  margin: 0 0 4px;
  font-size: 16px;
}

.chart-toolbar span {
  display: block;
  font-size: 12px;
}

.chart-source-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.chart-source-row .source-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border: 1px solid #d6e1ed;
  border-radius: 7px;
  color: #40566f;
  background: #f7fbff;
  font: 800 11px/1.1 Consolas, "Cascadia Mono", "Microsoft YaHei", monospace;
}

.source-badge.live {
  border-color: rgba(22, 134, 91, 0.28);
  color: #126b4b;
  background: #edf8f3;
}

.source-badge.simulation {
  border-color: rgba(176, 113, 5, 0.30);
  color: #9a5d00;
  background: #fff8e9;
}

.source-badge.offline {
  border-color: #d6e1ed;
  color: #667488;
  background: #f3f6fa;
}

.source-badge.stale,
.source-badge.error {
  border-color: rgba(194, 65, 45, 0.28);
  color: #a33425;
  background: #fff1ee;
}

.history-field {
  grid-template-columns: auto 96px;
  align-items: center;
  flex: 0 0 auto;
}

.chart-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.chart-card {
  min-width: 0;
  padding: 14px;
}

.chart-card.wide {
  grid-column: 1 / -1;
}

.chart-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.chart-title h2 {
  flex: 0 0 auto;
  white-space: nowrap;
}

.series-toggles {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 5px 10px;
  min-height: 24px;
}

.series-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font: 12px/1 Consolas, "Cascadia Mono", monospace;
  cursor: pointer;
  white-space: nowrap;
}

.series-toggle input {
  width: 14px;
  height: 14px;
  margin: 0;
  accent-color: var(--blue);
}

.series-swatch {
  width: 14px;
  height: 3px;
  background: var(--blue);
}

.series-key-err .series-swatch {
  background: #657286;
}

.series-key-ferr .series-swatch,
.series-key-p .series-swatch,
.series-key-spdl .series-swatch {
  background: #2364aa;
}

.series-key-steer .series-swatch,
.series-key-spdr .series-swatch {
  background: #c2412d;
}

.series-key-i .series-swatch,
.series-key-pwml .series-swatch,
.series-key-vtgtl .series-swatch,
.series-key-bat .series-swatch {
  background: #16865b;
}

.series-key-d .series-swatch,
.series-key-vtgtr .series-swatch {
  background: #b07105;
}

.series-key-pwmr .series-swatch {
  background: #7048a8;
}

.series-key-vpwml .series-swatch {
  background: #3b82f6;
}

.series-key-vpwmr .series-swatch {
  background: #ef4444;
}

canvas {
  display: block;
  width: 100%;
  height: 190px;
  min-height: 178px;
}

.chart-card.wide canvas {
  height: 210px;
}

.side-panel {
  display: grid;
  gap: 16px;
}

.side-section {
  min-width: 0;
}

.side-section + .side-section {
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.sensor-heading {
  align-items: flex-start;
}

.sensor-heading span {
  display: block;
  margin-top: 4px;
  font-size: 11px;
}

#bitsValue {
  color: var(--blue-dark);
  font: 700 12px/1.4 Consolas, "Cascadia Mono", monospace;
  white-space: nowrap;
}

.sensor-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 7px;
  align-items: end;
  margin-bottom: 10px;
}

.sensor-controls button {
  padding: 0 10px;
  font-size: 12px;
}

.sensor-pin-editor {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(76px, 1fr));
  gap: 7px;
  margin: 0 0 10px;
}

.sensor-pin-field {
  min-width: 0;
}

.sensor-pin-field input {
  min-height: 32px;
  padding: 0 8px;
  font: 700 12px/1.2 Consolas, "Cascadia Mono", monospace;
}

.sensor-pin-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 34px;
  margin: -2px 0 10px;
}

.sensor-pin-actions button {
  min-height: 32px;
  padding: 0 10px;
  font-size: 12px;
}

.sensor-pin-draft {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.sensor-pin-draft.pending {
  color: var(--amber);
  font-weight: 800;
}

.sensor-axis,
.sensor-key {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 10px;
}

.sensor-axis {
  margin-bottom: 5px;
}

.sensor-axis::before {
  content: "";
  order: 2;
  flex: 1;
  height: 1px;
  background: var(--line);
}

.sensor-axis span:first-child {
  order: 1;
}

.sensor-axis span:last-child {
  order: 3;
}

.sensor-scroll {
  overflow-x: auto;
  padding-bottom: 3px;
}

.sensor-grid {
  display: grid;
  gap: 5px;
}

.sensor-grid.six {
  grid-template-columns: repeat(6, minmax(43px, 1fr));
  min-width: 283px;
}

.sensor-grid.eight {
  grid-template-columns: repeat(8, minmax(43px, 1fr));
  min-width: 379px;
}

.side-panel .sensor-grid.eight {
  grid-template-columns: repeat(8, minmax(0, 1fr));
  min-width: 0;
}

.sensor-cell {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-width: 0;
  min-height: 112px;
  border: 1px solid #d8e0ea;
  border-radius: 8px;
  padding: 7px 5px;
  color: #6a7482;
  background: #f7f9fc;
  text-align: center;
  transition: color 0.12s ease, border-color 0.12s ease, background 0.12s ease;
}

.side-panel .sensor-cell {
  padding-right: 3px;
  padding-left: 3px;
}

.sensor-cell.active {
  color: #fff;
  border-color: #1e252f;
  background: #1e252f;
}

.sensor-cell.unused {
  border-style: dashed;
  color: #9aa7b8;
  background: #f1f4f7;
}

.sensor-cell.unused.active {
  color: #fff;
  border-color: #1e252f;
  background: #1e252f;
}

.sensor-cell-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 3px;
}

.sensor-name {
  color: var(--text);
  font-size: 14px;
  font-weight: 800;
}

.side-panel .sensor-name {
  font-size: 11px;
}

.sensor-state {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.side-panel .sensor-state {
  font-size: 8px;
}

.sensor-pin {
  color: var(--blue-dark);
  font: 700 12px/1.1 Consolas, "Cascadia Mono", monospace;
}

.side-panel .sensor-pin {
  overflow-wrap: anywhere;
  font-size: 10px;
}

.sensor-probe,
.sensor-flips {
  font-size: 9px;
  line-height: 1.15;
  white-space: nowrap;
}

.side-panel .sensor-probe,
.side-panel .sensor-flips {
  font-size: 8px;
  white-space: normal;
}

.sensor-flips {
  font-family: Consolas, "Cascadia Mono", monospace;
}

.sensor-cell.active .sensor-name,
.sensor-cell.active .sensor-state,
.sensor-cell.active .sensor-pin,
.sensor-cell.active .sensor-probe,
.sensor-cell.active .sensor-flips {
  color: #fff;
}

.sensor-key {
  margin-top: 5px;
}

.sensor-key span + span::before {
  content: "·";
  margin-right: 8px;
}

.status-list {
  display: grid;
  gap: 8px;
  margin: 0;
}

.status-list div {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  min-height: 34px;
  padding: 7px 9px;
  border: 1px solid #e6ebf2;
  border-radius: 8px;
  background: var(--panel-soft);
}

.status-list dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.status-list dd {
  margin: 0;
  overflow-wrap: break-word;
  word-break: keep-all;
  font-weight: 700;
}

.comm-list div {
  grid-template-columns: 88px minmax(0, 1fr);
}

.raw-section {
  min-height: 310px;
}

@media (min-width: 1201px) {
  .side-panel .status-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .side-panel .status-list div {
    grid-template-columns: 70px minmax(0, 1fr);
  }
}

.small-btn {
  min-height: 30px;
  padding: 0 10px;
  border-color: #bed0e4;
  color: var(--blue-dark);
  background: #f7fbff;
  font-size: 12px;
  font-weight: 800;
}

.small-btn:hover {
  border-color: var(--blue);
  color: var(--blue-dark);
  background: #eaf2fb;
}

#rawLog {
  height: 260px;
  margin: 0;
  padding: 10px;
  overflow: auto;
  border: 1px solid #dfe6ef;
  border-radius: 8px;
  color: #17202c;
  background: #f8fafc;
  font: 12px/1.45 Consolas, "Cascadia Mono", monospace;
  white-space: pre-wrap;
}

@media (max-width: 1700px) {
  .topbar {
    grid-template-columns: minmax(220px, 0.36fr) minmax(0, 1fr);
    grid-template-areas:
      "brand actions";
  }

  .brand-block {
    grid-area: brand;
  }

  .top-actions {
    grid-area: actions;
  }
}

@media (max-width: 1200px) {
  .topbar {
    grid-template-columns: 1fr;
    grid-template-areas:
      "brand"
      "actions";
  }

  .top-page-tab {
    flex-basis: 116px;
  }

  .topbar-meta {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .page-grid.two,
  .remote-layout {
    grid-template-columns: 1fr;
  }

  .agent-chat-layout {
    grid-template-columns: 1fr;
  }

  .agent-conversation {
    min-height: 680px;
  }

  .agent-context-rail {
    grid-template-columns: minmax(0, 1fr);
  }

  .agent-drawer,
  .agent-drawer:nth-child(2n) {
    border-right: 0;
  }

  .remote-hud,
  .remote-pin-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .remote-cockpit {
    grid-template-columns: minmax(130px, 0.72fr) minmax(220px, 1.28fr);
  }

  .replay-toolbox {
    align-items: stretch;
  }

  .replay-toolbox button,
  .field.compact {
    flex: 1 1 120px;
  }

  .replay-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .session-grid {
    grid-template-columns: 1fr;
  }

  .dashboard {
    grid-template-columns: minmax(0, 1fr);
  }

  .param-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .side-panel {
    grid-column: 1;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .side-section + .side-section {
    padding-top: 0;
    border-top: 0;
  }

  .raw-section {
    min-height: auto;
  }
}

@media (max-width: 900px) {
  .app-shell {
    padding: 12px;
  }

  .agent-context-rail {
    grid-template-columns: minmax(0, 1fr);
  }

  .agent-drawer,
  .agent-drawer:nth-child(2n) {
    border-right: 0;
  }

  .agent-thread-head {
    flex-direction: column;
  }

  .app-workspace {
    grid-template-columns: 126px minmax(0, 1fr);
    gap: 12px;
  }

  .app-nav {
    top: 12px;
    padding: 8px;
  }

  .app-nav-item {
    grid-template-columns: 28px minmax(0, 1fr);
    min-height: 42px;
    padding: 0 5px;
  }

  .nav-icon {
    width: 26px;
    height: 24px;
    font-size: 8px;
  }

  .app-nav-item > span:last-child {
    font-size: 12px;
  }

  .topbar {
    align-items: stretch;
  }

  .topbar-meta {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .wiring-row {
    grid-template-columns: 64px minmax(0, 1fr) 24px minmax(0, 1fr);
  }

  .dashboard,
  .chart-grid,
  .side-panel {
    grid-template-columns: 1fr;
  }

  .page-intro {
    min-height: 0;
  }

  .remote-layout {
    grid-template-columns: 1fr;
  }

  .param-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .session-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .control-panel,
  .chart-panel,
  .side-panel {
    min-width: 0;
  }

  .metric-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .side-panel {
    grid-template-columns: 1fr;
  }

  .side-section + .side-section {
    padding-top: 14px;
    border-top: 1px solid var(--line);
  }
}

@media (max-width: 520px) {
  body {
    overflow-x: hidden;
  }

  .app-workspace {
    grid-template-columns: 1fr;
  }

  .app-nav {
    position: static;
    display: flex;
    align-items: stretch;
    gap: 5px;
    overflow-x: auto;
    padding: 6px;
  }

  .app-nav-title,
  .app-nav-footer {
    display: none;
  }

  .app-nav-item {
    flex: 0 0 auto;
    grid-template-columns: 26px auto;
    min-width: 104px;
  }

  .top-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: end;
  }

  .topbar-meta {
    grid-template-columns: minmax(0, 1fr);
  }

  .top-page-tab {
    flex: 0 0 108px;
  }

  .top-actions > * {
    width: 100%;
    min-width: 0;
  }

  .session-grid,
  .replay-summary {
    grid-template-columns: 1fr;
  }

  .remote-hud,
  .remote-pin-grid,
  .remote-cockpit {
    grid-template-columns: minmax(0, 1fr);
  }

  .remote-key {
    min-height: 62px;
    padding: 8px 5px;
  }

  .remote-meter {
    grid-template-columns: 68px minmax(0, 1fr) 68px;
  }

  .replay-toolbox {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .field.compact {
    flex-basis: auto;
  }

  .wiring-row {
    grid-template-columns: minmax(0, 1fr);
    gap: 5px;
  }

  .wiring-label {
    padding-top: 4px;
  }

  .wiring-arrow {
    display: none;
  }

  .brand-block {
    width: 100%;
  }

  .wireless-field {
    grid-column: auto;
  }

  .brand-block span {
    display: block;
    max-width: 100%;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .param-grid,
  .command-box,
  .field-grid.two {
    grid-template-columns: minmax(0, 1fr);
  }

  .field-full {
    grid-column: auto;
  }

  .page-intro {
    flex-direction: column;
  }

  .agent-context-rail {
    grid-template-columns: minmax(0, 1fr);
  }

  .agent-drawer,
  .agent-drawer:nth-child(2n) {
    border-right: 0;
  }

  .agent-thread-head,
  .agent-message {
    max-width: 100%;
  }

  .agent-message.user {
    max-width: 88%;
  }

  .agent-input-shell {
    grid-template-columns: minmax(0, 1fr);
  }

  .agent-send-actions {
    justify-content: flex-end;
  }

  .agent-cloud-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .replay-summary {
    grid-template-columns: minmax(0, 1fr);
  }

  button {
    padding-right: 10px;
    padding-left: 10px;
  }

  .button-row.three {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .button-row.two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .agent-cloud-head,
  .agent-learning-head {
    flex-direction: column;
  }

  #agentLearningProgress {
    white-space: normal;
  }

  .chart-toolbar,
  .chart-title {
    align-items: stretch;
    flex-direction: column;
  }

  .history-field {
    grid-template-columns: minmax(0, 1fr);
  }

  .series-toggles {
    justify-content: flex-start;
  }

  .sensor-controls {
    grid-template-columns: minmax(0, 1fr) 88px;
  }

  .sensor-grid {
    gap: 3px;
  }

  .sensor-grid.six,
  .sensor-grid.eight {
    min-width: 0;
  }

  .sensor-grid.six {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  .sensor-grid.eight {
    grid-template-columns: repeat(8, minmax(0, 1fr));
  }

  .sensor-cell {
    min-height: 104px;
    padding: 7px 3px;
  }

  .sensor-name {
    font-size: 12px;
  }

  .sensor-state {
    font-size: 9px;
  }

  .sensor-pin {
    font-size: 10px;
  }

  .sensor-probe,
  .sensor-flips {
    font-size: 8px;
  }

  .brand-block h1 {
    font-size: 21px;
  }
}

.remote-layout {
  grid-template-columns: minmax(0, 1fr);
}

.remote-stage-heading {
  align-items: flex-start;
}

.remote-stage-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  max-width: 720px;
}

.remote-stage-actions button {
  min-height: 34px;
  padding: 0 11px;
  font-size: 12px;
  font-weight: 800;
}

.remote-stage-actions > span:not(.badge) {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.remote-stage-actions > span.pending {
  color: var(--amber);
}

.remote-stage {
  position: relative;
  min-height: clamp(500px, calc(100vh - 260px), 740px);
  overflow: hidden;
  border: 1px solid #1e2d40;
  border-radius: 8px;
  color: #eef4fb;
  background:
    radial-gradient(circle at 17% 63%, rgba(92, 211, 197, 0.17), transparent 26%),
    radial-gradient(circle at 82% 38%, rgba(230, 166, 91, 0.12), transparent 28%),
    linear-gradient(180deg, rgba(29, 43, 59, 0.96), rgba(6, 11, 18, 0.98)),
    repeating-linear-gradient(90deg, rgba(102, 131, 158, 0.13) 0 1px, transparent 1px 86px),
    #0d1721;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    inset 0 0 86px rgba(0, 0, 0, 0.42);
  isolation: isolate;
}

.remote-stage::before,
.remote-stage::after {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  content: "";
}

.remote-stage::before {
  opacity: 0.3;
  background:
    linear-gradient(115deg, transparent 0 42%, rgba(133, 188, 213, 0.16) 48%, transparent 54%),
    radial-gradient(circle at 51% 111%, rgba(110, 189, 255, 0.12), transparent 30%);
  transform: translateX(-14%);
  animation: remoteStageSweep 12s var(--ease-standard) infinite alternate;
}

.remote-stage::after {
  opacity: 0.38;
  background:
    linear-gradient(90deg, transparent 0 48%, rgba(235, 241, 246, 0.22) 49%, transparent 50% 100%),
    repeating-linear-gradient(0deg, transparent 0 64px, rgba(233, 241, 248, 0.09) 65px, transparent 66px);
  mask-image: linear-gradient(180deg, transparent, #000 26%, #000 82%, transparent);
}

@keyframes remoteStageSweep {
  from {
    transform: translateX(-18%);
    opacity: 0.18;
  }
  to {
    transform: translateX(14%);
    opacity: 0.32;
  }
}

.remote-stage:fullscreen,
.remote-stage.is-fullscreen {
  width: 100vw;
  height: 100vh;
  min-height: 100vh;
  border: 0;
  border-radius: 0;
}

.remote-stage.editing {
  border-color: #f0b340;
  box-shadow:
    inset 0 0 0 2px rgba(240, 179, 64, 0.32),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.remote-stage-status {
  position: absolute;
  z-index: 4;
  top: 10px;
  right: 10px;
  left: auto;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  width: min(240px, 32vw);
  gap: 3px;
}

.remote-stage .remote-hud div {
  border-color: rgba(206, 220, 238, 0.18);
  background: rgba(9, 16, 26, 0.66);
}

.remote-stage .remote-hud div {
  min-height: 34px;
  padding: 5px 7px;
}

.remote-stage .remote-hud span {
  color: #aebbd0;
  font-size: 9px;
}

.remote-stage .remote-hud strong {
  color: #fff;
  margin-top: 1px;
  font-size: 11px;
}

.remote-drive-readout {
  position: absolute;
  z-index: 4;
  bottom: 12px;
  left: 12px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 6px;
  max-width: min(560px, calc(100% - 24px));
  pointer-events: none;
}

.remote-drive-readout span {
  min-height: 22px;
  padding: 4px 7px;
  border: 1px solid rgba(206, 220, 238, 0.2);
  border-radius: 999px;
  color: #d9e6f5;
  background: rgba(9, 16, 26, 0.54);
  font: 800 9px/1.2 Consolas, "Cascadia Mono", monospace;
  white-space: nowrap;
}

.remote-stage-hint {
  position: absolute;
  z-index: 4;
  right: 14px;
  bottom: 14px;
  max-width: min(420px, calc(100% - 28px));
  padding: 5px 8px;
  border-radius: 999px;
  background: rgba(9, 16, 26, 0.52);
  pointer-events: none;
  text-align: right;
}

.remote-exit-fullscreen {
  position: absolute;
  z-index: 8;
  top: 12px;
  left: 12px;
  display: none;
  min-height: 32px;
  padding: 0 10px;
  border-color: rgba(206, 220, 238, 0.24);
  color: #eef4fb;
  background: rgba(9, 16, 26, 0.64);
}

.remote-stage.is-fullscreen .remote-exit-fullscreen {
  display: inline-grid;
  place-items: center;
}

.remote-control-tuning {
  position: static;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  width: 100%;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfe;
}

.remote-control-tuning .field span {
  color: var(--muted);
}

.remote-control-tuning .field span strong {
  color: var(--blue-dark);
}

.remote-control-tuning input {
  background: transparent;
}

.remote-target-readout {
  display: grid;
  align-content: center;
  min-height: 38px;
  padding: 7px 10px;
  border: 1px solid #dfe6ef;
  border-radius: 8px;
  background: #fff;
}

.remote-target-readout span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.remote-target-readout strong {
  margin-top: 4px;
  overflow-wrap: anywhere;
  color: var(--blue-dark);
  font-size: 12px;
}

.remote-stage-controls,
.remote-stage-dashboards {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.remote-joystick-widget,
.remote-stage-key,
.remote-dashboard-widget {
  position: absolute;
  z-index: 3;
  pointer-events: auto;
  touch-action: none;
}

.remote-joystick-widget {
  display: grid;
  place-items: center;
  min-width: 210px;
  min-height: 210px;
  overflow: visible;
  --joystick-accent: #e3a560;
  --joystick-icon: #b4b9bd;
  --joystick-x: 0;
  --joystick-y: 0;
  --joystick-tilt-x: 0deg;
  --joystick-tilt-y: 0deg;
}

.remote-joystick-face {
  position: relative;
  display: grid;
  place-items: center;
  width: min(100%, 270px);
  height: min(100%, 270px);
  pointer-events: none;
}

.remote-joystick-around,
.remote-joystick-handle,
.remote-joystick-wrapper,
.remote-joystick-inside {
  display: grid;
  place-items: center;
  border-radius: 50%;
}

.remote-joystick-around {
  width: 74%;
  height: 74%;
  background-image: linear-gradient(0deg, #f5f8fa, #9da4a8);
  box-shadow:
    0 18px 32px rgba(0, 0, 0, 0.38),
    0 0 28px rgba(219, 235, 240, 0.18);
}

.remote-joystick-handle {
  width: 77.5%;
  height: 77.5%;
  background: #c5d1da;
  box-shadow:
    0 0 10px rgba(0, 0, 0, 0.5),
    0 10px 10px rgba(0, 0, 0, 0.2),
    inset 0 0 16px rgba(0, 0, 0, 0.85),
    inset 0 0 24px rgba(0, 0, 0, 0.75),
    inset 0 0 48px rgba(0, 0, 0, 0.2);
  perspective: 300px;
}

.remote-joystick-wrapper {
  width: 65.8%;
  height: 65.8%;
  background-image: linear-gradient(0deg, #86969c, #eff1f1);
  box-shadow:
    0 9px 14px rgba(0, 0, 0, 0.5),
    0 19px 8px -2px rgba(0, 0, 0, 0.2),
    0 33px 8px rgba(0, 0, 0, 0.34),
    0 -12px 10px rgba(255, 255, 255, 0.5),
    inset 0 3px 3px rgba(255, 255, 255, 0.6),
    inset 0 -3px 3px rgba(89, 91, 92, 0.6);
  transform:
    translate(calc(var(--joystick-x) * 8px), calc(var(--joystick-y) * 8px))
    rotateX(var(--joystick-tilt-x))
    rotateY(var(--joystick-tilt-y));
  transform-style: preserve-3d;
  transition: transform 0.12s ease-out, box-shadow 0.12s ease-out;
}

.remote-joystick-inside {
  position: relative;
  width: 83.3%;
  height: 83.3%;
  background-image: linear-gradient(180deg, #adb9bf, #d4dbdd);
  box-shadow:
    inset 0 3px 6px rgba(152, 160, 163, 0.4),
    inset 0 -3px 6px rgba(238, 244, 246, 0.4);
}

.remote-joystick-dot {
  position: absolute;
  width: 9.4%;
  height: 9.4%;
  border-radius: 50%;
  background: #e7ecef;
  box-shadow:
    0 2px 2px rgba(0, 0, 0, 0.3),
    inset 0 -2px 2px rgba(0, 0, 0, 0.2);
  transform: translate(-50%, -50%);
}

.remote-joystick-dot:nth-child(1) {
  top: 10%;
  left: 50%;
}

.remote-joystick-dot:nth-child(2) {
  top: 50%;
  left: 90%;
}

.remote-joystick-dot:nth-child(3) {
  top: 90%;
  left: 50%;
}

.remote-joystick-dot:nth-child(4) {
  top: 50%;
  left: 10%;
}

.remote-joystick-icon {
  position: absolute;
  z-index: 2;
  width: 12%;
  min-width: 20px;
  max-width: 34px;
  fill: var(--joystick-icon);
  filter: drop-shadow(1px 1px 1px #f4f4f4);
  transform: translate(-50%, -50%) rotate(var(--icon-rotation));
  transition: fill 0.12s ease-out, filter 0.12s ease-out, transform 0.12s ease-out;
}

.remote-joystick-icon-top {
  top: 7%;
  left: 50%;
}

.remote-joystick-icon-right {
  top: 50%;
  left: 93%;
}

.remote-joystick-icon-bottom {
  top: 93%;
  left: 50%;
}

.remote-joystick-icon-left {
  top: 50%;
  left: 7%;
}

.remote-joystick-widget[data-joystick-action="forward"] {
  --joystick-y: -1;
  --joystick-tilt-x: 8deg;
}

.remote-joystick-widget[data-joystick-action="reverse"] {
  --joystick-y: 1;
  --joystick-tilt-x: -8deg;
}

.remote-joystick-widget[data-joystick-action="left"] {
  --joystick-x: -1;
  --joystick-tilt-y: -8deg;
}

.remote-joystick-widget[data-joystick-action="right"] {
  --joystick-x: 1;
  --joystick-tilt-y: 8deg;
}

.remote-joystick-widget[data-joystick-action="forward"] .remote-joystick-icon-top,
.remote-joystick-widget[data-joystick-action="reverse"] .remote-joystick-icon-bottom,
.remote-joystick-widget[data-joystick-action="left"] .remote-joystick-icon-left,
.remote-joystick-widget[data-joystick-action="right"] .remote-joystick-icon-right {
  fill: var(--joystick-accent);
  filter:
    brightness(0.9)
    drop-shadow(0 0 2px var(--joystick-accent))
    drop-shadow(0 0 1px #fff);
  transform: translate(-50%, -50%) rotate(var(--icon-rotation)) scale(1.18);
}

.remote-joystick-widget[data-joystick-action]:not([data-joystick-action="idle"]) .remote-joystick-wrapper {
  box-shadow:
    0 7px 14px rgba(0, 0, 0, 0.5),
    0 14px 8px -5px rgba(0, 0, 0, 0.3),
    0 24px 8px rgba(0, 0, 0, 0.34),
    0 -6px 10px rgba(255, 255, 255, 0.5),
    inset 0 3px 3px rgba(255, 255, 255, 0.6),
    inset 0 -3px 3px rgba(89, 91, 92, 0.6);
}

.remote-stage-key {
  position: absolute;
  display: grid;
  place-items: center;
  min-height: 0;
  padding: 0;
  overflow: hidden;
  border-radius: 999px;
  border: 0;
  color: #fff;
  background: transparent;
  box-shadow: none;
  isolation: isolate;
  --drive-accent: #64deca;
  --drive-accent-2: #bffbf2;
  --drive-core: #1b3440;
  --drive-rim: #748893;
  --drive-shadow: rgba(84, 211, 198, 0.34);
  --drive-warn: #ef7568;
  transition:
    transform var(--duration-fast) var(--ease-standard),
    filter var(--duration-fast) var(--ease-standard);
}

.remote-drive-button-face {
  position: relative;
  display: grid;
  place-items: center;
  width: min(100%, 196px);
  height: min(100%, 112px);
  border-radius: 999px;
  pointer-events: none;
}

.remote-drive-button-aura,
.remote-drive-button-rim,
.remote-drive-button-core,
.remote-drive-button-motion {
  position: absolute;
  border-radius: 999px;
}

.remote-drive-button-aura {
  inset: 0 4%;
  opacity: 0.9;
  background:
    radial-gradient(ellipse at 52% 50%, var(--drive-shadow), transparent 62%),
    linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.18), transparent);
  filter: blur(10px);
  transform: scale(0.98);
  transition:
    opacity var(--duration-enter) var(--ease-enter),
    transform var(--duration-enter) var(--ease-enter);
}

.remote-drive-button-rim {
  inset: 5% 3%;
  display: grid;
  place-items: center;
  background:
    linear-gradient(180deg, rgba(248, 253, 255, 0.58), transparent 19%),
    linear-gradient(90deg, rgba(255, 255, 255, 0.04), transparent 20% 80%, rgba(255, 255, 255, 0.05)),
    radial-gradient(ellipse at 50% 25%, #9fb0b9, var(--drive-rim) 42%, #313c45 76%);
  box-shadow:
    inset 0 1px 4px rgba(255, 255, 255, 0.35),
    inset 0 -16px 28px rgba(0, 0, 0, 0.32),
    0 15px 28px rgba(0, 0, 0, 0.38);
}

.remote-drive-button-core {
  inset: 13% 14%;
  display: grid;
  place-items: center;
  overflow: hidden;
  background:
    radial-gradient(circle at 45% 22%, rgba(255, 255, 255, 0.24), transparent 34%),
    linear-gradient(90deg, rgba(255, 255, 255, 0.05), transparent 18% 82%, rgba(255, 255, 255, 0.08)),
    linear-gradient(180deg, rgba(117, 136, 146, 0.72), var(--drive-core));
  box-shadow:
    inset 0 1px 2px rgba(255, 255, 255, 0.32),
    inset 0 -11px 20px rgba(0, 0, 0, 0.38),
    0 0 0 1px rgba(255, 255, 255, 0.09);
  transition:
    inset var(--duration-fast) var(--ease-standard),
    box-shadow var(--duration-fast) var(--ease-standard);
}

.remote-drive-button-motion {
  inset: 12% 12%;
  display: grid;
  place-items: center;
  opacity: 0.78;
}

.remote-drive-button-line {
  position: absolute;
  width: 68%;
  height: 13%;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, rgba(240, 252, 255, 0.68), transparent);
  box-shadow: 0 0 12px rgba(236, 248, 255, 0.24);
  transform: translateX(calc((var(--line-index) - 1) * -20px));
  opacity: calc(0.24 + var(--line-index) * 0.18);
  animation: remoteBoostStream 1.45s var(--ease-enter) infinite;
  animation-delay: calc(var(--line-index) * 120ms);
}

.remote-key-action-boost {
  --drive-accent: #44f2d2;
  --drive-accent-2: #e4fff9;
  --drive-core: #0f3540;
  --drive-rim: #6c828c;
  --drive-shadow: rgba(68, 242, 210, 0.48);
}

.remote-key-action-brake {
  --drive-accent: #ff5d4f;
  --drive-accent-2: #ffe2d9;
  --drive-core: #4f272d;
  --drive-rim: #88797c;
  --drive-shadow: rgba(255, 93, 79, 0.44);
}

.remote-key-action-boost .remote-drive-button-core {
  background:
    radial-gradient(circle at 44% 22%, rgba(228, 255, 249, 0.28), transparent 34%),
    radial-gradient(ellipse at 70% 52%, rgba(68, 242, 210, 0.22), transparent 46%),
    linear-gradient(90deg, rgba(228, 255, 249, 0.07), transparent 18% 82%, rgba(228, 255, 249, 0.1)),
    linear-gradient(180deg, rgba(102, 134, 143, 0.76), var(--drive-core));
}

.remote-key-action-brake .remote-drive-button-core {
  background:
    radial-gradient(circle at 42% 22%, rgba(255, 226, 217, 0.24), transparent 34%),
    radial-gradient(ellipse at 50% 52%, rgba(255, 93, 79, 0.24), transparent 50%),
    linear-gradient(90deg, rgba(255, 226, 217, 0.06), transparent 18% 82%, rgba(255, 226, 217, 0.08)),
    linear-gradient(180deg, rgba(125, 93, 95, 0.78), var(--drive-core));
}

.remote-key-action-brake .remote-drive-button-line {
  width: 12%;
  height: 72%;
  background: linear-gradient(180deg, transparent, rgba(255, 226, 217, 0.78), transparent);
  transform: translateX(calc((var(--line-index) - 1) * 20px));
  animation: remoteBrakeClamp 1.35s var(--ease-enter) infinite;
  animation-delay: calc(var(--line-index) * 80ms);
}

.remote-drive-button-icon {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 2;
}

.remote-drive-button-icon::before,
.remote-drive-button-icon::after {
  position: absolute;
  display: block;
  pointer-events: none;
  content: "";
}

.remote-drive-button-icon-boost::before {
  left: 12%;
  top: 50%;
  width: 18%;
  height: 58%;
  border: 1px solid rgba(228, 255, 249, 0.42);
  border-radius: 999px 7px 7px 999px;
  background:
    radial-gradient(ellipse at 72% 50%, rgba(228, 255, 249, 0.78), transparent 36%),
    linear-gradient(90deg, rgba(6, 16, 22, 0.88), rgba(20, 58, 66, 0.9));
  box-shadow:
    inset 0 0 10px rgba(0, 0, 0, 0.74),
    0 0 12px rgba(68, 242, 210, 0.24);
  transform: translateY(-50%);
}

.remote-drive-button-icon-boost::after {
  right: 10%;
  top: 50%;
  width: 16%;
  height: 3px;
  border-radius: 999px;
  background: var(--drive-accent-2);
  box-shadow:
    0 -12px 0 rgba(228, 255, 249, 0.38),
    0 12px 0 rgba(228, 255, 249, 0.38),
    0 0 13px var(--drive-accent);
  opacity: 0.62;
  transform: translateY(-50%);
  animation: remoteBoostAfterburner 1.08s var(--ease-enter) infinite;
}

.remote-drive-button-icon-brake::before {
  left: 50%;
  top: 50%;
  width: 76%;
  height: 66%;
  border-left: 5px solid rgba(255, 226, 217, 0.86);
  border-right: 5px solid rgba(255, 226, 217, 0.86);
  border-radius: 999px;
  box-shadow:
    inset 0 0 12px rgba(255, 93, 79, 0.22),
    0 0 14px rgba(255, 93, 79, 0.24);
  opacity: 0.74;
  transform: translate(-50%, -50%);
  animation: remoteBrakeClamp 1.2s var(--ease-enter) infinite;
}

.remote-drive-button-icon-brake::after {
  right: 17%;
  top: 31%;
  width: 22%;
  height: 3px;
  border-radius: 999px;
  background: #ffe2d9;
  box-shadow:
    8px 9px 0 rgba(255, 226, 217, 0.62),
    0 0 10px rgba(255, 93, 79, 0.72);
  opacity: 0.68;
  transform: rotate(-18deg);
  animation: remoteBrakeSpark 1.2s var(--ease-enter) infinite;
}

.remote-boost-thrust {
  position: absolute;
  left: 25%;
  top: 50%;
  width: 35%;
  height: 52%;
  border-radius: 999px;
  background:
    linear-gradient(90deg, rgba(68, 242, 210, 0.06), rgba(68, 242, 210, 0.72), rgba(228, 255, 249, 0.04)),
    radial-gradient(ellipse at 74% 50%, rgba(228, 255, 249, 0.92), transparent 55%);
  clip-path: polygon(0 16%, 72% 16%, 100% 50%, 72% 84%, 0 84%, 18% 50%);
  filter: drop-shadow(0 0 13px rgba(68, 242, 210, 0.54));
  opacity: 0.78;
  transform: translateY(-50%);
  animation: remoteBoostThrust 1.08s var(--ease-enter) infinite;
}

.remote-boost-chevron {
  position: absolute;
  left: calc(48% + var(--chevron-index) * 12%);
  top: 50%;
  width: 18%;
  height: 48%;
  border-top: 3px solid var(--drive-accent-2);
  border-right: 3px solid var(--drive-accent-2);
  border-radius: 3px 4px 3px 0;
  filter:
    drop-shadow(0 0 5px var(--drive-accent))
    drop-shadow(0 0 13px var(--drive-shadow));
  opacity: calc(0.48 + var(--chevron-index) * 0.18);
  transform: translate(-50%, -50%) rotate(45deg);
  animation: remoteBoostChevron 1.08s var(--ease-enter) infinite;
  animation-delay: calc(var(--chevron-index) * 90ms);
}

.remote-brake-disc {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 56%;
  aspect-ratio: 1;
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(255, 236, 230, 0.9) 0 8%, rgba(25, 16, 17, 0.9) 9% 26%, transparent 27%),
    conic-gradient(from 8deg, transparent 0 10%, rgba(255, 93, 79, 0.98) 11% 17%, transparent 18% 28%, rgba(255, 226, 217, 0.78) 29% 34%, transparent 35% 54%, rgba(255, 93, 79, 0.98) 55% 62%, transparent 63% 100%);
  box-shadow:
    inset 0 0 0 2px rgba(255, 226, 217, 0.42),
    0 0 20px rgba(255, 93, 79, 0.58);
  transform: translate(-50%, -50%);
  animation: remoteBrakeDisc 1.25s var(--ease-standard) infinite;
}

.remote-brake-caliper {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 72%;
  height: 48%;
  border-right: 8px solid rgba(255, 226, 217, 0.92);
  border-left: 8px solid rgba(255, 226, 217, 0.92);
  border-radius: 999px;
  box-shadow:
    inset 0 0 12px rgba(255, 93, 79, 0.22),
    0 0 15px rgba(255, 93, 79, 0.34);
  transform: translate(-50%, -50%);
  animation: remoteBrakeCaliper 1.25s var(--ease-enter) infinite;
}

.remote-stage-key:hover .remote-drive-button-aura {
  opacity: 0.95;
  transform: scale(1.04);
}

.remote-stage-key:hover .remote-drive-button-core {
  box-shadow:
    inset 0 1px 2px rgba(255, 255, 255, 0.34),
    inset 0 -11px 20px rgba(0, 0, 0, 0.4),
    0 0 0 1px rgba(255, 255, 255, 0.12),
    0 0 18px var(--drive-shadow);
}

.remote-stage-key.active {
  transform: translateY(2px);
  filter: saturate(1.08) brightness(1.04);
}

.remote-stage-key.active .remote-drive-button-aura {
  opacity: 1;
  transform: scale(1.12);
}

.remote-stage-key.active .remote-drive-button-core {
  inset: 16% 17%;
  box-shadow:
    inset 0 1px 3px rgba(255, 255, 255, 0.22),
    inset 0 10px 18px rgba(0, 0, 0, 0.38),
    0 0 20px var(--drive-shadow);
}

.remote-key-action-boost.active {
  filter: saturate(1.16) brightness(1.08);
}

.remote-key-action-boost.active .remote-drive-button-aura {
  opacity: 1;
  transform: scale(1.14);
}

.remote-key-action-boost.active .remote-drive-button-core {
  box-shadow:
    inset 0 1px 3px rgba(255, 255, 255, 0.24),
    inset 0 10px 18px rgba(0, 0, 0, 0.34),
    0 0 28px rgba(65, 232, 210, 0.32);
}

.remote-key-action-brake.active {
  filter: saturate(1.1) brightness(1.06);
}

.remote-key-action-brake.active .remote-drive-button-core {
  box-shadow:
    inset 0 1px 3px rgba(255, 255, 255, 0.22),
    inset 0 10px 18px rgba(0, 0, 0, 0.34),
    0 0 28px rgba(255, 93, 79, 0.3);
}

.remote-stage-key.active .remote-drive-button-line {
  background: var(--drive-accent);
  box-shadow:
    0 0 9px var(--drive-accent),
    0 0 18px var(--drive-shadow);
  animation-duration: 0.72s;
}

.remote-stage-key.active .remote-boost-chevron {
  border-color: var(--drive-accent);
  animation-duration: 0.62s;
}

.remote-stage-key.active .remote-boost-thrust,
.remote-stage-key.active .remote-brake-disc,
.remote-stage-key.active .remote-brake-caliper {
  animation-duration: 0.62s;
}

.remote-stage-key.active .remote-drive-button-icon-boost::after,
.remote-stage-key.active .remote-drive-button-icon-brake::before,
.remote-stage-key.active .remote-drive-button-icon-brake::after {
  animation-duration: 0.62s;
}

@keyframes remoteBoostStream {
  0% {
    opacity: 0.08;
    translate: -10px 0;
  }
  42% {
    opacity: 0.78;
  }
  100% {
    opacity: 0.1;
    translate: 14px 0;
  }
}

@keyframes remoteBoostChevron {
  0%, 100% {
    opacity: 0.42;
    translate: -3px 0;
  }
  48% {
    opacity: 0.95;
    translate: 5px 0;
  }
}

@keyframes remoteBoostThrust {
  0%, 100% {
    opacity: 0.38;
    scale: 0.92 0.86;
  }
  45% {
    opacity: 0.82;
    scale: 1.06 1;
  }
}

@keyframes remoteBoostAfterburner {
  0%, 100% {
    opacity: 0.34;
    translate: -6px 0;
  }
  45% {
    opacity: 0.92;
    translate: 8px 0;
  }
}

@keyframes remoteBrakeClamp {
  0%, 100% {
    opacity: 0.28;
    scale: 1 0.82;
  }
  45% {
    opacity: 0.9;
    scale: 1 1.05;
  }
}

@keyframes remoteBrakeDisc {
  0%, 100% {
    opacity: 0.58;
    rotate: -4deg;
  }
  45% {
    opacity: 1;
    rotate: 4deg;
  }
}

@keyframes remoteBrakeCaliper {
  0%, 100% {
    opacity: 0.46;
    scale: 1.08 0.94;
  }
  45% {
    opacity: 0.95;
    scale: 0.92 1;
  }
}

@keyframes remoteBrakeSpark {
  0%, 100% {
    opacity: 0.28;
    translate: 0 0;
  }
  42% {
    opacity: 0.95;
    translate: 7px -4px;
  }
}

.remote-joystick-widget.selected,
.remote-stage-key.selected,
.remote-dashboard-widget.selected {
  outline: 2px solid #f0b340;
  outline-offset: 3px;
}

.remote-stage.editing .remote-joystick-widget,
.remote-stage.editing .remote-stage-key,
.remote-stage.editing .remote-dashboard-widget {
  cursor: move;
}

.remote-dashboard-widget {
  display: grid;
  place-items: center;
  min-width: 88px;
  min-height: 88px;
  padding: 0;
  overflow: visible;
  border: 1px solid rgba(196, 217, 229, 0.18);
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 50%, rgba(90, 214, 202, 0.12), transparent 58%),
    rgba(4, 11, 18, 0.66);
  box-shadow:
    0 0 0 1px rgba(235, 244, 249, 0.06),
    0 16px 28px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(8px);
  text-align: center;
  --needle-angle: -124deg;
  --gauge-fill: 0%;
  --gauge-accent: #61d8c9;
  --gauge-accent-soft: rgba(97, 216, 201, 0.32);
  --gauge-needle: #e9f7fb;
}

.remote-dashboard-widget[data-remote-dashboard-id="battery"] {
  --gauge-accent: #e7b76d;
  --gauge-accent-soft: rgba(231, 183, 109, 0.32);
  --gauge-needle: #fff0d0;
}

.remote-gauge-face {
  position: relative;
  width: 100%;
  height: 100%;
  min-width: 88px;
  min-height: 88px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 40% 25%, rgba(255, 255, 255, 0.12), transparent 24%),
    radial-gradient(circle at 50% 52%, #09111a 0 45%, #05080d 65%, #172532 66%, #5f6b74 68%, #1a2632 71%, #05070b 100%);
  box-shadow:
    inset 0 0 0 1px rgba(238, 247, 250, 0.1),
    inset 0 0 0 7px rgba(4, 8, 12, 0.88),
    inset 0 0 24px rgba(0, 0, 0, 0.82);
}

.remote-gauge-face::before {
  position: absolute;
  inset: 11%;
  border-radius: 50%;
  background:
    conic-gradient(from 236deg, var(--gauge-accent) 0 var(--gauge-fill), rgba(215, 228, 237, 0.16) var(--gauge-fill) 68%, transparent 68% 100%);
  mask: radial-gradient(circle, transparent 0 68%, #000 69% 75%, transparent 76%);
  box-shadow:
    0 0 14px var(--gauge-accent-soft);
  content: "";
}

.remote-gauge-face::after {
  position: absolute;
  inset: 21%;
  border-radius: 50%;
  background:
    radial-gradient(circle at 48% 38%, rgba(255, 255, 255, 0.08), transparent 30%),
    radial-gradient(circle at 50% 55%, rgba(7, 12, 18, 0.96) 0 46%, rgba(13, 19, 26, 0.76) 47%, transparent 49%);
  box-shadow:
    inset 0 0 18px rgba(0, 0, 0, 0.78),
    0 0 0 1px rgba(255, 255, 255, 0.05);
  content: "";
}

.remote-gauge-ticks {
  position: absolute;
  inset: 12%;
  z-index: 2;
  border-radius: 50%;
}

.remote-gauge-ticks b {
  position: absolute;
  top: 5%;
  left: 50%;
  width: 1px;
  height: 6.5%;
  border-radius: 999px;
  background: rgba(220, 233, 240, 0.58);
  box-shadow: none;
  transform: translateX(-50%) rotate(calc(-124deg + var(--tick-index) * 12.4deg));
  transform-origin: 50% 560%;
}

.remote-gauge-ticks b.major {
  width: 2px;
  height: 10%;
  background: rgba(242, 248, 250, 0.88);
}

.remote-gauge-scale {
  position: absolute;
  inset: 18%;
  z-index: 3;
  pointer-events: none;
}

.remote-gauge-scale em {
  position: absolute;
  color: rgba(223, 235, 242, 0.8);
  font: 800 clamp(7px, 0.52vw, 11px)/1 Consolas, "Cascadia Mono", monospace;
  font-style: normal;
  text-shadow: 0 0 8px rgba(95, 211, 202, 0.16);
}

.remote-gauge-scale em:nth-child(1) {
  left: 6%;
  bottom: 31%;
}

.remote-gauge-scale em:nth-child(2) {
  top: 5%;
  left: 50%;
  transform: translateX(-50%);
}

.remote-gauge-scale em:nth-child(3) {
  right: 5%;
  bottom: 31%;
}

.remote-gauge-needle {
  position: absolute;
  z-index: 5;
  left: 50%;
  bottom: 44%;
  width: 2.4%;
  height: 44%;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--gauge-needle), var(--gauge-accent) 62%, rgba(22, 30, 38, 0.92));
  box-shadow:
    0 0 5px var(--gauge-accent-soft),
    0 0 12px rgba(255, 255, 255, 0.12);
  transform: translateX(-50%) rotate(var(--needle-angle));
  transform-origin: 50% 92%;
  transition: transform var(--duration-normal) var(--ease-enter);
}

.remote-gauge-hub {
  position: absolute;
  z-index: 6;
  left: 50%;
  top: 54%;
  width: 16%;
  height: 16%;
  border: 2px solid rgba(221, 235, 242, 0.18);
  border-radius: 50%;
  background: radial-gradient(circle at 50% 45%, #111b24 0 38%, #030609 72%);
  box-shadow:
    inset 0 0 10px rgba(0, 0, 0, 0.86),
    0 0 8px var(--gauge-accent-soft);
  transform: translate(-50%, -50%);
}

.remote-gauge-readout {
  position: absolute;
  z-index: 7;
  right: 18%;
  bottom: 9%;
  left: 18%;
  display: grid;
  justify-items: center;
  gap: 0;
  padding: 3px 4px;
  border: 1px solid rgba(219, 234, 243, 0.16);
  border-radius: 5px;
  background:
    linear-gradient(180deg, rgba(13, 23, 31, 0.9), rgba(5, 9, 14, 0.96));
  box-shadow:
    inset 0 0 9px rgba(0, 0, 0, 0.68),
    0 0 10px rgba(92, 211, 202, 0.08);
  pointer-events: none;
}

.remote-gauge-readout span {
  color: rgba(197, 214, 224, 0.72);
  font-size: clamp(6px, 0.4vw, 8px);
  font-weight: 900;
  letter-spacing: 0.08em;
}

.remote-gauge-readout strong {
  color: #edf8fb;
  max-width: 100%;
  overflow: hidden;
  margin-top: 1px;
  font: 900 clamp(8px, 0.6vw, 12px)/1.08 Consolas, "Cascadia Mono", monospace;
  text-shadow: 0 0 10px var(--gauge-accent-soft);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.remote-gauge-readout small {
  display: none;
}

.remote-dashboard-widget[data-gauge-live="active"] {
  box-shadow:
    0 0 0 1px rgba(244, 250, 255, 0.08),
    0 0 22px var(--gauge-accent-soft),
    0 16px 28px rgba(0, 0, 0, 0.3);
}

.remote-command-panel {
  margin-top: 0;
}

.motor-pin-config {
  margin: 12px 0 12px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.motor-pin-config .remote-pin-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.motor-pin-config .remote-pin-grid input {
  min-height: 32px;
  padding: 0 8px;
  font: 700 12px/1.2 Consolas, "Cascadia Mono", monospace;
}

.remote-side-rail .remote-control-tuning {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.remote-side-rail .remote-target-readout {
  grid-column: 1 / -1;
}

.remote-side-rail .remote-command-panel {
  margin-top: 0;
}

.remote-side-rail .remote-command-details {
  max-width: none;
}

@media (max-width: 1200px) {
  .agent-chat-layout,
  .remote-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .agent-context-rail,
  .remote-side-rail {
    grid-template-columns: minmax(0, 1fr);
  }

  .remote-stage {
    min-height: 520px;
  }

  .remote-control-tuning {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .agent-context-rail,
  .remote-side-rail {
    grid-template-columns: minmax(0, 1fr);
  }

  .remote-stage-heading {
    display: grid;
  }

  .remote-stage-actions {
    justify-content: flex-start;
    max-width: 100%;
  }

  .remote-stage {
    min-height: 520px;
  }

  .remote-stage-status {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: min(260px, 44vw);
  }

  .remote-control-tuning {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  .remote-stage {
    min-height: 520px;
  }

  .remote-stage-status {
    right: 10px;
    width: min(230px, calc(100% - 20px));
  }

  .remote-control-tuning {
    grid-template-columns: minmax(0, 1fr);
  }

  .agent-quick-prompts {
    grid-template-columns: minmax(0, 1fr);
  }

  .remote-stage-key {
    min-width: 66px;
  }

  .motor-pin-config .remote-pin-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

body.native-android {
  --shadow: 0 6px 16px rgba(40, 51, 70, 0.06);
  background: var(--bg);
  overscroll-behavior: none;
}

body.native-android .app-shell {
  max-width: none;
  padding: 8px;
}

body.native-android .app-shell.nav-collapsed .app-workspace {
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 8px;
}

body.native-android .app-nav {
  top: 8px;
  padding: 6px;
  box-shadow: none;
}

body.native-android .topbar {
  grid-template-columns: minmax(132px, 0.34fr) minmax(0, 1fr);
  grid-template-areas: "brand actions";
  gap: 8px;
  margin-bottom: 8px;
  padding: 9px 10px;
  box-shadow: none;
}

body.native-android .brand-block {
  grid-area: brand;
}

body.native-android .top-actions {
  grid-area: actions;
}

body.native-android .brand-block h1 {
  font-size: 18px;
}

body.native-android .brand-block span {
  margin-top: 2px;
  font-size: 10px;
}

body.native-android .top-actions {
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 6px;
}

body.native-android .native-device-field {
  display: grid;
}

body.native-android .top-actions .field span {
  font-size: 9px;
  white-space: nowrap;
}

body.native-android .wireless-field {
  display: none;
}

body.native-android button,
body.native-android .field input,
body.native-android .field select,
body.native-android .field textarea {
  min-height: 32px;
}

body.native-android button {
  padding: 0 10px;
  transition-duration: 60ms;
}

body.native-android .page-intro {
  min-height: 0;
  margin-bottom: 8px;
  padding-bottom: 8px;
}

body.native-android .page-intro h2 {
  font-size: 20px;
}

body.native-android .page-intro p {
  margin-top: 3px;
  font-size: 12px;
}

body.native-android .panel,
body.native-android .workspace-section,
body.native-android .topbar,
body.native-android .app-nav {
  border-radius: 7px;
}

body.native-android .remote-stage-heading {
  gap: 8px;
}

body.native-android .remote-stage-actions {
  gap: 6px;
}

body.native-android .remote-stage-actions button {
  min-height: 30px;
  padding: 0 9px;
}

body.native-android .remote-stage {
  min-height: 320px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
  background:
    linear-gradient(180deg, rgba(24, 37, 51, 0.98), rgba(5, 10, 17, 0.99)),
    repeating-linear-gradient(90deg, rgba(102, 131, 158, 0.10) 0 1px, transparent 1px 86px),
    #0d1721;
}

body.native-android .remote-stage::before,
body.native-android .remote-drive-button-line,
body.native-android .remote-boost-chevron,
body.native-android .remote-boost-thrust,
body.native-android .remote-brake-disc,
body.native-android .remote-brake-caliper,
body.native-android .remote-drive-button-icon::after,
body.native-android .remote-drive-button-icon-brake::before {
  animation: none !important;
}

body.native-android .remote-stage::before {
  opacity: 0.14;
  transform: none;
}

body.native-android .remote-stage::after {
  opacity: 0.22;
}

body.native-android .remote-joystick-wrapper,
body.native-android .remote-drive-button-aura,
body.native-android .remote-drive-button-core,
body.native-android .remote-gauge-needle {
  transition-duration: 60ms !important;
}

body.native-android .remote-drive-button-aura,
body.native-android .remote-boost-thrust {
  filter: none;
}

body.native-android .remote-dashboard-widget {
  backdrop-filter: none;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.18);
}

body.native-android .remote-control-tuning {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding: 10px;
}

@media (max-width: 760px) {
  body.native-android .topbar {
    grid-template-columns: 1fr;
    grid-template-areas:
      "brand"
      "actions";
  }

  body.native-android .top-actions {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  body.native-android .remote-control-tuning {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (prefers-reduced-motion: reduce) {
  .remote-stage::before,
  .remote-drive-button-line,
  .remote-boost-chevron,
  .remote-boost-thrust,
  .remote-brake-disc,
  .remote-brake-caliper,
  .remote-drive-button-icon::after,
  .remote-drive-button-icon-brake::before {
    animation: none !important;
  }

  .remote-joystick-wrapper,
  .remote-drive-button-aura,
  .remote-drive-button-core,
  .remote-gauge-needle {
    transition-duration: 0.01ms !important;
  }
}


.param-advanced,
.settings-advanced {
  grid-column: 1 / -1;
}

.param-advanced,
.settings-advanced,
.remote-command-details,
.replay-compare-panel {
  min-width: 0;
}

.param-advanced,
.settings-advanced {
  display: grid;
  gap: 10px;
  margin-top: 4px;
  padding: 0;
  border: 0;
}

.param-advanced-summary,
.settings-advanced-summary,
.remote-command-summary {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  cursor: pointer;
  list-style: none;
}

.param-advanced-summary::-webkit-details-marker,
.settings-advanced-summary::-webkit-details-marker,
.remote-command-summary::-webkit-details-marker {
  display: none;
}

.param-advanced-summary span,
.settings-advanced-summary span,
.remote-command-summary span {
  color: var(--blue-dark);
  font-size: 13px;
  font-weight: 900;
}

.param-advanced-summary small,
.settings-advanced-summary small,
.remote-command-summary small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.param-advanced-grid,
.settings-advanced-grid {
  display: grid;
  gap: 10px;
  padding-top: 8px;
}

.remote-command-details {
  display: grid;
  gap: 8px;
}

.remote-command-summary {
  padding: 2px 0 0;
}

.remote-command-details .command-preview {
  margin: 0;
}

.remote-command-details[open] .command-preview {
  margin-top: 2px;
}

.replay-compare-panel {
  min-width: 0;
  margin: 12px 0 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
  box-shadow: none;
}

.replay-compare-summary {
  min-height: 52px;
}

.replay-compare-body {
  display: grid;
  gap: 10px;
  padding: 0 12px 12px;
  border-top: 1px solid var(--line);
  animation: compact-reveal var(--duration-enter) var(--ease-enter);
}

.replay-compare-body .section-heading {
  margin: 10px 0 0;
}

.replay-compare-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.replay-compare-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  overflow: hidden;
  border: 1px solid #dce5ef;
  border-radius: 7px;
  background: #fff;
}

.replay-compare-card {
  display: grid;
  gap: 4px;
  min-width: 0;
  min-height: 78px;
  padding: 10px 11px;
  border: 0;
  border-left: 1px solid #dce5ef;
  background: transparent;
}

.replay-compare-card:first-child {
  border-left: 0;
}

.replay-compare-card.highlight {
  background: #eef5fc;
}

.replay-compare-card span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.replay-compare-card strong {
  color: var(--blue-dark);
  font-size: 16px;
}

.replay-compare-card small {
  color: #5c6d82;
  font-size: 11px;
  line-height: 1.45;
}

.replay-compare-mini {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  overflow: hidden;
  border: 1px solid #dce5ef;
  border-radius: 7px;
  background: #fff;
}

.replay-compare-mini > div {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 8px 10px;
  border: 0;
  border-left: 1px solid #dce5ef;
  background: transparent;
}

.replay-compare-mini > div:first-child {
  border-left: 0;
}

.replay-compare-mini span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.replay-compare-mini strong {
  color: var(--blue-dark);
  font: 800 14px/1.25 Consolas, "Cascadia Mono", "Microsoft YaHei", monospace;
}

.replay-workspace {
  padding: 14px;
}

.replay-file-heading {
  align-items: center;
  margin-bottom: 10px;
}

.replay-summary {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0;
  margin-top: 12px;
  overflow: hidden;
  border: 1px solid #dce5ef;
  border-radius: 8px;
  background: #fbfdff;
}

.replay-summary div {
  min-height: 62px;
  padding: 9px 11px;
  border: 0;
  border-left: 1px solid #dce5ef;
  border-radius: 0;
  background: transparent;
}

.replay-summary div:first-child {
  border-left: 0;
}

.replay-summary span {
  font-size: 11px;
}

.replay-summary strong {
  margin-top: 4px;
  color: #193b62;
  font: 800 17px/1.15 Consolas, "Cascadia Mono", "Microsoft YaHei", monospace;
}

.replay-workflow {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  margin-top: 10px;
  overflow: hidden;
  border: 1px solid #dce5ef;
  border-radius: 8px;
  background: #fff;
}

.replay-step {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  grid-template-rows: auto auto;
  gap: 2px 8px;
  align-items: center;
  min-width: 0;
  min-height: 56px;
  padding: 8px 10px;
  border-left: 1px solid #dce5ef;
}

.replay-step:first-child {
  border-left: 0;
}

.replay-step span {
  grid-row: 1 / 3;
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 24px;
  border: 1px solid #c9d6e5;
  border-radius: 6px;
  color: #52677e;
  background: #f8fbfe;
  font: 900 11px/1 Consolas, "Cascadia Mono", monospace;
}

.replay-step strong {
  min-width: 0;
  color: #203b5a;
  font-size: 12px;
  line-height: 1.15;
}

.replay-step small {
  min-width: 0;
  overflow: hidden;
  color: #657286;
  font-size: 11px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.replay-step.ready {
  background: #f1f8f5;
}

.replay-step.ready span {
  border-color: rgba(22, 134, 91, 0.30);
  color: #126b4b;
  background: #e7f6ef;
}

.replay-step.current {
  background: #eef5fc;
}

.replay-step.current span {
  border-color: #b8cde4;
  color: var(--blue-dark);
  background: #e1eefb;
}

.replay-chart-head-tools {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.replay-chart-head-tools .series-toggles {
  min-height: 24px;
}

.replay-toolbox {
  justify-content: space-between;
  gap: 8px;
  margin: 7px 0 8px;
}

.replay-zoom-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.replay-zoom-presets button,
.replay-toolbox > button,
.replay-custom-zoom > summary {
  min-height: 34px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 800;
}

.replay-custom-zoom {
  position: relative;
}

.replay-custom-zoom summary {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: #334e6c;
  background: #fff;
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
  list-style: none;
}

.replay-custom-zoom summary::-webkit-details-marker {
  display: none;
}

.replay-custom-zoom[open] {
  flex-basis: 100%;
}

.replay-custom-zoom[open] > div {
  display: grid;
  grid-template-columns: 112px 112px auto;
  gap: 8px;
  align-items: end;
  margin-top: 8px;
  padding: 8px;
  border: 1px solid #dbe5f0;
  border-radius: 8px;
  background: #f8fbfe;
  animation: compact-reveal var(--duration-enter) var(--ease-enter);
}

.replay-custom-zoom .field.compact {
  min-width: 0;
}

.replay-hover-readout {
  min-height: 30px;
  margin-bottom: 7px;
  padding: 5px 9px;
  border-radius: 7px;
  font-size: 11px;
}

.replay-empty {
  min-height: 180px;
  margin-top: 10px;
}

.chart-panel:not(.has-live-samples) .chart-card {
  border-color: #dfe7f0;
  background: #fbfdff;
}

.chart-panel:not(.has-live-samples) .chart-card canvas {
  background: #f7fafc;
}

.chart-panel:not(.has-live-samples) .chart-card.wide canvas {
  height: 230px;
}

@keyframes compact-reveal {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.settings-advanced {
  margin-top: 0;
}

.settings-advanced-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.settings-advanced-grid > .workspace-section {
  min-height: 100%;
}

.product-roadmap-panel {
  display: grid;
  gap: 12px;
}

.deployment-plan-panel {
  grid-column: 1 / -1;
  display: grid;
  gap: 12px;
}

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

.deployment-grid .field-full {
  grid-column: 1 / -1;
}

.deployment-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
  overflow: hidden;
  border: 1px solid #dce5ef;
  border-radius: 8px;
  background: #fbfdff;
}

.deployment-summary div {
  display: grid;
  gap: 4px;
  min-width: 0;
  min-height: 76px;
  padding: 10px 12px;
  border-left: 1px solid #dce5ef;
}

.deployment-summary div:first-child {
  border-left: 0;
}

.deployment-summary span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.deployment-summary strong {
  color: var(--blue-dark);
  font-size: 14px;
  line-height: 1.35;
}

.deployment-readiness {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid #dce5ef;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(35, 100, 170, 0.06), transparent 34%),
    #fbfdff;
}

.deployment-readiness-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
}

.deployment-readiness-head > div {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.deployment-readiness-head strong {
  color: #193b62;
  font-size: 14px;
  line-height: 1.2;
}

.deployment-readiness-head small {
  color: #627286;
  font-size: 12px;
  line-height: 1.45;
}

.deployment-check-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.deployment-check {
  position: relative;
  display: grid;
  gap: 4px;
  min-width: 0;
  min-height: 78px;
  padding: 10px 11px 10px 13px;
  overflow: hidden;
  border: 1px solid #d9e3ef;
  border-radius: 8px;
  background: #fff;
}

.deployment-check::before {
  content: "";
  position: absolute;
  top: 10px;
  bottom: 10px;
  left: 0;
  width: 3px;
  border-radius: 0 99px 99px 0;
  background: #8a97a8;
}

.deployment-check span {
  color: #607086;
  font-size: 10px;
  font-weight: 900;
  line-height: 1.2;
  text-transform: uppercase;
}

.deployment-check strong {
  min-width: 0;
  overflow: hidden;
  color: #1f3e61;
  font-size: 13px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.deployment-check small {
  display: -webkit-box;
  min-width: 0;
  overflow: hidden;
  color: #657286;
  font-size: 11px;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.deployment-check.healthy {
  border-color: rgba(22, 134, 91, 0.28);
  background: #f5fbf8;
}

.deployment-check.healthy::before {
  background: #16865b;
}

.deployment-check.current {
  border-color: #c7d9ec;
  background: #f4f9fe;
}

.deployment-check.current::before {
  background: #2364aa;
}

.deployment-check.error {
  border-color: rgba(190, 62, 49, 0.25);
  background: #fff8f7;
}

.deployment-check.error::before {
  background: #be3e31;
}

.deployment-check.waiting::before {
  background: #8a97a8;
}

.deployment-steps {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0;
  overflow: hidden;
  border: 1px solid #dce5ef;
  border-radius: 8px;
  background: #fff;
}

.deployment-step {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  grid-template-rows: auto auto;
  gap: 2px 8px;
  align-items: center;
  min-width: 0;
  min-height: 58px;
  padding: 8px 10px;
  border-left: 1px solid #dce5ef;
}

.deployment-step:first-child {
  border-left: 0;
}

.deployment-step span {
  grid-row: 1 / 3;
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 24px;
  border: 1px solid #c9d6e5;
  border-radius: 6px;
  color: #52677e;
  background: #f8fbfe;
  font: 900 11px/1 Consolas, "Cascadia Mono", monospace;
}

.deployment-step strong {
  min-width: 0;
  color: #203b5a;
  font-size: 12px;
  line-height: 1.15;
}

.deployment-step small {
  min-width: 0;
  overflow: hidden;
  color: #657286;
  font-size: 11px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.deployment-step.ready {
  background: #f1f8f5;
}

.deployment-step.ready span {
  border-color: rgba(22, 134, 91, 0.30);
  color: #126b4b;
  background: #e7f6ef;
}

.deployment-step.current {
  background: #eef5fc;
}

.deployment-step.current span {
  border-color: #b8cde4;
  color: var(--blue-dark);
  background: #e1eefb;
}

.deployment-step.waiting {
  background: #fff;
}

.deployment-step.waiting span {
  border-color: #d3dceb;
  color: #63758a;
  background: #f7f9fc;
}

.capability-matrix {
  display: grid;
  overflow: hidden;
  border: 1px solid #dce5ef;
  border-radius: 8px;
  background: #fff;
}

.capability-row {
  display: grid;
  grid-template-columns: 150px minmax(0, 1.1fr) minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  min-width: 0;
  min-height: 48px;
  padding: 9px 12px;
  border-top: 1px solid #dce5ef;
}

.capability-row:first-child {
  border-top: 0;
}

.capability-row span {
  color: #52677e;
  font: 900 12px/1.2 Consolas, "Cascadia Mono", "Microsoft YaHei", monospace;
}

.capability-row strong {
  min-width: 0;
  color: #193b62;
  font-size: 13px;
  line-height: 1.35;
}

.capability-row em {
  min-width: 0;
  color: #5c6d82;
  font-size: 12px;
  font-style: normal;
  line-height: 1.4;
}

.capability-row.boundary {
  background: #fff8f6;
}

.capability-row.boundary strong {
  color: #a33425;
}

.product-roadmap-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0;
  overflow: hidden;
  border: 1px solid #dce5ef;
  border-radius: 8px;
  background: #fbfdff;
}

.product-roadmap-grid div {
  display: grid;
  gap: 4px;
  min-width: 0;
  min-height: 74px;
  padding: 10px;
  border-left: 1px solid #dce5ef;
}

.product-roadmap-grid div:first-child {
  border-left: 0;
}

.product-roadmap-grid span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.product-roadmap-grid strong {
  color: var(--blue-dark);
  font-size: 15px;
}

.product-roadmap-grid small {
  color: #5c6d82;
  font-size: 11px;
  line-height: 1.35;
}

@media (max-width: 1240px) {
  .dashboard {
    grid-template-columns: minmax(0, 1fr);
  }

  .tune-main-column,
  .dashboard > .side-panel {
    grid-column: 1;
    grid-row: auto;
  }

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

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

  .replay-step:nth-child(odd) {
    border-left: 0;
  }

  .replay-step:nth-child(n + 3) {
    border-top: 1px solid #dce5ef;
  }

  .replay-summary div:nth-child(odd) {
    border-left: 0;
  }

  .replay-summary div:nth-child(n + 3) {
    border-top: 1px solid #dce5ef;
  }

  .replay-compare-grid,
  .replay-compare-mini,
  .settings-advanced-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .product-roadmap-grid div:nth-child(3n + 1) {
    border-left: 0;
  }

  .product-roadmap-grid div:nth-child(n + 4) {
    border-top: 1px solid #dce5ef;
  }

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

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

  .deployment-summary div:nth-child(odd) {
    border-left: 0;
  }

  .deployment-summary div:nth-child(n + 3) {
    border-top: 1px solid #dce5ef;
  }

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

  .deployment-step:nth-child(odd) {
    border-left: 0;
  }

  .deployment-step:nth-child(n + 3) {
    border-top: 1px solid #dce5ef;
  }

  .replay-compare-card:nth-child(odd),
  .replay-compare-mini > div:nth-child(odd) {
    border-left: 0;
  }

  .replay-compare-card:nth-child(n + 3),
  .replay-compare-mini > div:nth-child(n + 3) {
    border-top: 1px solid #dce5ef;
  }
}

@media (max-width: 1100px) {
  .chart-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .chart-title h2 {
    white-space: nowrap;
  }
}

@media (max-width: 860px) {
  .tune-action-bar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .recording-box {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .recording-box .button-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .replay-compare-grid,
  .replay-compare-mini,
  .settings-advanced-grid {
    grid-template-columns: 1fr;
  }

  .capability-row {
    grid-template-columns: 1fr;
    gap: 4px;
    align-items: start;
  }

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

  .product-roadmap-grid div,
  .product-roadmap-grid div:nth-child(3n + 1) {
    border-left: 1px solid #dce5ef;
  }

  .product-roadmap-grid div:nth-child(odd) {
    border-left: 0;
  }

  .product-roadmap-grid div:nth-child(n + 3) {
    border-top: 1px solid #dce5ef;
  }

  .deployment-grid,
  .deployment-summary,
  .deployment-check-grid,
  .deployment-steps {
    grid-template-columns: 1fr;
  }

  .deployment-summary div,
  .deployment-step,
  .deployment-summary div:nth-child(odd),
  .deployment-step:nth-child(odd) {
    border-left: 0;
  }

  .deployment-summary div + div,
  .deployment-step + .deployment-step {
    border-top: 1px solid #dce5ef;
  }

  .replay-compare-card,
  .replay-compare-mini > div,
  .replay-compare-card:nth-child(odd),
  .replay-compare-mini > div:nth-child(odd) {
    border-left: 0;
  }

  .replay-compare-card + .replay-compare-card,
  .replay-compare-mini > div + div {
    border-top: 1px solid #dce5ef;
  }

  .replay-custom-zoom[open] > div {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .replay-custom-zoom[open] > div > button {
    grid-column: 1 / -1;
  }
}

@media (max-width: 520px) {
  .replay-summary {
    grid-template-columns: 1fr;
  }

  .replay-workflow,
  .product-roadmap-grid {
    grid-template-columns: 1fr;
  }

  .deployment-summary,
  .deployment-steps {
    grid-template-columns: 1fr;
  }

  .replay-summary div,
  .replay-summary div:nth-child(odd) {
    border-left: 0;
  }

  .replay-summary div + div {
    border-top: 1px solid #dce5ef;
  }

  .replay-step,
  .replay-step:nth-child(odd),
  .product-roadmap-grid div,
  .product-roadmap-grid div:nth-child(odd),
  .product-roadmap-grid div:nth-child(3n + 1) {
    border-left: 0;
  }

  .replay-step + .replay-step,
  .product-roadmap-grid div + div {
    border-top: 1px solid #dce5ef;
  }

  .deployment-summary div + div,
  .deployment-step + .deployment-step {
    border-top: 1px solid #dce5ef;
  }

  .app-toast-stack {
    right: 12px;
    bottom: 12px;
    width: calc(100vw - 24px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .wiring-panel-body,
  .tune-maintenance-body,
  .replay-compare-body,
  .replay-custom-zoom[open] > div,
  .app-toast {
    animation: none;
  }

  .workbench-details-summary::after,
  .replay-compare-summary::after,
  .compact-details-summary::after,
  .app-toast {
    transition-duration: 0.01ms;
  }
}
