:root {
  color-scheme: light;
  --ink: #172033;
  --ink-soft: #526078;
  --ink-faint: #8490a5;
  --canvas: #f4f7fb;
  --surface: #ffffff;
  --surface-muted: #f7f9fc;
  --line: #e2e8f1;
  --line-strong: #cfd8e7;
  --navy: #111a2e;
  --navy-soft: #1b2741;
  --primary: #3268e8;
  --primary-dark: #2452bc;
  --primary-soft: #edf3ff;
  --cyan: #08a5c8;
  --violet: #7657dc;
  --green: #118d66;
  --green-soft: #e8f7f1;
  --amber: #b56808;
  --amber-soft: #fff4df;
  --red: #c7434b;
  --red-soft: #fff0f1;
  --shadow-sm: 0 1px 2px rgba(21, 32, 54, 0.06), 0 4px 12px rgba(21, 32, 54, 0.04);
  --shadow-md: 0 14px 36px rgba(21, 32, 54, 0.12);
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 18px;
  --topbar-height: 68px;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "PingFang SC", "Microsoft YaHei", sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: 100%;
  background: var(--canvas);
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 92% 8%, rgba(50, 104, 232, 0.06), transparent 28rem),
    var(--canvas);
  -webkit-font-smoothing: antialiased;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  color: inherit;
}

button,
select,
summary,
input[type="checkbox"] {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
summary:focus-visible {
  outline: 3px solid rgba(50, 104, 232, 0.2);
  outline-offset: 2px;
}

button:disabled,
input:disabled,
textarea:disabled,
select:disabled {
  cursor: not-allowed;
  opacity: 0.56;
}

.hidden,
[hidden] {
  display: none !important;
}

.skip-link {
  position: fixed;
  z-index: 1000;
  top: 8px;
  left: 8px;
  padding: 10px 14px;
  color: #fff;
  background: var(--primary);
  border-radius: var(--radius-sm);
  transform: translateY(-160%);
}

.skip-link:focus {
  transform: translateY(0);
}

.topbar {
  position: sticky;
  z-index: 50;
  top: 0;
  display: grid;
  grid-template-columns: minmax(205px, 0.8fr) auto minmax(300px, 0.8fr);
  align-items: center;
  min-height: var(--topbar-height);
  padding: 0 24px;
  color: #eef4ff;
  background:
    linear-gradient(100deg, rgba(44, 88, 189, 0.18), transparent 35%),
    var(--navy);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 8px 24px rgba(14, 22, 40, 0.12);
}

.brand {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  gap: 11px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  position: relative;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(111, 164, 255, 0.48);
  border-radius: 10px;
  background: linear-gradient(145deg, rgba(55, 110, 238, 0.45), rgba(8, 165, 200, 0.12));
  box-shadow: inset 0 0 20px rgba(83, 143, 255, 0.16);
}

.brand-mark span {
  position: absolute;
  display: block;
  width: 5px;
  height: 5px;
  background: #76d9ff;
  border-radius: 50%;
  box-shadow: 0 0 9px rgba(118, 217, 255, 0.8);
}

.brand-mark span:first-child {
  top: 8px;
  left: 8px;
}

.brand-mark span:nth-child(2) {
  top: 14px;
  right: 7px;
}

.brand-mark span:last-child {
  bottom: 7px;
  left: 13px;
}

.brand-mark::before,
.brand-mark::after {
  position: absolute;
  width: 15px;
  height: 1px;
  content: "";
  background: rgba(118, 217, 255, 0.6);
  transform-origin: left center;
}

.brand-mark::before {
  top: 11px;
  left: 11px;
  transform: rotate(20deg);
}

.brand-mark::after {
  top: 18px;
  left: 12px;
  transform: rotate(-50deg);
}

.brand-copy {
  display: grid;
  gap: 1px;
}

.brand-copy strong {
  font-size: 15px;
  line-height: 1;
  letter-spacing: 0.15em;
}

.brand-copy small {
  color: #8392ae;
  font-size: 8px;
  letter-spacing: 0.13em;
}

.primary-nav {
  align-self: stretch;
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 4px;
}

.nav-item {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 112px;
  padding: 0 17px;
  color: #9eabc1;
  font-size: 14px;
  border: 0;
  background: transparent;
}

.nav-item::after {
  position: absolute;
  right: 16px;
  bottom: 0;
  left: 16px;
  height: 2px;
  content: "";
  background: transparent;
  border-radius: 2px 2px 0 0;
}

.nav-item:hover {
  color: #e5edfa;
  background: rgba(255, 255, 255, 0.035);
}

.nav-item.active {
  color: #fff;
}

.nav-item.active::after {
  background: #5c91ff;
  box-shadow: 0 0 10px rgba(92, 145, 255, 0.7);
}

.nav-icon {
  position: relative;
  display: inline-block;
  width: 15px;
  height: 15px;
}

.task-icon {
  border: 1.5px solid currentColor;
  border-radius: 3px;
}

.task-icon::before,
.task-icon::after {
  position: absolute;
  left: 3px;
  width: 7px;
  height: 1px;
  content: "";
  background: currentColor;
}

.task-icon::before {
  top: 4px;
}

.task-icon::after {
  top: 8px;
}

.model-icon {
  border: 1.5px solid currentColor;
  border-radius: 50%;
}

.model-icon::before {
  position: absolute;
  inset: 3px;
  content: "";
  border: 1px solid currentColor;
  border-radius: 50%;
}

.device-icon {
  border: 1.5px solid currentColor;
  border-radius: 2px;
}

.device-icon::after {
  position: absolute;
  right: 3px;
  bottom: -3px;
  left: 3px;
  height: 1.5px;
  content: "";
  background: currentColor;
}

.nav-dot {
  width: 6px;
  height: 6px;
  margin-left: -4px;
  background: #687790;
  border-radius: 50%;
}

.nav-dot.ready {
  background: #48d5a1;
  box-shadow: 0 0 8px rgba(72, 213, 161, 0.7);
}

.nav-dot.warning {
  background: #f1b149;
}

.nav-dot.error {
  background: #df6770;
}

.nav-count {
  min-width: 24px;
  padding: 2px 6px;
  color: #b8c5da;
  font-size: 10px;
  text-align: center;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 10px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

.connection-state {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #9eabc1;
  font-size: 12px;
}

.status-light,
.readiness-light,
.preflight-light {
  display: inline-block;
  flex: 0 0 auto;
  width: 7px;
  height: 7px;
  background: #8190aa;
  border-radius: 50%;
}

.connection-state.connected .status-light {
  background: #47d39f;
  box-shadow: 0 0 8px rgba(71, 211, 159, 0.65);
}

.connection-state.error .status-light {
  background: #ec6f77;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 15px;
  gap: 7px;
  font-size: 13px;
  font-weight: 650;
  line-height: 1;
  border: 1px solid transparent;
  border-radius: 9px;
  transition:
    border-color 160ms ease,
    background 160ms ease,
    color 160ms ease,
    box-shadow 160ms ease,
    transform 160ms ease;
}

.button:not(:disabled):active {
  transform: translateY(1px);
}

.button-primary {
  color: #fff;
  background: linear-gradient(180deg, #4076f0, var(--primary));
  border-color: #2d61d5;
  box-shadow: 0 4px 10px rgba(50, 104, 232, 0.17);
}

.button-primary:not(:disabled):hover {
  background: linear-gradient(180deg, #376ce2, var(--primary-dark));
  box-shadow: 0 5px 14px rgba(50, 104, 232, 0.25);
}

.button-secondary {
  color: var(--primary-dark);
  background: var(--surface);
  border-color: #bfd0f4;
}

.button-secondary:not(:disabled):hover {
  background: var(--primary-soft);
  border-color: #9db6ed;
}

.button-quiet {
  color: var(--ink-soft);
  background: var(--surface);
  border-color: var(--line-strong);
}

.topbar .button-quiet {
  min-height: 34px;
  color: #c2ccdc;
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.13);
}

.button-quiet:not(:disabled):hover {
  color: var(--ink);
  background: var(--surface-muted);
  border-color: #b9c6da;
}

.topbar .button-quiet:not(:disabled):hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.22);
}

.button-danger-quiet {
  color: var(--red);
  background: #fff;
  border-color: #efc5c8;
}

.button-danger-quiet:not(:disabled):hover {
  background: var(--red-soft);
  border-color: #e6aeb3;
}

.button-approve {
  color: #fff;
  background: var(--green);
  border-color: #0e7958;
}

.button-approve:not(:disabled):hover {
  background: #0b7956;
}

.button-wide {
  width: 100%;
}

.key-icon {
  width: 12px;
  height: 12px;
  border: 1.5px solid currentColor;
  border-radius: 50%;
}

.key-icon::after {
  display: block;
  width: 8px;
  height: 1.5px;
  margin: 8px 0 0 8px;
  content: "";
  background: currentColor;
  transform: rotate(45deg);
  transform-origin: left center;
}

#main-content {
  min-height: calc(100vh - var(--topbar-height));
}

