:root {
  color-scheme: light dark;
  --tm-semantic-background-canvas: #f2f2ed;
  --tm-semantic-background-surface: #fbfbf7;
  --tm-semantic-background-subtle: #e7e8e1;
  --tm-semantic-background-raised: #ffffff;
  --tm-semantic-text-primary: #171918;
  --tm-semantic-text-secondary: #646a65;
  --tm-semantic-border-default: #c7cac2;
  --tm-semantic-action-primary: #d9c84d;
  --tm-semantic-action-primary-hover: #c8b83d;
  --tm-semantic-status-danger: #a63f34;
  --tm-semantic-status-success: #2d7659;
  --tm-semantic-status-warning: #896f16;
  --tm-semantic-focus-ring: #9b8620;
  --tm-semantic-radius-small: 10px;
  --tm-semantic-radius-medium: 16px;
  --tm-semantic-radius-large: 24px;
  --tm-semantic-shadow-raised: 0 18px 50px rgb(38 42 39 / 12%);
  --tm-semantic-space-xs: 6px;
  --tm-semantic-space-sm: 10px;
  --tm-semantic-space-md: 16px;
  --tm-semantic-space-lg: 24px;
  --tm-semantic-space-xl: 32px;
  --tm-semantic-control-height: 52px;
  --tm-semantic-icon-navigation: 24px;
  font-family: "Avenir Next", Avenir, "Segoe UI", system-ui, sans-serif;
}

:root[data-theme="dark"] {
  --tm-semantic-background-canvas: #111312;
  --tm-semantic-background-surface: #181b18;
  --tm-semantic-background-subtle: #242820;
  --tm-semantic-background-raised: #1d211d;
  --tm-semantic-text-primary: #f2f2ed;
  --tm-semantic-text-secondary: #afb5ad;
  --tm-semantic-border-default: #3b423a;
  --tm-semantic-action-primary: #e8d33e;
  --tm-semantic-action-primary-hover: #f0dd52;
  --tm-semantic-status-danger: #ef897d;
  --tm-semantic-status-success: #79d0ae;
  --tm-semantic-status-warning: #ead369;
  --tm-semantic-focus-ring: #f0db43;
  --tm-semantic-shadow-raised: 0 22px 60px rgb(0 0 0 / 32%);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --tm-semantic-background-canvas: #111312;
    --tm-semantic-background-surface: #181b18;
    --tm-semantic-background-subtle: #242820;
    --tm-semantic-background-raised: #1d211d;
    --tm-semantic-text-primary: #f2f2ed;
    --tm-semantic-text-secondary: #afb5ad;
    --tm-semantic-border-default: #3b423a;
    --tm-semantic-action-primary: #e8d33e;
    --tm-semantic-action-primary-hover: #f0dd52;
    --tm-semantic-status-danger: #ef897d;
    --tm-semantic-status-success: #79d0ae;
    --tm-semantic-status-warning: #ead369;
    --tm-semantic-focus-ring: #f0db43;
    --tm-semantic-shadow-raised: 0 22px 60px rgb(0 0 0 / 32%);
  }
}

* { box-sizing: border-box; }
html {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  min-height: 100%;
  overflow-x: clip;
  background: var(--tm-semantic-background-canvas);
}
body {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  min-height: 100dvh;
  margin: 0;
  overflow-x: clip;
  color: var(--tm-semantic-text-primary);
  background: var(--tm-semantic-background-canvas);
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; }
button { min-height: 44px; cursor: pointer; }
button:disabled { cursor: wait; opacity: .62; }
main, section, article, header, form, fieldset, div, span, label, dl, pre { min-width: 0; }
img, svg, video, canvas { max-width: 100%; height: auto; }
pre, code { max-width: 100%; overflow-wrap: anywhere; word-break: break-word; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 22px;
  width: min(1440px, calc(100% - 32px));
  min-height: 72px;
  margin: 16px auto 0;
  padding: 10px 12px 10px 18px;
  border: 1px solid var(--tm-semantic-border-default);
  border-radius: var(--tm-semantic-radius-medium);
  background: color-mix(in srgb, var(--tm-semantic-background-surface) 90%, transparent);
  box-shadow: var(--tm-semantic-shadow-raised);
  backdrop-filter: blur(18px);
}
.brand { display: flex; align-items: center; gap: 11px; color: inherit; text-decoration: none; }
.brand > span:last-child { display: grid; gap: 1px; }
.brand b { font-size: 14px; }
.brand small, .eyebrow, .pair-state {
  color: var(--tm-semantic-text-secondary);
  font: 700 9px ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: .12em;
}
.brand-mark { display: grid; width: 38px; height: 38px; border-radius: 11px; }
.brand-mark i { display: none; }
nav { display: flex; gap: 3px; margin: auto; }
nav button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 40px;
  padding: 9px 12px;
  border: 0;
  border-radius: var(--tm-semantic-radius-small);
  color: var(--tm-semantic-text-secondary);
  background: transparent;
  font-size: 11px;
  font-weight: 750;
}
nav button > span { display: none; font-size: 17px; line-height: 1; }
nav button > .mobile-nav__label { display: inline; font-size: inherit; }
nav button.active { color: var(--tm-semantic-text-primary); background: var(--tm-semantic-background-subtle); }
.connection {
  padding: 9px 11px;
  border: 1px solid var(--tm-semantic-border-default);
  border-radius: var(--tm-semantic-radius-small);
  color: var(--tm-semantic-text-secondary);
  font-size: 10px;
  white-space: nowrap;
}
.connection.live { color: var(--tm-semantic-status-success); border-color: color-mix(in srgb, var(--tm-semantic-status-success) 48%, var(--tm-semantic-border-default)); }
.connection.checking { color: var(--tm-semantic-status-warning); }

