  :root { color-scheme: light; }
  * { box-sizing: border-box; }
  html, body { margin: 0; }
  body { background: #fff; color: #111; font: 14px/1.5 ui-sans-serif, -apple-system, "Helvetica Neue", Helvetica, Arial, sans-serif; -webkit-font-smoothing: antialiased; }
  .mono, code { font-family: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace; font-size: 12px; }
  header { display: flex; align-items: center; gap: 16px; padding: 18px 32px; border-bottom: 1px solid #111; }
  .brand-logo { display: block; width: 205px; height: auto; }
  header .meta { margin-left: auto; color: #999; font-size: 11px; letter-spacing: .08em; }
  main { max-width: 980px; margin: 0 auto; padding: 40px 32px 96px; }
  section { margin: 0 0 64px; }
  h2 { font-size: 11px; font-weight: 500; letter-spacing: .14em; text-transform: uppercase; color: #aaa; margin: 0 0 14px; }
  h2 .section-number { color: #111; margin-right: 12px; }
  h3 { font-size: 10px; font-weight: 500; letter-spacing: .1em; text-transform: uppercase; color: #999; margin: 0 0 10px; }
  .device-group + .device-group { margin-top: 36px; }
  .section-intro { color: #777; font-size: 13px; margin: 0 0 14px; }
  .table-scroll { overflow-x: auto; }
  table { width: 100%; border-collapse: collapse; font-size: 13px; }
  th { text-align: left; font-weight: 500; font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: #999; padding: 0 10px 6px 0; border-bottom: 1px solid #111; white-space: nowrap; }
  td { padding: 10px 10px 10px 0; border-bottom: 1px solid #ebebeb; vertical-align: top; }
  tbody tr:hover td { background: #fafafa; }
  .muted { color: #9a9a9a; }
  .id { color: #666; }
  .dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; border: 1px solid #111; vertical-align: 1px; }
  .dot.on { background: #111; }
  .dot.off { background: transparent; }
  .status { font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: #111; }
  .status.revoked { color: #bbb; text-decoration: line-through; }
  /* Default actions are outlined; reserve primary for the main action. */
  button, a.button { font: inherit; font-size: 12px; background: #fff; color: #111; border: 1px solid #111; border-radius: 4px; padding: 7px 14px; cursor: pointer; }
  button:hover, a.button:hover { background: #f5f5f5; color: #111; }
  button.primary, a.button.primary { background: #111; color: #fff; }
  button.primary:hover, a.button.primary:hover { background: #333; color: #fff; }
  button.danger:hover { background: #fff; color: #8b2424; border-color: #8b2424; }
  .device-actions { display: grid; width: 90px; gap: 6px; }
  .device-actions button { width: 100%; }
  .action-state { display: flex; align-items: center; justify-content: center; min-height: 30px; font-size: 11px; }
  .action-note { font-size: 11px; line-height: 1.3; }
  input, select { font: inherit; font-size: 13px; border: 1px solid #ccc; border-radius: 2px; padding: 5px 8px; background: #fff; color: #111; }
  input:focus, select:focus { outline: 1px solid #111; outline-offset: 0; }
  .row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
  .readme-steps { margin: 0; padding-left: 22px; color: #555; font-size: 13px; }
  .readme-steps li { padding-left: 6px; }
  .readme-steps li + li { margin-top: 9px; }
  .readme-subheading { margin-top: 22px; }
  .cmd { display: block; font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 12px; line-height: 1.6; border: 1px solid #e5e5e5; background: #fafafa; padding: 12px 14px; white-space: pre-wrap; overflow-wrap: anywhere; margin: 14px 0 0; }
  .install-command-row { display: flex; align-items: center; gap: 10px; margin-top: 14px; }
  .install-command-row .cmd { flex: 1; min-width: 0; margin: 0; }
  .install-command-row button { flex: none; }
  .pair-result-row { align-items: flex-start; margin-top: 8px; }
  .pair-result-title { margin-top: 18px; padding-left: 14px; font: 600 12px/1.5 ui-sans-serif, -apple-system, "Helvetica Neue", Helvetica, Arial, sans-serif; }
  .note { color: #8a8a8a; font-size: 12px; margin-top: 10px; }
  .caps { max-width: 280px; color: #555; font-size: 12px; }
  .device-identity { display: flex; align-items: center; gap: 12px; min-width: 190px; }
  .device-identity img { display: block; width: 64px; height: 64px; flex: none; object-fit: contain; }
  .device-identity .id { overflow-wrap: anywhere; }
  .execution-detail td { padding: 0 10px 14px 76px; }
  .execution-detail:hover td { background: #fff; }
  .execution-detail details { border-left: 1px solid #ddd; padding-left: 14px; }
  .execution-detail summary { cursor: pointer; color: #666; font-size: 12px; padding: 6px 0; }
  .execution-detail details[open] summary { color: #111; }
  .execution-detail table { margin-top: 8px; }
  .execution-detail table td { padding: 8px 10px 8px 0; }
  .execution-detail code { overflow-wrap: anywhere; }
  .other-executions { margin-top: 20px; border-top: 1px solid #ebebeb; padding-top: 10px; }
  .other-executions summary { cursor: pointer; color: #666; font-size: 12px; }
  #login { max-width: 380px; margin: 96px auto 0; }
  #login .brand-logo { margin-bottom: 28px; }
  #login .row input { flex: 1; }
  .err { color: #111; font-size: 12px; min-height: 16px; margin-top: 8px; }
  .empty { color: #aaa; font-size: 12px; padding: 14px 0; }
  @media (max-width: 600px) {
    main { padding: 28px 18px 64px; }
    header { padding: 16px 18px; }
    .brand-logo { width: 185px; }
    .device-identity { min-width: 160px; gap: 8px; }
    .device-identity img { width: 48px; height: 48px; }
    .execution-detail td { padding-left: 12px; }
    .install-command-row { flex-wrap: wrap; }
  }

  /* Shared user/admin shell. User panels stay empty until login exists. */
  [hidden] { display: none !important; }
  body { background: #f7f7f5; }
  h1 { margin: 8px 0 12px; font-size: 28px; font-weight: 600; line-height: 1.25; letter-spacing: -.035em; }
  a { color: inherit; }
  button:focus-visible, a:focus-visible, summary:focus-visible { outline: 2px solid #111; outline-offset: 4px; }
  button:disabled, button:disabled:hover { background: #efefed; color: #888; border-color: #ddd; cursor: not-allowed; }
  .text-link { font-size: 12px; text-decoration: none; white-space: nowrap; }
  .text-link:hover { text-decoration: underline; }
  .eyebrow { color: #777; font-size: 10px; letter-spacing: .16em; }
  .login-card, #login.login-card { width: calc(100% - 36px); max-width: 460px; margin: 9vh auto 48px; padding: 36px; border: 1px solid #dcdcd6; border-radius: 8px; background: #fff; }
  .login-card .brand-logo, #login.login-card .brand-logo { width: 180px; margin-bottom: 42px; }
  .login-card h1 { margin-top: 10px; }
  .login-card > .text-link { display: inline-block; margin-top: 20px; }
  .login-card .row { flex-wrap: nowrap; }
  .login-card .row input { min-width: 0; flex: 1; }
  .field-label { display: block; margin: 24px 0 8px; font-size: 12px; color: #555; }
  .login-wide { display: block; width: 100%; padding: 10px; margin-top: 10px; }
  .login-input { display: block; width: 100%; padding: 9px 10px; }
  textarea.login-input { font: inherit; font-size: 13px; resize: vertical; }
  #userLoginButton, #registerButton { margin-top: 24px; }
  #registerDone { margin-top: 24px; }
  #registerDone .install-command-row { margin: 16px 0 8px; }
  #registerKey { word-break: break-all; }
  .panel-card > .section-intro + .table-scroll { margin-top: 14px; }
  .device-identity.compact { min-width: 150px; gap: 10px; }
  .device-identity.compact img { width: 36px; height: 36px; }
  .row-actions { display: grid; gap: 5px; justify-items: stretch; }
  .row-actions button { padding: 3px 10px; font-size: 11px; white-space: nowrap; }
  #ownerSelect { display: block; width: 100%; margin-top: 8px; }
  .app-shell { display: grid; grid-template-columns: 210px minmax(0, 1fr); grid-template-rows: auto 1fr; min-height: 100vh; }
  .app-header { grid-column: 1 / -1; padding: 18px 28px; border-bottom: 1px solid #dcdcd6; background: #fff; }
  .app-header .brand-logo { width: 160px; }
  .app-header .meta { font-size: 12px; color: #666; letter-spacing: 0; }
  .role-badge { display: inline-block; padding: 3px 8px; border: 1px solid #ddd; border-radius: 4px; font-size: 11px; color: #666; white-space: nowrap; }
  .sidebar { padding: 34px 18px; border-right: 1px solid #e2e2dc; display: flex; flex-direction: column; }
  .nav-label { margin: 0 12px 16px; color: #888; font-size: 11px; }
  .sidebar nav { display: grid; gap: 5px; }
  .sidebar nav a { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; border-radius: 4px; color: #555; text-decoration: none; font-size: 13px; }
  .sidebar nav a:hover { background: #ebebe7; color: #111; }
  .sidebar nav a[aria-current="page"] { background: #171717; color: #fff; }
  .nav-note { font-size: 10px; opacity: .7; }
  .sidebar-note { margin: auto 12px 0; padding-top: 48px; color: #999; font-size: 10px; line-height: 1.8; }
  main.workspace-content { width: 100%; max-width: none; min-width: 0; margin: 0; padding: 40px 36px 80px; }
  [data-user-panel="guide"] { width: 100%; max-width: 900px; }
  .page-heading { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-bottom: 28px; }
  .page-heading h1 { margin-bottom: 10px; }
  .page-heading p { margin: 0; color: #777; font-size: 13px; }
  .page-heading > button, .page-heading > a { flex: none; }
  a.button { display: inline-block; text-decoration: none; }
  .summary-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-bottom: 28px; }
  .summary-grid.four { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .stat-group-title { margin: 0 0 12px; color: #555; font-size: 12px; font-weight: 600; letter-spacing: .03em; }
  .summary-card { padding: 20px 24px; border: 1px solid #e1e1db; border-radius: 6px; background: #fff; }
  .summary-card > span { display: block; color: #777; font-size: 12px; }
  .summary-card > strong { display: block; margin-top: 12px; font-size: 30px; line-height: 1.2; font-weight: 500; }
  .summary-card > small { display: block; margin-top: 8px; color: #999; font-size: 11px; }
  .summary-card > small.card-hint { margin-top: 10px; padding-top: 8px; border-top: 1px solid #efefea; color: #777; line-height: 1.6; }
  .link-button { padding: 0; border: 0; background: none; color: #111; font-size: inherit; text-decoration: underline; cursor: pointer; }
  .link-button:hover { background: none; color: #555; }
  .panel-card { margin: 0 0 22px; padding: 24px; border: 1px solid #e1e1db; border-radius: 6px; background: #fff; }
  .panel-card h2 { color: #555; font-size: 12px; letter-spacing: .03em; text-transform: none; }
  .panel-card > p { margin: 0; color: #777; font-size: 13px; }
  .panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
  .panel-heading h2 { margin: 0; }
  .panel-heading > .muted { font-size: 11px; }
  .panel-heading + .readme-steps { margin-top: 24px; }
  .notice { margin-bottom: 24px; padding: 16px 18px; border: 1px solid #d9d9d3; border-left: 3px solid #777; border-radius: 4px; background: #f0f0ec; font-size: 12px; color: #555; }
  .notice p { margin: 6px 0 0; }
  .error-notice { border-color: #a33; color: #8b2424; background: #fff5f5; }
  .empty-state { padding: 40px 12px; text-align: center; }
  .empty-state img { width: 92px; height: 92px; object-fit: contain; margin-bottom: 16px; }
  .empty-state h3 { color: #555; font-size: 14px; letter-spacing: 0; text-transform: none; margin: 0 0 8px; }
  .empty-state p { margin: 0; color: #888; font-size: 12px; }
  .empty-symbol { display: block; color: #aaa; font-size: 32px; margin-bottom: 18px; }
  .architecture-card { margin: 0 0 24px; }
  .architecture-card h2 { margin: 0; color: #111; font-size: 16px; font-weight: 600; letter-spacing: 0; text-transform: none; }
  .architecture-card > .architecture-intro { margin: 8px 0 24px; color: #666; font-size: 13px; line-height: 1.7; }
  .architecture-flow { display: grid; grid-template-columns: minmax(0, 1fr) 44px minmax(0, 1fr) 44px minmax(0, 1fr); gap: 10px; }
  .architecture-host { display: flex; flex-direction: column; justify-content: center; min-width: 0; padding: 18px 14px; border: 1px solid #deded8; border-radius: 6px; }
  .architecture-host-label { display: flex; align-items: center; justify-content: center; gap: 8px; margin-bottom: 16px; color: #666; font-size: 12px; }
  .architecture-host-label img { display: block; flex: none; width: 28px; height: 28px; object-fit: contain; }
  .architecture-component { display: grid; gap: 6px; text-align: center; }
  .architecture-component > strong, .architecture-component > code { font-size: 14px; font-weight: 600; line-height: 1.6; }
  .architecture-component > span { color: #666; font-size: 12px; line-height: 1.8; }
  .architecture-local-link { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 0; color: #888; font-size: 11px; }
  .architecture-local-link > span { color: #111; font-size: 20px; }
  .architecture-link { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; color: #777; font-size: 11px; }
  .architecture-link svg { display: block; width: 44px; height: 24px; fill: none; stroke: #555; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
  .architecture-fabric { border-color: #999; background: #fafaf8; }
  .architecture-host-note { margin: 16px 0 0; color: #777; font-size: 11px; line-height: 1.8; text-align: center; }
  .architecture-device-resources { margin-top: 18px; padding-top: 14px; border-top: 1px solid #e5e5df; color: #555; font-size: 12px; line-height: 1.8; text-align: center; }
  .architecture-card figcaption { margin-top: 20px; padding-top: 16px; border-top: 1px solid #ebebeb; color: #666; font-size: 12px; line-height: 1.8; }
  .guide-steps { list-style: none; margin: 0; padding: 0; }
  .panel-card.guide-step h2 { display: flex; align-items: center; gap: 10px; margin: 0; color: #111; font-size: 14px; letter-spacing: 0; }
  .guide-step > p { margin: 12px 0 0; color: #555; font-size: 13px; }
  .step-number { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 24px; height: 24px; border-radius: 50%; background: #111; color: #fff; font-size: 12px; }
  .guide-banner { display: flex; width: fit-content; max-width: 100%; align-items: center; gap: 24px; padding: 16px 20px; }
  .guide-banner > .button { flex: none; white-space: nowrap; }
  .guide-banner h2 { margin: 0 0 6px; }
  .guide-banner p { margin: 0; color: #777; font-size: 13px; }
  .split-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 22px; margin-bottom: 22px; }
  .split-grid .panel-card { margin: 0; }
  .device-panels { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; gap: 22px; }
  .device-panels .panel-card { min-width: 0; margin: 0; }
  .device-panels .panel-heading { margin-bottom: 20px; }
  .device-panels .panel-heading p { margin: 6px 0 0; color: #777; font-size: 12px; }
  .device-panels .row-actions { width: 84px; }
  .device-panels .device-identity b { overflow-wrap: anywhere; }
  .device-panels .empty-state { display: grid; grid-template-columns: 64px minmax(0, 1fr); column-gap: 20px; padding: 24px 8px; text-align: left; }
  .device-panels .empty-state img { grid-row: 1 / 3; width: 64px; height: 64px; margin: 0; }
  .device-panels .empty-state h3 { align-self: end; }
  .device-panels .panel-heading > button { flex: none; }
  .binding-guide { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 16px; margin-bottom: 18px; padding: 14px 18px; border: 1px solid #deded8; border-radius: 6px; background: #fff; color: #555; font-size: 12px; line-height: 1.7; }
  .binding-guide > strong { margin-right: 4px; color: #111; font-weight: 600; }
  .binding-guide b { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; margin-right: 4px; border: 1px solid #aaa; border-radius: 50%; color: #111; font-size: 11px; font-weight: 500; }
  .binding-guide-direction::before { content: '→'; color: #777; font-size: 18px; }
  .column-summary { display: grid; gap: 12px; margin-bottom: 22px; }
  .column-summary.dut-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .column-summary .summary-card { padding: 16px; background: #fafaf8; }
  .column-summary .summary-card > strong { margin-top: 8px; font-size: 26px; }
  .device-panels .column-note { margin-top: 18px; padding-top: 14px; border-top: 1px solid #ebebeb; font-size: 12px; line-height: 1.7; }
  .entity-card { display: grid; grid-template-columns: minmax(0, 1fr) 84px; gap: 18px 20px; min-height: 176px; padding: 20px; border: 1px solid #e5e5df; border-radius: 6px; }
  .entity-card + .entity-card { margin-top: 14px; }
  .entity-card-main { display: flex; align-items: flex-start; flex-wrap: wrap; gap: 12px; min-width: 0; }
  .entity-card .device-identity { flex: 1 1 180px; min-width: 0; align-items: center; gap: 12px; }
  .entity-card .device-identity img { width: 52px; height: 52px; }
  .entity-card .device-identity b { font-size: 14px; line-height: 1.6; }
  .entity-card .device-identity > div { min-width: 0; }
  .entity-card .row-actions { grid-column: 2; grid-row: 1 / 3; align-self: start; }
  .entity-card .row-actions button { padding-top: 6px; padding-bottom: 6px; }
  .entity-status { display: inline-flex; flex: none; align-items: center; gap: 6px; min-height: 30px; padding: 4px 10px; border: 1px solid #ccc; border-radius: 4px; background: #fafaf8; font-size: 12px; line-height: 1.5; white-space: nowrap; }
  .entity-status .status { font-size: inherit; letter-spacing: 0; }
  .entity-status .muted { color: #666; }
  .entity-meta { display: grid; grid-template-columns: 64px minmax(0, 1fr); align-content: start; gap: 8px 12px; margin: 0; font-size: 12px; line-height: 1.7; color: #666; }
  .entity-meta dt, .entity-meta dd { margin: 0; }
  .entity-meta dd { overflow-wrap: anywhere; }
  .sandbox-card { cursor: grab; }
  .sandbox-drag-hint { display: flex; align-items: center; gap: 12px; min-height: 60px; padding: 12px 14px; border: 1px solid #bbb; border-radius: 4px; background: #fafaf8; touch-action: none; cursor: grab; }
  .sandbox-drag-hint:hover { border-color: #111; background: #f3f3ef; }
  .sandbox-drag-hint > div, .agent-drop-heading > div { display: grid; gap: 4px; min-width: 0; }
  .sandbox-drag-hint strong, .agent-drop-hint strong { color: #111; font-size: 12px; font-weight: 600; }
  .sandbox-drag-hint > div > span { color: #777; font-size: 11px; line-height: 1.7; }
  .binding-grip { flex: none; color: #555; font-size: 24px; line-height: 1; }
  .binding-drag-direction { margin-left: auto; color: #111; font-size: 22px; }
  .binding-drag-direction::before { content: '←'; }
  .sandbox-dragging { user-select: none; cursor: grabbing; }
  .sandbox-drag-preview { position: fixed; z-index: 10000; max-width: 280px; padding: 10px 14px; border: 1px solid #111; border-radius: 4px; background: #fff; color: #111; font-size: 12px; pointer-events: none; overflow-wrap: anywhere; box-shadow: 0 4px 16px #0002; }
  .agent-binding-result { grid-column: 1 / -1; margin: 0; padding: 10px 12px; background: #f4f4f1; border-left: 2px solid #111; font-size: 12px; overflow-wrap: anywhere; }
  .agent-binding-result.binding-error { color: #a32626; border-left-color: #a32626; }
  .sandbox-card img { -webkit-user-drag: none; }
  .sandbox-card.drag-source { opacity: .55; }
  .sandbox-drag-hint, .agent-drop-hint { grid-column: 1 / -1; margin: 0; color: #777; font-size: 12px; }
  .agent-drop-hint { display: grid; gap: 12px; min-width: 0; padding: 14px; border: 1px dashed #aaa; border-radius: 4px; background: #fff; }
  .agent-drop-heading { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 10px; min-width: 0; }
  .bound-device-count { margin-left: auto; color: #777; font-size: 11px; white-space: nowrap; }
  .agent-drop-description { margin: 0; color: #777; font-size: 11px; line-height: 1.7; }
  .bound-device-icons { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
  .bound-device-icon { display: grid; justify-items: center; gap: 6px; width: 92px; max-width: 100%; padding: 10px 6px 8px; border: 1px solid #e5e5df; border-radius: 4px; background: #fafaf8; }
  .bound-device-icon img { display: block; width: 36px; height: 36px; object-fit: contain; }
  .bound-device-icon > span { width: 100%; min-width: 0; overflow: hidden; text-overflow: ellipsis; color: #555; font-size: 11px; line-height: 1.5; white-space: nowrap; text-align: center; }
  .bound-device-icon.unavailable > img, .bound-device-icon.unavailable > span { opacity: .55; }
  .bound-device-unbind { width: 100%; min-height: 26px; padding: 3px 6px; border-color: #bbb; background: #fff; font-size: 11px; }
  .bound-device-unbind:hover { border-color: #111; background: #fff; }
  .bound-device-unbind:disabled { cursor: wait; }
  .agent-drop-hint.binding-inactive { border-style: solid; border-color: #ddd; background: #fafaf8; }
  .binding-drop-icon { flex: none; color: #777; font-size: 24px; line-height: 1; }
  .agent-drop-hint .drop-ready-label, .agent-drop-hint .drop-release-label { display: none; }
  .sandbox-dragging [data-agent-drop] { border-color: #999; }
  .sandbox-dragging [data-agent-drop] .agent-drop-hint { border-color: #555; background: #f7f7f3; }
  .sandbox-dragging [data-agent-drop] .drop-idle-label { display: none; }
  .sandbox-dragging [data-agent-drop] .drop-ready-label { display: block; }
  [data-agent-drop].drop-active { outline: 2px solid #111; outline-offset: -2px; background: #f2f2ee; }
  [data-agent-drop].drop-active .agent-drop-hint { border: 1px solid #111; background: #fff; }
  [data-agent-drop].drop-active .drop-idle-label, [data-agent-drop].drop-active .drop-ready-label { display: none; }
  [data-agent-drop].drop-active .drop-release-label { display: block; }
  [data-agent-drop].drop-active .binding-drop-icon { color: #111; }
  .binding-pending { opacity: .65; }
  .binding-action-note { margin: 0 0 14px; font-size: 12px; color: #555; overflow-wrap: anywhere; }
  .binding-action-note:empty { display: none; }
  @media (max-width: 1100px) {
    .device-panels { grid-template-columns: minmax(0, 1fr); }
    .binding-drag-direction::before { content: '↑'; }
    .architecture-flow { grid-template-columns: minmax(0, 1fr); gap: 12px; }
    .architecture-link { flex-direction: row; gap: 16px; min-height: 36px; }
    .architecture-link svg { transform: rotate(90deg); }
    .architecture-host { padding: 20px; }
  }
  .flow-dialog { width: min(560px, calc(100vw - 32px)); padding: 24px; border: 1px solid #d9d9d3; border-radius: 6px; color: #111; }
  #addAgentFlow { width: min(720px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); padding: 0; overflow: hidden; }
  #addAgentFlow[open] { display: flex; flex-direction: column; }
  .agent-dialog-body { min-height: 0; overflow-y: auto; padding: 24px; overscroll-behavior: contain; }
  .agent-prompt-preview { margin-top: 14px; }
  .agent-prompt-preview summary { cursor: pointer; font-size: 12px; color: #666; }
  .agent-prompt-preview .cmd { max-height: 240px; overflow-y: auto; }
  #addAgentFlow .flow-header { flex: none; padding: 22px 24px 0; }
  #addAgentFlow .flow-progress { flex: none; margin: 18px 24px 0; }
  #addAgentFlow .flow-footer { flex: none; margin: 0; padding: 16px 24px; border-top: 1px solid #e5e5e5; background: #fff; }
  #addAgentFlow .flow-footer button { min-width: 100px; }
  .flow-dialog::backdrop { background: rgba(0, 0, 0, .35); }
  .flow-header { display: flex; align-items: center; justify-content: space-between; }
  .flow-header h2 { margin: 0; color: #111; font-size: 16px; font-weight: 600; letter-spacing: 0; text-transform: none; }
  .flow-close { padding: 5px 8px; font-size: 18px; line-height: 1; }
  .provider-options { display: grid; gap: 18px; margin: 22px 0 14px; }
  .provider-field { display: grid; gap: 8px; min-width: 0; }
  .provider-field label { font-size: 12px; font-weight: 600; color: #555; }
  .provider-field select { width: 100%; min-width: 0; min-height: 42px; margin: 0; padding: 9px 12px; font: inherit; border: 1px solid #d0d0ca; border-radius: 4px; background: #fff; color: #111; }
  .flow-progress { display: flex; gap: 6px; margin: 18px 0 22px; padding: 0; list-style: none; counter-reset: flow; font-size: 11px; color: #999; }
  .flow-progress li { flex: 1; padding-top: 8px; border-top: 3px solid #e5e5e0; counter-increment: flow; }
  .flow-progress li::before { content: counter(flow) ". "; }
  .flow-progress li.done { border-top-color: #777; }
  .flow-progress li[aria-current="step"] { border-top-color: #111; color: #111; font-weight: 600; }
  .flow-step { min-height: 150px; margin: 0; }
  .flow-step h3 { margin: 0 0 8px; color: #111; font-size: 14px; font-weight: 600; letter-spacing: 0; text-transform: none; }
  .flow-step p { margin: 10px 0 0; color: #555; font-size: 13px; }
  .flow-step p.note { color: #8a8a8a; font-size: 12px; }
  .flow-step .install-command-row { margin-top: 8px; }
  #addAgentFlow .install-command-row { display: grid; grid-template-columns: minmax(0, 1fr) 100px; align-items: start; }
  #addAgentFlow .install-command-row button { min-height: 40px; padding: 9px 10px; }
  #addAgentFlow .install-command-row .cmd { min-width: 0; }
  .flow-branch { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-top: 18px; padding: 12px 14px; border: 1px dashed #d0d0ca; border-radius: 4px; color: #555; font-size: 12px; }
  .flow-action { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin-top: 16px; font-size: 12px; }
  .flow-footer { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; }
  .card-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin-top: 24px; font-size: 12px; }
  .info-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
  .account-details { display: grid; grid-template-columns: 120px 1fr; gap: 18px; margin: 24px 0 0; font-size: 13px; }
  .account-details dt { color: #888; }
  .account-details dd { margin: 0; overflow-wrap: anywhere; }
  .toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-bottom: 24px; font-size: 12px; }
  .toolbar input { flex: 1; min-width: 160px; max-width: 380px; }
  #historyRows code { overflow-wrap: anywhere; }
  #historyRows .mono { white-space: nowrap; }
  code.clamp, .output-preview { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; max-width: 340px; }
  code.clamp { overflow-wrap: anywhere; }
  .operation-path { margin-top: 6px; }
  .output-preview { margin: 0; color: #555; font: 11px/1.5 ui-monospace, "SF Mono", Menlo, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
  .preview-source { display: inline-block; margin-bottom: 2px; color: #888; font-size: 10px; letter-spacing: .06em; }
  .result-cell, .time-cell { white-space: nowrap; }
  .small-id { font-size: 10px; overflow-wrap: anywhere; }
  .result-badge { display: inline-block; padding: 1px 8px; border: 1px solid #ccc; border-radius: 10px; font-size: 11px; }
  .result-badge.ok { border-color: #111; color: #111; }
  .result-badge.bad { border-color: #a33; color: #8b2424; background: #fff5f5; }
  .result-badge.pending { color: #777; }
  #devicesSection, #readmeSection, #pairSection { margin-bottom: 28px; padding: 24px; border: 1px solid #e1e1db; border-radius: 6px; background: #fff; }
  @media (max-width: 900px) {
    .app-shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto 1fr; }
    .sidebar { padding: 12px 18px; border-right: 0; border-bottom: 1px solid #e2e2dc; }
    .sidebar nav { display: flex; flex-wrap: wrap; gap: 4px; }
    .sidebar nav a { gap: 8px; }
    .nav-label, .sidebar-note { display: none; }
    main.workspace-content { padding: 28px 24px 60px; }
  }
  @media (max-width: 600px) {
    .login-card, #login.login-card { padding: 26px; margin-top: 32px; }
    .app-header { padding: 16px 18px; gap: 12px; flex-wrap: wrap; }
    .app-header .brand-logo { width: 130px; }
    .app-header .meta { margin-left: 0; }
    main.workspace-content { padding: 24px 18px 48px; }
    h1 { font-size: 24px; }
    .page-heading { align-items: flex-start; flex-direction: column; gap: 16px; }
    .summary-grid { gap: 8px; }
    .summary-grid.four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .summary-card { padding: 14px 10px; }
    .summary-card > span { font-size: 11px; }
    .summary-card > strong { font-size: 24px; }
    .panel-card, #devicesSection, #readmeSection, #pairSection { padding: 18px; }
    .info-grid { grid-template-columns: 1fr; gap: 0; }
    .binding-guide { display: grid; gap: 10px; }
    .binding-guide-direction { display: none; }
    .guide-banner { flex-direction: column; align-items: flex-start; }
    .account-details { grid-template-columns: 80px 1fr; gap: 14px; }
    .agent-dialog-body { padding: 20px 18px; }
    #addAgentFlow .flow-header { padding: 18px 18px 0; }
    #addAgentFlow .flow-progress { margin-left: 18px; margin-right: 18px; }
    #addAgentFlow .flow-footer { padding: 14px 18px; }
    #addAgentFlow .install-command-row { grid-template-columns: minmax(0, 1fr) 82px; gap: 8px; }
    .entity-card { grid-template-columns: minmax(0, 1fr); gap: 16px; padding: 16px; }
    .entity-card .row-actions { grid-column: 1; grid-row: auto; display: flex; flex-wrap: wrap; width: auto; gap: 8px; }
    .entity-card .row-actions button { min-width: 72px; }
  }

/* Return to the hosting website, outside the graft.ai route prefix. */
.home-link { display: inline-block; padding: 7px 14px; border: 1px solid #111; border-radius: 4px; background: #111; color: #fff; text-decoration: none; }
.home-link:hover { background: #333; text-decoration: none; }
.login-card > .home-link, #login.login-card > .home-link { margin-top: 0; margin-bottom: 20px; }

  .environment-dialog { width: min(760px, calc(100vw - 32px)); max-height: calc(100dvh - 40px); box-sizing: border-box; overflow-y: auto; padding: 24px; border: 1px solid #d9d9d3; border-radius: 6px; background: #fff; color: #111; }
  .environment-dialog::backdrop { background: rgba(0, 0, 0, .35); }
  .environment-dialog p, .environment-dialog label, .environment-dialog small { font-size: 13px; line-height: 1.6; }
  .environment-dialog form > label { display: block; margin: 14px 0; }
  .environment-dialog .login-input { display: block; width: 100%; box-sizing: border-box; margin: 6px 0; font: inherit; }
  .environment-dialog small { display: block; color: #666; }
  .environment-dialog .environment-check { display: flex; align-items: center; gap: 8px; margin: 14px 0; }
  .environment-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px 18px; }
  .environment-dialog details { padding: 12px 0; border-top: 1px solid #e5e5e5; }
  .environment-dialog summary { cursor: pointer; }
  .environment-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
  .environment-feedback { min-height: 22px; overflow-wrap: anywhere; }
  .environment-memory { border-top: 1px solid #e5e5e5; padding-top: 16px; }
  .environment-memory h3 { margin: 0; }
  .environment-memory pre { max-height: 32vh; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; padding: 14px; border: 1px solid #e5e5e5; background: #fafaf8; font-size: 12px; line-height: 1.6; }
  @media (max-width: 640px) { .environment-grid { grid-template-columns: minmax(0, 1fr); } .environment-dialog { padding: 18px; } }