.app-view {
  min-height: calc(100vh - var(--topbar-height));
}

.app-view[hidden] {
  display: none;
}

#tasks-view.active {
  display: grid;
  grid-template-columns: 296px minmax(0, 1fr);
}

.task-sidebar {
  position: sticky;
  top: var(--topbar-height);
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--topbar-height));
  padding: 24px 18px 18px;
  background: #fbfcfe;
  border-right: 1px solid var(--line);
  overflow: hidden;
}

.sidebar-heading,
.panel-heading,
.page-heading,
.detail-header,
.route-head,
.device-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-heading {
  margin: 0 4px 18px;
}

.eyebrow {
  margin: 0 0 5px;
  color: #8491a6;
  font-size: 9px;
  font-weight: 750;
  line-height: 1;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

.sidebar-heading h1,
.page-heading h1 {
  margin: 0;
  font-size: 22px;
  line-height: 1.15;
  letter-spacing: -0.025em;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  color: var(--ink-soft);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 9px;
}

.icon-button.compact {
  width: 30px;
  height: 30px;
  background: #fff;
}

.icon-button:hover {
  color: var(--primary);
  background: var(--primary-soft);
  border-color: #c6d4f2;
}

.refresh-icon {
  position: relative;
  display: block;
  width: 13px;
  height: 13px;
  border: 1.6px solid currentColor;
  border-left-color: transparent;
  border-radius: 50%;
}

.refresh-icon::after {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 4px;
  height: 4px;
  content: "";
  border-top: 1.5px solid currentColor;
  border-right: 1.5px solid currentColor;
}

.loading .refresh-icon {
  animation: spin 900ms linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.list-summary {
  display: flex;
  justify-content: space-between;
  margin: 18px 3px 9px;
  color: var(--ink-faint);
  font-size: 10px;
}

.task-list {
  min-height: 0;
  padding-right: 4px;
  overflow: auto;
  scrollbar-width: thin;
}

.empty-list {
  display: grid;
  justify-items: center;
  padding: 42px 15px;
  color: var(--ink-faint);
  text-align: center;
}

.empty-list strong {
  margin: 13px 0 4px;
  color: var(--ink-soft);
  font-size: 13px;
}

.empty-list small {
  max-width: 190px;
  font-size: 11px;
  line-height: 1.6;
}

.empty-list-icon {
  position: relative;
  width: 38px;
  height: 42px;
  border: 1.5px solid #bdc9da;
  border-radius: 6px;
}

.empty-list-icon::before,
.empty-list-icon::after {
  position: absolute;
  left: 9px;
  width: 18px;
  height: 1px;
  content: "";
  background: #bdc9da;
}

.empty-list-icon::before {
  top: 13px;
}

.empty-list-icon::after {
  top: 21px;
}

.task-row {
  display: grid;
  width: 100%;
  margin-bottom: 7px;
  padding: 12px;
  text-align: left;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.task-row:hover {
  border-color: #c4d2e7;
  box-shadow: var(--shadow-sm);
}

.task-row.active {
  background: #f4f7ff;
  border-color: #92afea;
  box-shadow: inset 3px 0 var(--primary);
}

.task-row-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.mini-device,
.mini-status,
.status-badge,
.device-badge,
.summary-badge,
.availability-badge,
.route-status,
.phase-badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  white-space: nowrap;
  border-radius: 999px;
}

.mini-device {
  padding: 3px 6px;
  color: #59677f;
  font-size: 9px;
  font-weight: 700;
  background: #f1f4f8;
  border: 1px solid #e3e8ef;
  text-transform: uppercase;
}

.mini-device.android {
  color: #0e7c5a;
  background: #eaf7f2;
  border-color: #c8eadc;
}

.mini-status {
  gap: 4px;
  color: var(--ink-faint);
  font-size: 9px;
}

.mini-status::before {
  width: 5px;
  height: 5px;
  content: "";
  background: currentColor;
  border-radius: 50%;
}

.mini-status.tone-running,
.mini-status.tone-warning {
  color: var(--amber);
}

.mini-status.tone-success {
  color: var(--green);
}

.mini-status.tone-error {
  color: var(--red);
}

.task-row > strong {
  display: -webkit-box;
  margin-bottom: 7px;
  color: #263147;
  font-size: 12px;
  font-weight: 650;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}

.task-row-meta {
  color: var(--ink-faint);
  font-size: 9px;
}

.task-workspace {
  min-width: 0;
}

.welcome-state {
  display: grid;
  align-content: center;
  justify-items: center;
  min-height: calc(100vh - var(--topbar-height));
  padding: 48px 24px;
  text-align: center;
}

.welcome-visual {
  position: relative;
  width: 134px;
  height: 134px;
  margin-bottom: 30px;
}

.visual-ring {
  position: absolute;
  border: 1px solid rgba(50, 104, 232, 0.2);
  border-radius: 50%;
}

.ring-one {
  inset: 4px;
  animation: rotate-slow 22s linear infinite;
}

.ring-two {
  inset: 29px;
  border-color: rgba(8, 165, 200, 0.3);
  animation: rotate-slow 15s linear infinite reverse;
}

.visual-ring::before,
.visual-ring::after {
  position: absolute;
  width: 6px;
  height: 6px;
  content: "";
  background: var(--primary);
  border-radius: 50%;
  box-shadow: 0 0 10px rgba(50, 104, 232, 0.5);
}

.ring-one::before {
  top: 12px;
  right: 16px;
}

.ring-one::after {
  bottom: 8px;
  left: 24px;
}

.ring-two::before {
  top: 8px;
  left: 10px;
  background: var(--cyan);
}

.ring-two::after {
  right: 4px;
  bottom: 16px;
  background: var(--violet);
}

.visual-node {
  position: absolute;
  width: 12px;
  height: 12px;
  background: #fff;
  border: 2px solid var(--primary);
  border-radius: 50%;
  box-shadow: 0 3px 10px rgba(50, 104, 232, 0.2);
}

.node-center {
  inset: 50%;
  width: 31px;
  height: 31px;
  background: linear-gradient(145deg, #5689f7, var(--primary));
  border: 6px solid #dce7ff;
  transform: translate(-50%, -50%);
}

.node-one {
  top: 7px;
  left: 50%;
}

.node-two {
  right: 3px;
  bottom: 28px;
}

.node-three {
  bottom: 13px;
  left: 22px;
}

@keyframes rotate-slow {
  to {
    transform: rotate(360deg);
  }
}

.welcome-state h2 {
  max-width: 640px;
  margin: 5px 0 14px;
  font-size: clamp(25px, 3vw, 38px);
  line-height: 1.22;
  letter-spacing: -0.035em;
}

.welcome-copy {
  max-width: 600px;
  margin: 0;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.8;
}

.welcome-actions {
  display: flex;
  gap: 10px;
  margin: 27px 0 34px;
}

.readiness-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 230px));
  width: min(100%, 480px);
  gap: 10px;
}