main { width: min(1280px, calc(100% - 36px)); margin: 0 auto; padding: 66px 0 110px; }
.setup { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(340px, .8fr); gap: 8vw; align-items: center; min-height: calc(100dvh - 180px); }
.setup-copy h1, .workspace-heading h1 { max-width: 780px; margin: 15px 0 20px; font-size: clamp(48px, 7vw, 88px); line-height: .94; letter-spacing: -.065em; }
.setup-copy > p:last-child, .workspace-heading > div > p:last-child { max-width: 58ch; color: var(--tm-semantic-text-secondary); font-size: 16px; line-height: 1.6; }
.pair-card, .mobile-panel, .device-management {
  border: 1px solid var(--tm-semantic-border-default);
  border-radius: var(--tm-semantic-radius-medium);
  background: var(--tm-semantic-background-surface);
  box-shadow: var(--tm-semantic-shadow-raised);
}
.pair-card { padding: clamp(24px, 4vw, 48px); }
.pair-card h2 { margin: 0 0 12px; font-size: 30px; letter-spacing: -.04em; }
.pair-card p { margin: 0 0 28px; color: var(--tm-semantic-text-secondary); font-size: 13px; line-height: 1.6; }
form { display: grid; gap: 13px; }
label { display: grid; gap: 8px; color: var(--tm-semantic-text-secondary); font-size: 11px; font-weight: 700; }
input, select, textarea {
  width: 100%;
  min-height: 48px;
  padding: 14px 16px;
  border: 1px solid var(--tm-semantic-border-default);
  border-radius: 11px;
  color: var(--tm-semantic-text-primary);
  background: var(--tm-semantic-background-surface);
  outline: none;
}
textarea { resize: vertical; line-height: 1.5; }
select { appearance: auto; }
input:focus, select:focus, textarea:focus { border-color: var(--tm-semantic-focus-ring); box-shadow: 0 0 0 3px color-mix(in srgb, var(--tm-semantic-focus-ring) 24%, transparent); }
button {
  padding: 12px 16px;
  border: 1px solid var(--tm-semantic-text-primary);
  border-radius: 11px;
  color: var(--tm-semantic-background-surface);
  background: var(--tm-semantic-text-primary);
  font-size: 11px;
  font-weight: 800;
}
button:active { transform: translateY(1px); }
button.secondary { color: var(--tm-semantic-text-primary); border-color: var(--tm-semantic-border-default); background: var(--tm-semantic-background-surface); }
button.compact { min-height: 40px; padding: 9px 12px; }
#code-step { display: grid; gap: 18px; }
#pair-code { font: 800 clamp(31px, 5vw, 52px) ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .08em; }
.pair-progress { display: flex; align-items: center; gap: 10px; padding: 13px; border-radius: 11px; background: var(--tm-semantic-background-subtle); color: var(--tm-semantic-text-secondary); font-size: 11px; }
.pair-progress i { width: 8px; height: 8px; border-radius: 50%; background: var(--tm-semantic-status-warning); box-shadow: 0 0 0 5px color-mix(in srgb, var(--tm-semantic-status-warning) 14%, transparent); }

.workspace-heading { display: grid; grid-template-columns: 1fr auto; gap: 24px; align-items: end; margin-bottom: 36px; }
.workspace-heading h1 { margin-top: 10px; font-size: clamp(44px, 6vw, 74px); }
.view { display: none; }
.view.active { display: block; animation: reveal .22s ease both; }
@keyframes reveal { from { opacity: 0; transform: translateY(5px); } }
.device-hero { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(320px, .85fr); overflow: hidden; border: 1px solid var(--tm-semantic-border-default); border-radius: var(--tm-semantic-radius-large); background: var(--tm-semantic-background-surface); box-shadow: var(--tm-semantic-shadow-raised); }
.device-hero > div { padding: clamp(28px, 6vw, 76px); }
.device-hero > div > span { color: var(--tm-semantic-status-success); font: 800 10px ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .12em; }
.device-hero h2 { margin: 18px 0 12px; font-size: clamp(40px, 7vw, 76px); letter-spacing: -.06em; }
.device-hero p { max-width: 56ch; color: var(--tm-semantic-text-secondary); line-height: 1.6; }
.relay-detail { display: inline-flex; margin-top: 8px; padding: 9px 11px; border: 1px solid var(--tm-semantic-border-default); border-radius: var(--tm-semantic-radius-small); color: var(--tm-semantic-text-secondary); background: var(--tm-semantic-background-subtle); font-size: 10px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 26px; }
.device-hero dl { display: grid; grid-template-columns: repeat(2, 1fr); margin: 0; padding: clamp(20px, 3vw, 42px); background: var(--tm-semantic-background-subtle); }
.device-hero dl div { display: grid; align-content: center; padding: 24px; border-bottom: 1px solid var(--tm-semantic-border-default); }
.device-hero dl div:nth-child(odd) { border-right: 1px solid var(--tm-semantic-border-default); }
.device-hero dl div:nth-last-child(-n+2) { border-bottom: 0; }
.device-hero dt { color: var(--tm-semantic-text-secondary); font-size: 10px; font-weight: 750; text-transform: uppercase; letter-spacing: .08em; }
.device-hero dd { margin: 8px 0 0; font-size: clamp(27px, 4vw, 48px); font-weight: 780; letter-spacing: -.04em; }

.project-grid, .content, .stack-list { display: grid; gap: 10px; margin-top: 24px; }
.project, .thread-card, .result-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 18px;
  align-items: center;
  width: 100%;
  min-height: 76px;
  padding: 17px 19px;
  text-align: left;
  color: var(--tm-semantic-text-primary);
  border: 1px solid var(--tm-semantic-border-default);
  background: var(--tm-semantic-background-surface);
}
.project span, .thread-card span, .result-card span { display: grid; gap: 5px; min-width: 0; }
.project span span, .thread-card span span, .result-card span span, .thread-card small { color: var(--tm-semantic-text-secondary); font-size: 10px; font-weight: 500; overflow-wrap: anywhere; }
.search { grid-template-columns: 1fr auto; }
.empty-state { display: grid; gap: 14px; place-items: center; min-height: 150px; padding: 28px; border: 1px dashed var(--tm-semantic-border-default); border-radius: var(--tm-semantic-radius-medium); color: var(--tm-semantic-text-secondary); text-align: center; }
.empty-state .retry { width: min(100%, 220px); }