.readiness-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 13px 15px;
  text-align: left;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow-sm);
}

.readiness-item div {
  display: grid;
  gap: 3px;
}

.readiness-item strong {
  font-size: 11px;
}

.readiness-item small {
  color: var(--ink-faint);
  font-size: 9px;
}

.readiness-item.ready .readiness-light,
.preflight.ready .preflight-light {
  background: var(--green);
  box-shadow: 0 0 7px rgba(17, 141, 102, 0.45);
}

.readiness-item.warning .readiness-light,
.preflight.warning .preflight-light {
  background: #dc931f;
}

.readiness-item.error .readiness-light {
  background: var(--red);
}

.task-detail {
  min-height: calc(100vh - var(--topbar-height));
  padding: 24px clamp(20px, 3vw, 42px) 42px;
}

.detail-header {
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 18px;
}

.detail-title-group {
  min-width: 0;
}

.title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
  margin-bottom: 9px;
}

.status-badge,
.device-badge {
  padding: 4px 8px;
  font-size: 9px;
  font-weight: 750;
  border: 1px solid;
}

.status-badge.tone-neutral,
.status-badge.tone-muted {
  color: #66758d;
  background: #f1f4f8;
  border-color: #dce3ed;
}

.status-badge.tone-running {
  color: #2b62cf;
  background: #edf3ff;
  border-color: #cbdafa;
}