.remote-control-layout { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(320px, .85fr); gap: var(--tm-semantic-space-lg); align-items: start; }
.remote-composer, .remote-runs { padding: clamp(22px, 4vw, 38px); border: 1px solid var(--tm-semantic-border-default); border-radius: var(--tm-semantic-radius-large); background: var(--tm-semantic-background-surface); box-shadow: var(--tm-semantic-shadow-raised); }
.remote-composer__heading { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--tm-semantic-space-lg); align-items: start; }
.remote-composer__heading h2, .remote-runs h2 { margin: var(--tm-semantic-space-xs) 0 var(--tm-semantic-space-sm); font-size: clamp(28px, 4vw, 44px); letter-spacing: -.045em; }
.remote-composer__heading p, .remote-runs p { margin: 0; color: var(--tm-semantic-text-secondary); line-height: 1.55; }
.remote-composer__agent { display: grid; gap: 3px; min-width: 116px; padding: 12px 14px; border: 1px solid color-mix(in srgb, var(--tm-semantic-status-success) 42%, var(--tm-semantic-border-default)); border-radius: var(--tm-semantic-radius-small); color: var(--tm-semantic-status-success); background: color-mix(in srgb, var(--tm-semantic-status-success) 10%, var(--tm-semantic-background-surface)); }
.remote-composer__agent small { color: var(--tm-semantic-text-secondary); }
.remote-composer__field { position: relative; margin-top: var(--tm-semantic-space-md); }
.remote-composer__field > small { position: absolute; right: 12px; bottom: 10px; color: var(--tm-semantic-text-secondary); font-size: 9px; }
.remote-composer__field textarea { padding-bottom: 30px; }
.remote-composer__options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--tm-semantic-space-sm); }
.remote-composer__actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--tm-semantic-space-sm); margin-top: var(--tm-semantic-space-sm); }
.remote-composer__actions button:only-child { grid-column: 1 / -1; }
.remote-plan { display: grid; gap: var(--tm-semantic-space-sm); padding: var(--tm-semantic-space-md); border: 1px solid var(--tm-semantic-border-default); border-radius: var(--tm-semantic-radius-medium); background: var(--tm-semantic-background-subtle); }
.remote-plan__route { display: flex; justify-content: space-between; gap: var(--tm-semantic-space-sm); align-items: center; }
.remote-plan__route span { color: var(--tm-semantic-status-success); font-size: 10px; font-weight: 800; }
.remote-plan__safeguards { display: flex; flex-wrap: wrap; gap: var(--tm-semantic-space-xs); margin: 0; padding: 0; list-style: none; }
.remote-plan__safeguards li { padding: 6px 8px; border-radius: 999px; color: var(--tm-semantic-text-secondary); background: var(--tm-semantic-background-surface); font-size: 9px; }
.remote-runs__list { display: grid; gap: var(--tm-semantic-space-sm); margin-top: var(--tm-semantic-space-lg); }
.remote-run-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--tm-semantic-space-md); align-items: center; width: 100%; min-height: 82px; padding: var(--tm-semantic-space-md); text-align: left; color: var(--tm-semantic-text-primary); border-color: var(--tm-semantic-border-default); background: var(--tm-semantic-background-subtle); }
.remote-run-card__copy { display: grid; gap: 5px; min-width: 0; }
.remote-run-card__copy b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.remote-run-card__copy small { color: var(--tm-semantic-text-secondary); }
.remote-run-card__status { padding: 6px 8px; border-radius: 999px; color: var(--tm-semantic-status-warning); background: color-mix(in srgb, var(--tm-semantic-status-warning) 12%, transparent); font-size: 9px; font-weight: 800; text-transform: uppercase; }
.remote-run-card__status[data-status="completed"] { color: var(--tm-semantic-status-success); background: color-mix(in srgb, var(--tm-semantic-status-success) 12%, transparent); }
.remote-run-card__status[data-status="failed"], .remote-run-card__status[data-status="interrupted"], .remote-run-card__status[data-status="cancelled"] { color: var(--tm-semantic-status-danger); background: color-mix(in srgb, var(--tm-semantic-status-danger) 12%, transparent); }
.mobile-panel__action { width: 100%; margin-top: var(--tm-semantic-space-lg); }
.mobile-panel__notification { display: grid; gap: var(--tm-semantic-space-sm); }
.mobile-panel__notification small { color: var(--tm-semantic-text-secondary); line-height: 1.45; }

.remote-run-dialog #remote-run-content { display: grid; gap: var(--tm-semantic-space-lg); padding: 46px clamp(20px, 5vw, 48px) 42px; }
.remote-run-dialog__header { display: grid; gap: var(--tm-semantic-space-xs); padding-right: 46px; }
.remote-run-dialog__header h2 { margin: 0; font-size: clamp(27px, 5vw, 44px); letter-spacing: -.045em; }
.remote-run-dialog__header p, .remote-run-dialog__meta, .remote-run-dialog__event time { margin: 0; color: var(--tm-semantic-text-secondary); }
.remote-run-dialog__meta { display: flex; flex-wrap: wrap; gap: var(--tm-semantic-space-sm); font-size: 10px; }
.remote-run-dialog__output { min-height: 150px; max-height: 34dvh; margin: 0; padding: var(--tm-semantic-space-md); overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; border: 1px solid var(--tm-semantic-border-default); border-radius: var(--tm-semantic-radius-medium); color: var(--tm-semantic-text-primary); background: var(--tm-semantic-background-canvas); font: 11px/1.55 ui-monospace, SFMono-Regular, Menlo, monospace; }
.remote-run-dialog__events { display: grid; gap: var(--tm-semantic-space-sm); }
.remote-run-dialog__event { display: grid; grid-template-columns: 1fr auto; gap: var(--tm-semantic-space-sm); padding: 11px 0; border-bottom: 1px solid var(--tm-semantic-border-default); }
.remote-run-dialog__event p { margin: 0; }
.remote-run-dialog__approval { display: grid; gap: var(--tm-semantic-space-sm); padding: var(--tm-semantic-space-md); border: 1px solid color-mix(in srgb, var(--tm-semantic-status-warning) 48%, var(--tm-semantic-border-default)); border-radius: var(--tm-semantic-radius-medium); background: color-mix(in srgb, var(--tm-semantic-status-warning) 8%, var(--tm-semantic-background-surface)); }
.remote-run-dialog__approval p, .remote-run-dialog__approval code { margin: 0; overflow-wrap: anywhere; }
.remote-run-dialog__approval-actions, .remote-run-dialog__steer-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--tm-semantic-space-sm); }
.remote-run-dialog__approval [data-decision="decline"], .remote-run-dialog__steer-actions [data-interrupt] { color: var(--tm-semantic-status-danger); border-color: color-mix(in srgb, var(--tm-semantic-status-danger) 48%, var(--tm-semantic-border-default)); background: transparent; }
.remote-run-dialog__steer { display: grid; gap: var(--tm-semantic-space-sm); }
.remote-run-dialog__quality, .remote-run-dialog__changes { display: grid; gap: var(--tm-semantic-space-sm); }
.remote-run-dialog__section-header { display: flex; align-items: center; justify-content: space-between; gap: var(--tm-semantic-space-sm); }
.remote-run-dialog__section-header .eyebrow { margin: 0; }
.remote-run-dialog__gates { display: grid; gap: var(--tm-semantic-space-xs); }
.remote-run-dialog__gates article { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--tm-semantic-space-sm); padding: var(--tm-semantic-space-sm); border: 1px solid var(--tm-semantic-border-default); border-radius: var(--tm-semantic-radius-medium); }
.remote-run-dialog__gates article > span { color: var(--tm-semantic-status-warning); font-weight: 700; }
.remote-run-dialog__gates article[data-status="passed"] > span { color: var(--tm-semantic-status-success); }
.remote-run-dialog__gates article[data-status="failed"] > span { color: var(--tm-semantic-status-danger); }
.remote-run-dialog__gates b, .remote-run-dialog__gates small { display: block; }
.remote-run-dialog__gates small, .remote-run-dialog__muted, .remote-run-dialog__changes li small { color: var(--tm-semantic-text-secondary); }
.remote-run-dialog__changes ul { display: grid; gap: var(--tm-semantic-space-xs); margin: 0; padding: 0; list-style: none; }
.remote-run-dialog__changes li { display: flex; justify-content: space-between; gap: var(--tm-semantic-space-sm); }
.remote-run-dialog__terminal { display: grid; gap: var(--tm-semantic-space-sm); }
.remote-run-dialog__terminal-output { min-height: calc(var(--tm-semantic-space-xl) * 4); max-height: 38dvh; color: var(--tm-semantic-status-success); border-color: var(--tm-semantic-border-default); }
.remote-run-dialog__terminal-keys { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--tm-semantic-space-xs); }
.remote-run-dialog__terminal-keys button { min-width: 0; padding-inline: var(--tm-semantic-space-xs); }
.remote-run-dialog__terminal-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: var(--tm-semantic-space-sm); }
.remote-run-dialog__terminal-form label { display: grid; gap: var(--tm-semantic-space-xs); color: var(--tm-semantic-text-secondary); }
.remote-run-dialog__terminal-form input { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

.more-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.mobile-panel { padding: clamp(22px, 4vw, 34px); box-shadow: none; }
.mobile-panel h2, .device-management h2 { margin: 7px 0 8px; font-size: clamp(24px, 4vw, 34px); letter-spacing: -.04em; }
.mobile-panel p, .device-management p { margin: 0; color: var(--tm-semantic-text-secondary); line-height: 1.55; }
.panel-heading { display: flex; align-items: start; justify-content: space-between; gap: 18px; }
.appearance-panel { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 24px; }
.theme-selector, .data-mode-selector { display: grid; padding: 4px; border: 1px solid var(--tm-semantic-border-default); border-radius: var(--tm-semantic-radius-medium); background: var(--tm-semantic-background-subtle); }
.theme-selector { grid-template-columns: repeat(3, 1fr); }
.data-mode-selector { grid-template-columns: repeat(2, 1fr); margin-top: var(--tm-semantic-space-lg); }
.theme-selector button, .data-mode-selector button { min-width: 92px; color: var(--tm-semantic-text-secondary); border: 0; background: transparent; }
.theme-selector button.active, .data-mode-selector button.active { color: var(--tm-semantic-text-primary); background: var(--tm-semantic-background-surface); box-shadow: 0 2px 10px color-mix(in srgb, var(--tm-semantic-text-primary) 10%, transparent); }
.info-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px; align-items: center; padding: 15px 0; border-bottom: 1px solid var(--tm-semantic-border-default); }
.info-row:last-child { border-bottom: 0; }
.info-row span { display: grid; gap: 4px; }
.info-row small { color: var(--tm-semantic-text-secondary); }
.info-row strong { color: var(--tm-semantic-status-success); font-size: 11px; }
.memory-row { display: grid; gap: 8px; padding: 16px; border-radius: 12px; background: var(--tm-semantic-background-subtle); }
.memory-row > div { display: flex; justify-content: space-between; gap: 12px; color: var(--tm-semantic-text-secondary); font: 700 9px ui-monospace, SFMono-Regular, Menlo, monospace; text-transform: uppercase; letter-spacing: .08em; }
.memory-row p { display: -webkit-box; overflow: hidden; margin: 0; color: var(--tm-semantic-text-secondary); font-size: 12px; line-height: 1.5; -webkit-box-orient: vertical; -webkit-line-clamp: 4; }
.memory-row small { color: var(--tm-semantic-text-secondary); }
.diagnostic-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 22px; }
.diagnostic-card { display: grid; gap: 8px; padding: 16px; border-radius: 12px; background: var(--tm-semantic-background-subtle); }
.diagnostic-card span { color: var(--tm-semantic-text-secondary); font-size: 11px; }
.device-management { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 24px; margin-top: 18px; padding: clamp(24px, 4vw, 36px); box-shadow: none; }
.device-actions { display: grid; gap: var(--tm-semantic-space-sm); align-self: center; }
.device-list { grid-column: 1 / -1; display: grid; border-top: 1px solid var(--tm-semantic-border-default); }
.device-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 18px; align-items: center; padding: 18px 0; border-bottom: 1px solid var(--tm-semantic-border-default); }
.device-row span { display: grid; gap: 4px; }
.device-row small { color: var(--tm-semantic-text-secondary); }
.device-row button { color: var(--tm-semantic-status-danger); border-color: color-mix(in srgb, var(--tm-semantic-status-danger) 38%, var(--tm-semantic-border-default)); background: transparent; }