.status-badge.tone-warning {
  color: var(--amber);
  background: var(--amber-soft);
  border-color: #efd3a4;
}

.status-badge.tone-success {
  color: var(--green);
  background: var(--green-soft);
  border-color: #bfe5d6;
}

.status-badge.tone-error {
  color: var(--red);
  background: var(--red-soft);
  border-color: #efc4c7;
}

.device-badge {
  color: #4e5d74;
  background: #fff;
  border-color: var(--line-strong);
}

.device-badge.android {
  color: #087a58;
  background: #ebf8f3;
  border-color: #bfe5d5;
}

.task-id {
  padding: 3px 6px;
  color: var(--ink-faint);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 9px;
  background: transparent;
  border: 0;
  border-radius: 4px;
}

.task-id:hover {
  color: var(--primary);
  background: var(--primary-soft);
}

.detail-title-group h2 {
  margin: 0 0 7px;
  font-size: clamp(20px, 2.2vw, 28px);
  line-height: 1.3;
  letter-spacing: -0.025em;
}

.detail-title-group > p {
  max-width: 880px;
  margin: 0;
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.65;
  white-space: pre-wrap;
}

.detail-actions {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.approval-card {
  margin-bottom: 16px;
  padding: 17px;
  background: linear-gradient(110deg, #fff9ed, #fff);
  border: 1px solid #eecb8f;
  border-left: 4px solid #dd941e;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.approval-heading {
  display: flex;
  gap: 12px;
}

.approval-icon {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  color: #fff;
  font-size: 17px;
  font-weight: 800;
  background: #d58b18;
  border-radius: 9px;
}

.approval-heading h3 {
  margin: 0 0 3px;
  font-size: 15px;
}

.approval-heading p:not(.eyebrow) {
  margin: 0;
  color: #776044;
  font-size: 11px;
}

.risk-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 14px 0 12px 42px;
}

.risk-chip {
  padding: 5px 8px;
  color: #8d5911;
  font-size: 10px;
  background: #fff4dc;
  border: 1px solid #edcf9d;
  border-radius: 6px;
}

.action-details {
  margin-left: 42px;
  font-size: 10px;
}

.action-details summary,
.event-payload summary {
  width: fit-content;
  color: var(--primary);
  font-size: 10px;
  user-select: none;
}

.action-details pre,
.event-payload pre {
  max-height: 240px;
  margin: 8px 0 0;
  padding: 11px;
  color: #31405a;
  font: 10px/1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: pre-wrap;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(176, 139, 77, 0.25);
  border-radius: 7px;
  overflow: auto;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.metric-card {
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow-sm);
}

.metric-card span {
  display: block;
  margin-bottom: 6px;
  color: var(--ink-faint);
  font-size: 9px;
}

.metric-card strong {
  display: block;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.run-grid {
  display: grid;
  grid-template-columns: minmax(420px, 1.2fr) minmax(350px, 0.8fr);
  align-items: start;
  gap: 14px;
}

.panel {
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.panel-heading {
  min-height: 59px;
  padding: 13px 15px;
  border-bottom: 1px solid var(--line);
}

.panel-heading h3 {
  margin: 0;
  font-size: 14px;
}

.panel-heading-actions {
  display: flex;
  align-items: center;
  gap: 7px;
}

.live-badge {
  gap: 6px;
  padding: 5px 8px;
  color: var(--green);
  font-size: 9px;
  background: var(--green-soft);
  border: 1px solid #c4e8da;
}

.live-badge > span {
  width: 6px;
  height: 6px;
  background: currentColor;
  border-radius: 50%;
  animation: live-pulse 1.8s ease-out infinite;
}

.live-badge.offline {
  color: #78869a;
  background: #f3f5f8;
  border-color: #e0e5ec;
}

.live-badge.offline > span,
.live-badge.error > span {
  animation: none;
}

.live-badge.connecting {
  color: var(--amber);
  background: var(--amber-soft);
  border-color: #eed4a7;
}

.live-badge.error {
  color: var(--red);
  background: var(--red-soft);
  border-color: #efc8cb;
}

@keyframes live-pulse {
  0% {
    box-shadow: 0 0 0 0 currentColor;
  }
  70% {
    box-shadow: 0 0 0 5px transparent;
  }
  100% {
    box-shadow: 0 0 0 0 transparent;
  }
}

.screen-stage {
  position: relative;
  display: grid;
  place-items: center;
  min-height: min(62vh, 620px);
  background:
    linear-gradient(45deg, rgba(255, 255, 255, 0.018) 25%, transparent 25%, transparent 75%, rgba(255, 255, 255, 0.018) 75%),
    #111827;
  background-size: 22px 22px;
  overflow: hidden;
}

.screen-stage img {
  display: block;
  width: 100%;
  max-height: min(72vh, 720px);
  object-fit: contain;
}

.screen-empty {
  display: grid;
  justify-items: center;
  max-width: 300px;
  padding: 40px 24px;
  color: #8692a7;
  text-align: center;
}

.screen-empty strong {
  margin: 17px 0 6px;
  color: #c3cbd8;
  font-size: 12px;
}

.screen-empty p {
  margin: 0;
  font-size: 10px;
  line-height: 1.6;
}

.screen-placeholder {
  position: relative;
  width: 70px;
  height: 47px;
  border: 1px solid #42506a;
  border-radius: 5px;
}

.screen-placeholder::after {
  position: absolute;
  right: 22px;
  bottom: -9px;
  left: 22px;
  height: 1px;
  content: "";
  background: #42506a;
  box-shadow: 0 6px #42506a;
}

.trace-panel {
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - var(--topbar-height) - 178px);
  min-height: 520px;
}

.event-count {
  color: var(--ink-faint);
  font-size: 10px;
}

.trace-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding: 9px 14px;
  background: #fafbfd;
  border-bottom: 1px solid var(--line);
}

.trace-legend span {
  padding: 3px 6px;
  color: var(--ink-faint);
  font-size: 8px;
  border: 1px solid var(--line);
  border-radius: 4px;
}

.trace-list {
  min-height: 0;
  margin: 0;
  padding: 8px 12px 18px;
  list-style: none;
  overflow: auto;
  scrollbar-width: thin;
}

.trace-empty {
  display: grid;
  justify-items: center;
  padding: 80px 18px;
  color: var(--ink-faint);
  text-align: center;
}

.trace-empty strong {
  margin-bottom: 5px;
  color: var(--ink-soft);
  font-size: 12px;
}

.trace-empty span {
  max-width: 250px;
  font-size: 10px;
  line-height: 1.6;
}

.trace-item {
  position: relative;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 7px;
  padding: 9px 0;
}

.trace-rail {
  position: relative;
}

.trace-rail::before {
  position: absolute;
  z-index: 1;
  top: 5px;
  left: 5px;
  width: 7px;
  height: 7px;
  content: "";
  background: #a7b2c3;
  border: 2px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 0 1px #a7b2c3;
}

.trace-rail::after {
  position: absolute;
  top: 16px;
  bottom: -15px;
  left: 8px;
  width: 1px;
  content: "";
  background: var(--line);
}

.trace-item:last-child .trace-rail::after {
  display: none;
}

.phase-observe .trace-rail::before {
  background: var(--cyan);
  box-shadow: 0 0 0 1px var(--cyan);
}

.phase-decide .trace-rail::before {
  background: var(--violet);
  box-shadow: 0 0 0 1px var(--violet);
}

.phase-guard .trace-rail::before {
  background: #d48b15;
  box-shadow: 0 0 0 1px #d48b15;
}

.phase-act .trace-rail::before {
  background: var(--primary);
  box-shadow: 0 0 0 1px var(--primary);
}

.phase-judge .trace-rail::before {
  background: var(--green);
  box-shadow: 0 0 0 1px var(--green);
}

.trace-content {
  min-width: 0;
  padding-bottom: 2px;
}

.trace-head {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 5px;
}

.phase-badge {
  padding: 3px 5px;
  font-size: 8px;
  font-weight: 750;
  letter-spacing: 0.03em;
  border: 1px solid;
}

.phase-badge.tone-cyan {
  color: #087d97;
  background: #e9f8fb;
  border-color: #bae6ee;
}

.phase-badge.tone-violet {
  color: #6546c4;
  background: #f1edfc;
  border-color: #d8cdf5;
}

.phase-badge.tone-amber {
  color: var(--amber);
  background: var(--amber-soft);
  border-color: #efd5a8;
}

.phase-badge.tone-blue {
  color: var(--primary-dark);
  background: var(--primary-soft);
  border-color: #c9d8f7;
}

.phase-badge.tone-green {
  color: var(--green);
  background: var(--green-soft);
  border-color: #bfe6d7;
}

.phase-badge.tone-neutral {
  color: #66758c;
  background: #f2f4f7;
  border-color: #dce2ea;
}

.event-type {
  min-width: 0;
  color: #48566e;
  font: 9px/1.3 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.event-sequence {
  color: #a1aabd;
  font: 8px ui-monospace, SFMono-Regular, Menlo, monospace;
}

.trace-head time {
  margin-left: auto;
  color: var(--ink-faint);
  font-size: 8px;
  white-space: nowrap;
}

.event-summary {
  margin: 7px 0 0;
  color: #435168;
  font-size: 10px;
  line-height: 1.6;
}

.event-payload {
  margin-top: 7px;
}

.event-payload pre {
  max-height: 260px;
  background: #f7f9fc;
  border-color: var(--line);
}

.settings-view {
  width: min(1320px, 100%);
  margin: 0 auto;
  padding: 38px clamp(22px, 4vw, 58px) 64px;
}

.page-heading {
  align-items: flex-end;
  gap: 20px;
  margin-bottom: 26px;
}

.page-heading > div:first-child {
  max-width: 760px;
}

.page-heading h1 {
  margin-bottom: 9px;
  font-size: 28px;
}

.page-heading p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.7;
}

.page-heading-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.summary-badge {
  padding: 6px 9px;
  color: var(--amber);
  font-size: 10px;
  background: var(--amber-soft);
  border: 1px solid #efd5a8;
}

.summary-badge.ready {
  color: var(--green);
  background: var(--green-soft);
  border-color: #c0e6d7;
}

.quick-route-card {
  position: relative;
  margin-bottom: 25px;
  padding: 20px;
  background:
    linear-gradient(105deg, rgba(50, 104, 232, 0.06), rgba(8, 165, 200, 0.025) 48%, transparent),
    #fff;
  border: 1px solid #cbd9f2;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.quick-route-card::before {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 3px;
  content: "";
  background: linear-gradient(var(--primary), var(--cyan));
}

.quick-route-copy {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 17px;
}

.quick-route-icon {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  color: #fff;
  font-size: 17px;
  background: linear-gradient(145deg, #4b7df0, var(--primary-dark));
  border-radius: 9px;
  box-shadow: 0 5px 12px rgba(50, 104, 232, 0.2);
}

.quick-route-copy h2,
.advanced-heading h2 {
  margin: 0;
  font-size: 15px;
}

.quick-route-copy p:not(.eyebrow) {
  margin: 4px 0 0;
  color: var(--ink-soft);
  font-size: 10px;
  line-height: 1.55;
}

.quick-route-fields {
  display: grid;
  grid-template-columns: minmax(220px, 1.3fr) minmax(150px, 0.7fr) minmax(220px, 1fr) auto auto;
  align-items: end;
  gap: 9px;
}

.compact-switch {
  min-height: 38px;
  padding-block: 5px;
}

.quick-route-fields > .button {
  min-height: 38px;
  white-space: nowrap;
}

.quick-route-feedback {
  min-height: 14px;
  margin: 10px 0 -3px 48px;
  color: var(--ink-faint);
  font-size: 9px;
}

.quick-route-feedback.success {
  color: var(--green);
}

.quick-route-feedback.error {
  color: var(--red);
}

.advanced-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin: 0 2px 13px;
}

.advanced-heading > p {
  margin: 0;
  color: var(--ink-faint);
  font-size: 9px;
}

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

.route-card,
.device-card {
  min-width: 0;
  padding: 19px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.route-card {
  position: relative;
  overflow: hidden;
}

.route-card::before {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 2px;
  content: "";
  background: linear-gradient(90deg, var(--primary), var(--cyan));
  opacity: 0.72;
}

.route-head {
  justify-content: flex-start;
  gap: 10px;
}

.route-number {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  color: var(--primary);
  font: 700 11px ui-monospace, SFMono-Regular, Menlo, monospace;
  background: var(--primary-soft);
  border-radius: 9px;
}

.route-head h2,
.device-card h2 {
  margin: 0;
  font-size: 16px;
}

.route-status {
  margin-left: auto;
  padding: 4px 7px;
  font-size: 9px;
  border: 1px solid;
}

.route-status.configured {
  color: #4e617a;
  background: #f3f5f8;
  border-color: #dce2ea;
}

.route-status.online {
  color: var(--green);
  background: var(--green-soft);
  border-color: #bee5d6;
}

.route-status.missing,
.route-status.failed {
  color: var(--red);
  background: var(--red-soft);
  border-color: #efc5c8;
}

.route-status.testing {
  color: var(--amber);
  background: var(--amber-soft);
  border-color: #eed3a4;
}

.route-description {
  min-height: 36px;
  margin: 12px 0 14px;
  color: var(--ink-soft);
  font-size: 10px;
  line-height: 1.65;
}

.route-form {
  display: grid;
  grid-template-columns: 1fr 0.72fr;
  gap: 11px;
}

.route-form .field:first-child,
.route-form .field:nth-child(3),
.route-form .switch-row,
.route-form .route-feedback,
.route-form .route-actions {
  grid-column: 1 / -1;
}

.field {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.field > span:first-child {
  color: #3c4960;
  font-size: 10px;
  font-weight: 650;
}

.field em {
  color: var(--red);
  font-size: 8px;
  font-style: normal;
}

.field small {
  color: var(--ink-faint);
  font-size: 9px;
  font-weight: 400;
  line-height: 1.45;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  transition:
    border-color 150ms ease,
    box-shadow 150ms ease;
}

.field input,
.field select {
  min-height: 38px;
  padding: 0 11px;
}

.field textarea {
  min-height: 114px;
  padding: 10px 11px;
  line-height: 1.6;
  resize: vertical;
}

.field input:hover,
.field textarea:hover,
.field select:hover {
  border-color: #aebbd0;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  border-color: #7899e2;
  box-shadow: 0 0 0 3px rgba(50, 104, 232, 0.09);
  outline: 0;
}

.field input::placeholder,
.field textarea::placeholder {
  color: #a8b1c1;
}

.input-shell {
  position: relative;
  display: block;
}

.input-shell input {
  padding-right: 54px;
}

.input-shell button {
  position: absolute;
  top: 50%;
  right: 5px;
  min-width: 43px;
  height: 28px;
  padding: 0 7px;
  color: var(--primary);
  font-size: 9px;
  background: transparent;
  border: 0;
  border-radius: 6px;
  transform: translateY(-50%);
}

.input-shell button:hover {
  background: var(--primary-soft);
}

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 11px;
  background: var(--surface-muted);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.switch-row > span {
  display: grid;
  gap: 2px;
}

.switch-row strong {
  font-size: 10px;
}

.switch-row small {
  color: var(--ink-faint);
  font-size: 8px;
}

.switch-row input {
  position: relative;
  width: 31px;
  height: 18px;
  margin: 0;
  appearance: none;
  background: #bac4d3;
  border-radius: 12px;
}

.switch-row input::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 12px;
  height: 12px;
  content: "";
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(20, 29, 48, 0.3);
  transition: transform 140ms ease;
}

.switch-row input:checked {
  background: var(--primary);
}

.switch-row input:checked::after {
  transform: translateX(13px);
}

.route-feedback {
  min-height: 14px;
  color: var(--ink-faint);
  font-size: 9px;
}

.route-feedback.success {
  color: var(--green);
}

.route-feedback.error {
  color: var(--red);
}

.route-actions {
  display: flex;
  justify-content: flex-end;
  gap: 7px;
}

.route-actions .button {
  min-height: 34px;
  font-size: 10px;
}

.info-callout {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 16px;
  padding: 13px 15px;
  color: #53627a;
  background: #edf4ff;
  border: 1px solid #cadbf9;
  border-radius: 10px;
}

.info-callout > span {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  color: #fff;
  font: 700 10px serif;
  background: var(--primary);
  border-radius: 50%;
}

.info-callout p {
  margin: 0;
  font-size: 10px;
  line-height: 1.65;
}

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

.device-card {
  min-height: 238px;
}

.device-card.available {
  border-top: 2px solid var(--green);
}

.device-card.unavailable {
  border-top: 2px solid #a8b3c4;
}

.device-card-head {
  justify-content: flex-start;
  gap: 12px;
}

.device-large-icon {
  position: relative;
  display: block;
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  color: var(--primary);
  background: var(--primary-soft);
  border: 1px solid #cbdbfa;
  border-radius: 10px;
}

.device-large-icon.browser::before {
  position: absolute;
  inset: 9px 7px 10px;
  content: "";
  border: 1.5px solid currentColor;
  border-radius: 3px;
}

.device-large-icon.browser::after {
  position: absolute;
  top: 14px;
  right: 7px;
  left: 7px;
  height: 1.5px;
  content: "";
  background: currentColor;
}

.device-large-icon.android {
  color: var(--green);
  background: var(--green-soft);
  border-color: #c4e8d9;
}

.device-large-icon.android::before {
  position: absolute;
  inset: 7px 12px;
  content: "";
  border: 1.5px solid currentColor;
  border-radius: 4px;
}

.device-large-icon.android::after {
  position: absolute;
  bottom: 10px;
  left: 18px;
  width: 4px;
  height: 1.5px;
  content: "";
  background: currentColor;
}

.availability-badge {
  margin-left: auto;
  padding: 4px 7px;
  font-size: 9px;
  border: 1px solid;
}

.availability-badge.online {
  color: var(--green);
  background: var(--green-soft);
  border-color: #bee4d5;
}

.availability-badge.offline {
  color: #6f7d92;
  background: #f2f4f7;
  border-color: #dce2e9;
}

.device-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  margin: 18px 0 0;
}

.device-facts > div {
  padding: 10px;
  background: var(--surface-muted);
  border: 1px solid #edf0f5;
  border-radius: 8px;
}

.device-facts dt {
  margin-bottom: 4px;
  color: var(--ink-faint);
  font-size: 8px;
}

.device-facts dd {
  margin: 0;
  color: #344158;
  font-size: 10px;
  font-weight: 650;
  overflow-wrap: anywhere;
}

.device-reason {
  margin: 12px 0 0;
  padding: 8px 10px;
  color: #715a3b;
  font-size: 9px;
  line-height: 1.5;
  background: #fff8ec;
  border: 1px solid #f0ddba;
  border-radius: 7px;
}

.page-empty {
  grid-column: 1 / -1;
  padding: 70px 20px;
  color: var(--ink-faint);
  text-align: center;
  background: #fff;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
}

.page-empty strong {
  color: var(--ink-soft);
  font-size: 13px;
}

.page-empty p {
  margin: 6px 0 0;
  font-size: 10px;
}

.loading-card {
  display: grid;
  gap: 13px;
  min-height: 220px;
}

.skeleton {
  display: block;
  background: linear-gradient(90deg, #edf1f6 25%, #f7f9fb 50%, #edf1f6 75%);
  background-size: 200% 100%;
  border-radius: 6px;
  animation: skeleton 1.3s infinite;
}

.skeleton-title {
  width: 42%;
  height: 22px;
}

.skeleton-line {
  width: 72%;
  height: 10px;
}

.skeleton-field {
  width: 100%;
  height: 42px;
}

@keyframes skeleton {
  to {
    background-position: -200% 0;
  }
}

.dialog {
  width: min(520px, calc(100vw - 32px));
  max-height: calc(100vh - 40px);
  padding: 0;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid rgba(145, 158, 180, 0.42);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  overflow: auto;
}

.dialog::backdrop {
  background: rgba(12, 20, 35, 0.48);
  backdrop-filter: blur(3px);
}

.dialog form {
  padding: 22px;
}

.dialog-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.dialog-heading h2 {
  margin: 0;
  font-size: 20px;
  letter-spacing: -0.02em;
}

.dialog-close {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  padding: 0;
  color: var(--ink-faint);
  font-size: 20px;
  background: transparent;
  border: 0;
  border-radius: 7px;
}

.dialog-close:hover {
  color: var(--ink);
  background: var(--surface-muted);
}

.dialog-copy {
  margin: 12px 0 17px;
  color: var(--ink-soft);
  font-size: 11px;
  line-height: 1.65;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 20px;
}

.dialog-actions.centered {
  justify-content: center;
}

.task-dialog {
  width: min(620px, calc(100vw - 32px));
}

.task-dialog .field {
  margin-top: 14px;
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 0.72fr;
  gap: 12px;
}

.field-grid .field {
  min-width: 0;
}

.field-status.available {
  color: var(--green);
}

.field-status.unavailable {
  color: var(--red);
}

.field-status.loading {
  color: var(--ink-faint);
}

.preflight {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 16px;
  padding: 11px 12px;
  background: var(--surface-muted);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.preflight-light {
  margin-top: 3px;
}

.preflight div {
  display: grid;
  gap: 3px;
}

.preflight strong {
  font-size: 10px;
}

.preflight p {
  margin: 0;
  color: var(--ink-faint);
  font-size: 9px;
  line-height: 1.45;
}

.preflight.ready {
  background: var(--green-soft);
  border-color: #c4e7da;
}

.preflight.warning {
  background: #fffaf1;
  border-color: #efdfc3;
}

.confirm-dialog {
  width: min(430px, calc(100vw - 32px));
  text-align: center;
}

.confirm-dialog form {
  display: grid;
  justify-items: center;
  padding: 30px 26px 24px;
}

.confirm-symbol {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  margin-bottom: 14px;
  color: #fff;
  font-size: 19px;
  font-weight: 750;
  background: var(--green);
  border-radius: 50%;
}

.confirm-symbol.danger {
  background: var(--red);
}

.confirm-dialog h2 {
  margin: 0;
  font-size: 18px;
}

.confirm-dialog p {
  margin: 10px 0 0;
  color: var(--ink-soft);
  font-size: 11px;
  line-height: 1.65;
}

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

.toast {
  padding: 12px 14px;
  color: #fff;
  font-size: 11px;
  line-height: 1.5;
  background: #26344c;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 9px;
  box-shadow: 0 12px 30px rgba(13, 21, 37, 0.24);
  animation: toast-in 180ms ease-out;
}

.toast.tone-error {
  background: #8f2f37;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

@media (max-width: 1100px) {
  .topbar {
    grid-template-columns: 180px 1fr auto;
    padding: 0 16px;
  }

  .nav-item {
    min-width: auto;
    padding: 0 12px;
  }

  #tasks-view.active {
    grid-template-columns: 250px minmax(0, 1fr);
  }

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

  .quick-route-fields {
    grid-template-columns: 1fr 0.7fr 1fr;
  }

  .quick-route-fields .compact-switch,
  .quick-route-fields > .button {
    grid-row: 2;
  }

  .trace-panel {
    max-height: none;
    min-height: 400px;
  }

  .trace-list {
    max-height: 520px;
  }

  .screen-stage {
    min-height: 480px;
  }
}

@media (max-width: 820px) {
  :root {
    --topbar-height: auto;
  }

  .topbar {
    position: static;
    grid-template-columns: 1fr auto;
    min-height: 60px;
  }

  .primary-nav {
    grid-column: 1 / -1;
    grid-row: 2;
    order: 3;
    height: 48px;
    margin: 0 -16px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
  }

  .nav-item {
    flex: 1;
    justify-content: center;
  }

  .connection-state {
    display: none;
  }

  #tasks-view.active {
    display: block;
  }

  .task-sidebar {
    position: static;
    height: auto;
    max-height: 350px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .task-list {
    max-height: 190px;
  }

  .welcome-state,
  .task-detail {
    min-height: auto;
  }

  .welcome-state {
    padding-block: 56px;
  }

  .detail-header,
  .page-heading {
    align-items: flex-start;
    flex-direction: column;
  }

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

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

  .route-grid,
  .device-grid {
    grid-template-columns: 1fr;
  }

  .quick-route-fields {
    grid-template-columns: 1fr 1fr;
  }

  .quick-route-fields > .field:first-child,
  .quick-route-fields > .field:nth-child(3) {
    grid-column: 1 / -1;
  }

  .quick-route-fields .compact-switch,
  .quick-route-fields > .button {
    grid-row: auto;
  }

  .settings-view {
    padding-top: 28px;
  }
}

@media (max-width: 560px) {
  .topbar {
    padding-inline: 12px;
  }

  .brand-copy small,
  .nav-icon,
  .nav-dot,
  .nav-count {
    display: none;
  }

  .nav-item {
    padding-inline: 8px;
    font-size: 12px;
  }

  .topbar .button {
    padding-inline: 10px;
    font-size: 11px;
  }

  .task-sidebar,
  .task-detail {
    padding-inline: 14px;
  }

  .readiness-row,
  .field-grid,
  .route-form,
  .quick-route-fields {
    grid-template-columns: 1fr;
  }

  .quick-route-fields > .field,
  .quick-route-fields > .field:first-child,
  .quick-route-fields > .field:nth-child(3),
  .quick-route-fields .compact-switch,
  .quick-route-fields > .button {
    grid-column: 1;
  }

  .quick-route-feedback {
    margin-left: 0;
  }

  .advanced-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 5px;
  }

  .route-form .field,
  .route-form .switch-row,
  .route-form .route-feedback,
  .route-form .route-actions {
    grid-column: 1;
  }

  .welcome-actions,
  .dialog-actions,
  .page-heading-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .welcome-actions .button,
  .dialog-actions .button {
    flex: 1;
  }

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

  .screen-stage {
    min-height: 330px;
  }

  .risk-list,
  .action-details {
    margin-left: 0;
  }

  .trace-head {
    flex-wrap: wrap;
  }

  .trace-head time {
    flex-basis: 100%;
    margin-left: 0;
  }

  .settings-view {
    padding-inline: 14px;
  }

  .device-facts {
    grid-template-columns: 1fr;
  }

  .dialog form {
    padding: 18px;
  }
}

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