dialog { position: fixed; width: min(820px, calc(100% - 28px)); max-width: calc(100% - 28px); max-height: calc(100dvh - 28px); padding: 0; overflow: auto; color: var(--tm-semantic-text-primary); border: 1px solid var(--tm-semantic-border-default); border-radius: var(--tm-semantic-radius-large); background: var(--tm-semantic-background-surface); box-shadow: var(--tm-semantic-shadow-raised); }
dialog::backdrop { background: rgb(0 0 0 / 62%); backdrop-filter: blur(8px); }
dialog .close { position: absolute; top: 12px; right: 12px; z-index: 2; min-width: 44px; margin: 0; color: var(--tm-semantic-text-primary); border-color: var(--tm-semantic-border-default); background: var(--tm-semantic-background-subtle); }
#thread-content { padding: 46px clamp(20px, 5vw, 52px) 42px; }
#thread-content h2 { padding-right: 46px; font-size: clamp(28px, 5vw, 48px); letter-spacing: -.045em; }
.launches { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 18px 0 28px; }
.message { padding: 18px 0; border-bottom: 1px solid var(--tm-semantic-border-default); }
.message b { font-size: 10px; text-transform: uppercase; letter-spacing: .08em; }
.message p { white-space: pre-wrap; overflow-wrap: anywhere; color: var(--tm-semantic-text-secondary); line-height: 1.6; }
.execution-card, .checkpoint-card { display: grid; grid-template-columns: auto 1fr; gap: 14px; margin: 0 0 18px; padding: 16px; border: 1px solid var(--tm-semantic-border-default); border-radius: 12px; background: var(--tm-semantic-background-subtle); }
.execution-card > span, .checkpoint-card > span { align-self: start; padding: 6px 8px; border-radius: 999px; color: var(--tm-semantic-status-success); background: color-mix(in srgb, var(--tm-semantic-status-success) 14%, var(--tm-semantic-background-surface)); font: 800 8px ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .1em; }
.execution-card.blocked > span { color: var(--tm-semantic-status-danger); }
.execution-card b, .execution-card small, .execution-card p, .checkpoint-card b, .checkpoint-card small, .checkpoint-card p { display: block; }
.execution-card small, .execution-card p, .checkpoint-card small, .checkpoint-card p { margin: 5px 0 0; color: var(--tm-semantic-text-secondary); font-size: 10px; overflow-wrap: anywhere; }

#toast { position: fixed; left: 50%; bottom: 24px; z-index: 50; max-width: calc(100% - 32px); padding: 12px 16px; transform: translate(-50%, 14px); opacity: 0; pointer-events: none; border: 1px solid var(--tm-semantic-border-default); border-radius: 11px; color: var(--tm-semantic-text-primary); background: var(--tm-semantic-background-raised); box-shadow: var(--tm-semantic-shadow-raised); font-size: 11px; transition: opacity .2s ease, transform .2s ease; }
#toast.visible { opacity: 1; transform: translate(-50%, 0); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
:where(button, input, select, textarea, a):focus-visible { outline: 3px solid var(--tm-semantic-focus-ring); outline-offset: 3px; }
[hidden] { display: none !important; }
body.auth-pending > :not(#auth-gate) { display: none !important; }
#auth-gate { position: fixed; inset: 0; z-index: 9999; display: grid; place-items: center; padding: 24px; color: var(--tm-semantic-text-primary); background: var(--tm-semantic-background-canvas); }
#auth-gate > div { display: grid; justify-items: center; gap: 14px; text-align: center; }
#auth-gate .brand-mark { width: 48px; height: 48px; border-radius: 14px; }
#auth-gate b { font-size: 16px; }
#auth-gate span:last-child { color: var(--tm-semantic-text-secondary); font-size: 12px; }

@media (max-width: 840px) {
  .site-header { position: static; width: calc(100% - 24px); margin-top: 12px; }
  .site-header .brand small { display: none; }
  main { width: calc(100% - 28px); padding: 42px 0 112px; }
  .setup { grid-template-columns: 1fr; min-height: auto; }
  .workspace-heading { grid-template-columns: 1fr; align-items: start; margin-bottom: 26px; }
  .workspace-heading .secondary { width: 100%; }
  .device-hero { grid-template-columns: 1fr; }
  .device-hero > div { padding: 32px 24px; }
  .more-grid { grid-template-columns: 1fr; }
  .appearance-panel { grid-column: auto; grid-template-columns: 1fr; }
  .device-management { grid-template-columns: 1fr; }
  .device-actions, .device-actions button { width: 100%; }
}

@media (max-width: 620px) {
  :root {
    --tm-semantic-radius-large: 20px;
    --tm-semantic-control-height: 48px;
  }
  .site-header {
    width: calc(100% - 20px);
    min-height: 58px;
    margin-top: max(8px, env(safe-area-inset-top));
    padding: 7px 9px;
    gap: 10px;
    border-radius: 14px;
    background: var(--tm-semantic-background-surface);
    backdrop-filter: none;
  }
  .brand-mark { width: 34px; height: 34px; border-radius: 9px; }
  .brand { min-width: 44px; min-height: 44px; justify-content: center; }
  .brand > span:last-child { display: none; }
  .connection { max-width: 142px; margin-left: auto; padding: 8px 10px; overflow: hidden; text-overflow: ellipsis; }
  main {
    width: 100%;
    max-width: 100%;
    padding: 24px 12px calc(98px + env(safe-area-inset-bottom));
  }
  #workspace-nav {
    position: fixed;
    left: max(10px, env(safe-area-inset-left));
    right: max(10px, env(safe-area-inset-right));
    bottom: max(8px, env(safe-area-inset-bottom));
    z-index: 40;
    display: grid !important;
    grid-template-columns: repeat(5, 1fr);
    gap: 2px;
    margin: 0;
    padding: 4px;
    border: 1px solid var(--tm-semantic-border-default);
    border-radius: 16px;
    background: color-mix(in srgb, var(--tm-semantic-background-raised) 92%, transparent);
    box-shadow: var(--tm-semantic-shadow-raised);
    backdrop-filter: blur(20px);
  }
  #workspace-nav button { display: grid; place-items: center; gap: 3px; min-width: 0; min-height: 58px; padding: 6px 2px; }
  #workspace-nav .mobile-nav__icon { display: block; font-size: 22px; line-height: 1; }
  #workspace-nav .mobile-nav__label { display: block; font-size: 9px; line-height: 1; }
  .workspace-heading { gap: 14px; margin-bottom: 18px; }
  .workspace-heading h1 { margin: 6px 0 9px; font-size: clamp(30px, 9.5vw, 40px); line-height: 1; letter-spacing: -.05em; overflow-wrap: anywhere; }
  .workspace-heading > div > p:last-child { font-size: 12px; line-height: 1.5; }
  .workspace-heading .secondary { min-height: 42px; padding-block: 9px; }
  .setup { gap: 22px; }
  .setup-copy h1 { margin: 10px 0 14px; font-size: clamp(36px, 12vw, 50px); line-height: .98; }
  .setup-copy > p:last-child { font-size: 14px; }
  .pair-card { padding: 22px 18px; }
  input, select, textarea { min-height: 48px; padding: 12px 13px; font-size: 16px; }
  button { font-size: 12px; }
  button.compact { min-height: 44px; }
  .device-hero { border-radius: 20px; }
  .device-hero > div { padding: 22px 18px; }
  .device-hero h2 { margin: 11px 0 8px; font-size: clamp(30px, 10vw, 38px); line-height: 1; }
  .device-hero p { margin: 0; font-size: 13px; line-height: 1.5; }
  .relay-detail { width: 100%; margin-top: 12px; }
  .hero-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 18px; }
  .hero-actions button:first-child { grid-column: 1 / -1; }
  .device-hero dl { padding: 10px; }
  .device-hero dl div { padding: 13px 10px; }
  .device-hero dd { font-size: 28px; }
  .project-grid, .content, .stack-list { margin-top: 16px; }
  .project, .thread-card, .result-card { min-height: 66px; gap: 10px; padding: 13px 14px; }
  .launches, .search { grid-template-columns: 1fr; display: grid; }
  .launches button, .search button { width: 100%; }
  .theme-selector, .data-mode-selector { width: 100%; }
  .theme-selector button, .data-mode-selector button { min-width: 0; padding-inline: 4px; }
  .more-grid { gap: 12px; }
  .mobile-panel { padding: 18px 16px; }
  .mobile-panel h2, .device-management h2 { font-size: 24px; }
  .panel-heading { display: flex; align-items: center; gap: 10px; }
  .panel-heading > div { flex: 1; }
  .panel-heading button { width: auto; min-width: 92px; }
  .diagnostic-grid { grid-template-columns: 1fr 1fr; }
  .info-row { grid-template-columns: 1fr; }
  .info-row strong { justify-self: start; }
  .device-row { grid-template-columns: 1fr; }
  .device-row button { width: 100%; }
  .remote-control-layout { grid-template-columns: 1fr; }
  .remote-control-layout { gap: 12px; }
  .remote-composer, .remote-runs { padding: 18px 16px; border-radius: 20px; box-shadow: none; }
  .remote-composer__heading { grid-template-columns: 1fr; }
  .remote-composer__heading h2, .remote-runs h2 { margin: 5px 0 7px; font-size: clamp(27px, 8.5vw, 34px); line-height: 1.05; }
  .remote-composer__heading p, .remote-runs p { font-size: 13px; line-height: 1.5; }
  .remote-composer__agent { width: 100%; }
  .remote-composer__field { margin-top: 12px; }
  .remote-composer__field textarea { min-height: 144px; }
  .remote-composer__options { gap: 8px; }
  .remote-runs__list { margin-top: 14px; }
  .remote-run-card { min-height: 70px; gap: 10px; padding: 12px; }
  .remote-run-card__copy b { font-size: 12px; }
  .remote-plan { padding: 13px; }
  .empty-state { min-height: 118px; padding: 20px 14px; }
  .device-management { gap: 16px; padding: 20px 16px; }
  dialog {
    inset: auto 0 0;
    width: 100%;
    max-width: 100%;
    height: min(92dvh, 780px);
    max-height: calc(100dvh - env(safe-area-inset-top));
    margin: 0;
    border-width: 1px 0 0;
    border-radius: 22px 22px 0 0;
    overscroll-behavior: contain;
  }
  dialog .close { top: 10px; right: 10px; min-width: 44px; min-height: 44px; }
  #thread-content, .remote-run-dialog #remote-run-content { gap: 18px; padding: 22px 16px calc(26px + env(safe-area-inset-bottom)); }
  #thread-content h2, .remote-run-dialog__header h2 { margin: 0; padding-right: 48px; font-size: clamp(23px, 7vw, 30px); line-height: 1.08; letter-spacing: -.04em; overflow-wrap: anywhere; }
  .remote-run-dialog__header { gap: 7px; padding-right: 0; }
  .remote-run-dialog__header > .remote-run-card__status { width: fit-content; max-width: calc(100% - 52px); }
  .remote-run-dialog__header p { padding-right: 4px; font-size: 13px; line-height: 1.5; overflow-wrap: anywhere; }
  .remote-run-dialog__meta { display: grid; gap: 4px; font-size: 10px; }
  .remote-run-dialog__meta span { overflow-wrap: anywhere; }
  .remote-run-dialog__output { width: 100%; min-height: 126px; max-height: 30dvh; padding: 13px; font-size: 11px; }
  .remote-run-dialog__event { grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
  .remote-run-dialog__event p { overflow-wrap: anywhere; }
  .execution-card, .checkpoint-card { grid-template-columns: 1fr; padding: 13px; }
  #toast { right: 12px; left: 12px; width: auto; max-width: none; text-align: center; transform: translateY(14px); }
  #toast.visible { transform: translateY(0); }
  #toast { bottom: 84px; }
}

@media (max-width: 480px) {
  .remote-composer__options, .remote-composer__actions, .remote-run-dialog__approval-actions, .remote-run-dialog__steer-actions { grid-template-columns: 1fr; }
  .remote-plan__route { display: grid; }
  .remote-plan__route span { justify-self: start; }
}

@media (max-width: 360px) {
  main { padding-inline: 9px; }
  .site-header { width: calc(100% - 14px); }
  .connection { max-width: 118px; overflow: hidden; text-overflow: ellipsis; }
  .diagnostic-grid { grid-template-columns: 1fr; }
  .device-hero dl div { padding: 13px 8px; }
  #workspace-nav .mobile-nav__label { font-size: 9px; }
  .panel-heading { display: grid; }
  .panel-heading button { width: 100%; }
}

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