:root {
  color-scheme: light;
  --chrome: #eef1f5;
  --sidebar: #eff2f6;
  --surface: #ffffff;
  --surface-soft: #f7f7f8;
  --surface-hover: #e7eaee;
  --text: #202124;
  --text-soft: #60646c;
  --text-faint: #91969f;
  --line: #dfe2e6;
  --line-strong: #cfd3d9;
  --accent: #6258f5;
  --accent-soft: #eeeefe;
  --success: #238862;
  --success-soft: #e7f4ee;
  --warning: #a56613;
  --warning-soft: #fff3dc;
  --danger: #b84a43;
  --shadow-sm: 0 2px 8px rgba(24, 29, 38, 0.06);
  --shadow-md: 0 12px 36px rgba(24, 29, 38, 0.11);
  --shadow-lg: 0 28px 80px rgba(24, 29, 38, 0.18);
  --sidebar-width: 405px;
  --menubar-height: 48px;
  --modebar-height: 70px;
  --z-menubar: 70;
  --z-scrim: 200;
  --z-overlay: 210;
  --z-menu: 300;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  font-family:
    "HarmonyOS Sans SC", "PingFang SC", "Microsoft YaHei UI",
    "Microsoft YaHei", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  height: 100vh;
  height: 100dvh;
  min-height: 100svh;
  min-width: 320px;
  max-width: 100vw;
  padding: var(--safe-top) var(--safe-right) var(--safe-bottom) var(--safe-left);
  color: var(--text);
  background: var(--chrome);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

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

button {
  border: 0;
}

button:not(:disabled) {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
}

[hidden] {
  display: none !important;
}

.svg-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.icon {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.7;
}

.icon-small {
  width: 14px;
  height: 14px;
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.skip-link {
  position: fixed;
  z-index: 999;
  top: 8px;
  left: 12px;
  padding: 9px 14px;
  border-radius: 8px;
  color: #fff;
  background: #17181b;
  transform: translateY(-160%);
  transition: transform 160ms ease;
}

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

:focus-visible {
  outline: 3px solid rgba(68, 93, 230, 0.34);
  outline-offset: 2px;
}

.app-shell {
  display: grid;
  grid-template:
    "menubar menubar" var(--menubar-height)
    "sidebar main" minmax(0, 1fr)
    / var(--sidebar-width) minmax(0, 1fr);
  height: 100%;
  min-height: 0;
}

.app-menubar {
  grid-area: menubar;
  position: relative;
  z-index: var(--z-menubar);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  height: var(--menubar-height);
  padding: 0 12px;
  border-bottom: 1px solid rgba(204, 209, 217, 0.72);
  background: linear-gradient(110deg, #f2f4f7, #eaf0f8);
  user-select: none;
}

.menubar-left,
.menubar-right,
.desktop-menus {
  display: flex;
  align-items: center;
}

.menubar-left {
  min-width: 0;
  gap: 4px;
}

.menubar-right {
  justify-content: flex-end;
  gap: 7px;
}

.menubar-title {
  color: #747982;
  font-size: 12px;
  opacity: 0;
}

.desktop-menus {
  gap: 4px;
  margin-left: 10px;
}

.desktop-menus button {
  padding: 7px 10px;
  border-radius: 7px;
  color: #686d75;
  background: transparent;
  font-size: 14px;
}

.desktop-menus button:hover,
.desktop-menus button[aria-expanded="true"] {
  color: var(--text);
  background: rgba(255, 255, 255, 0.72);
}

.icon-button {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 9px;
  color: #656a72;
  background: transparent;
}

.icon-button:not(:disabled):hover {
  color: var(--text);
  background: rgba(130, 137, 148, 0.13);
}

.icon-button:disabled {
  opacity: 0.34;
}

.menubar-connection {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: 230px;
  color: #6c7179;
  font-size: 12px;
}

.state-dot {
  display: inline-block;
  flex: 0 0 auto;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #9da2aa;
}

#app[data-state="online"] .state-dot {
  background: var(--success);
  box-shadow: 0 0 0 3px rgba(35, 136, 98, 0.12);
}

#app[data-state="error"] .state-dot {
  background: var(--danger);
  box-shadow: 0 0 0 3px rgba(184, 74, 67, 0.12);
}

#app[data-state="degraded"] .state-dot {
  background: #c68a2e;
  box-shadow: 0 0 0 3px rgba(198, 138, 46, 0.12);
}

.sidebar {
  grid-area: sidebar;
  position: relative;
  z-index: 40;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  padding: 15px 12px 10px;
  background: var(--sidebar);
  transition:
    transform 180ms ease,
    opacity 180ms ease;
}

.sidebar-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 2px 2px 14px;
}

.brand-button {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 8px;
  padding: 6px;
  border-radius: 9px;
  background: transparent;
  font-size: 17px;
  font-weight: 690;
  letter-spacing: -0.02em;
}

.brand-button:hover {
  background: var(--surface-hover);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 27px;
  height: 27px;
  border-radius: 8px;
  color: #fff;
  background: linear-gradient(145deg, #343bff, #8a64ff);
  box-shadow: 0 5px 13px rgba(82, 74, 229, 0.24);
  font-size: 13px;
  font-weight: 800;
}

.sidebar-actions {
  display: flex;
}

.primary-nav {
  display: grid;
  gap: 2px;
}

.sidebar-nav-item {
  display: grid;
  grid-template-columns: 23px minmax(0, 1fr) auto;
  align-items: center;
  width: 100%;
  min-height: 38px;
  gap: 9px;
  padding: 7px 9px;
  border-radius: 8px;
  color: #4d5259;
  background: transparent;
  text-align: left;
}

.sidebar-nav-item:hover {
  color: var(--text);
  background: #e7eaee;
}

.sidebar-nav-item.is-active {
  color: var(--text);
  background: #e1e5ea;
  font-weight: 620;
}

.entry-state {
  color: var(--text-faint);
  font-size: 10px;
  font-weight: 500;
}

.thread-scroll {
  min-height: 108px;
  margin: 22px 0 10px;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-color: #c7cbd1 transparent;
  scrollbar-width: thin;
}

.thread-section + .thread-section {
  margin-top: 22px;
}

.thread-section h2 {
  margin: 0 8px 8px;
  color: #92969e;
  font-size: 11px;
  font-weight: 620;
}

.thread-summary {
  display: grid;
  width: 100%;
  gap: 3px;
  padding: 8px 9px;
  border-radius: 8px;
  background: transparent;
  text-align: left;
}

.thread-summary:hover,
.thread-placeholders button:hover {
  background: #e6e9ed;
}

.thread-summary-title {
  overflow: hidden;
  color: #3f444b;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.thread-summary-meta,
.thread-summary-note {
  color: var(--text-faint);
  font-size: 10px;
}

.thread-placeholders {
  display: grid;
  gap: 1px;
}

.thread-placeholders button {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 8px 9px;
  border-radius: 8px;
  color: #555a61;
  background: transparent;
  font-size: 12px;
  text-align: left;
}

.thread-placeholders button span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.thread-placeholders button span:last-child {
  flex: 0 0 auto;
  color: #9a9ea5;
  font-size: 10px;
}

.mapping-card {
  flex: 0 0 auto;
  padding: 14px;
  border: 1px solid #dde0e5;
  border-radius: 17px;
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--shadow-sm);
}

.mapping-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.mapping-heading h2 {
  margin: 0;
  font-size: 13px;
}

.mapping-heading span {
  color: var(--text-faint);
  font-size: 11px;
}

.mapping-progress {
  height: 5px;
  margin: 11px 0 10px;
  overflow: hidden;
  border-radius: 99px;
  background: #e3e5e8;
}

.mapping-progress span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #4e61ea, #7a64f4);
  transition: width 300ms ease;
}

.mapping-card button {
  display: grid;
  grid-template-columns: 18px 1fr;
  align-items: center;
  width: 100%;
  min-height: 30px;
  gap: 7px;
  padding: 5px 0;
  color: #555a61;
  background: transparent;
  font-size: 11px;
  text-align: left;
}

.mapping-card button:hover {
  color: var(--text);
}

.mapping-check {
  width: 15px;
  height: 15px;
  border: 1.5px solid #adb1b8;
  border-radius: 50%;
}

.account-button {
  display: grid;
  grid-template-columns: 29px minmax(0, 1fr) 22px;
  align-items: center;
  gap: 9px;
  width: calc(100% + 8px);
  min-height: 48px;
  margin: 8px -4px -2px;
  padding: 7px 8px;
  border-radius: 11px;
  background: transparent;
  text-align: left;
}

.account-button:hover {
  background: #e4e7eb;
}

.account-avatar {
  display: grid;
  place-items: center;
  width: 29px;
  height: 29px;
  border-radius: 50%;
  color: #fff;
  background: linear-gradient(145deg, #ff9b2f, #e8751d);
  font-size: 11px;
  font-weight: 700;
}

.account-avatar.is-large {
  width: 52px;
  height: 52px;
  font-size: 17px;
}

.account-copy {
  display: grid;
  min-width: 0;
  gap: 1px;
}

.account-copy strong,
.account-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-copy strong {
  font-size: 12px;
}

.account-copy small {
  color: var(--text-faint);
  font-size: 9px;
}

.main-frame {
  grid-area: main;
  position: relative;
  z-index: 10;
  display: grid;
  grid-template-rows: var(--modebar-height) minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
  border-top-left-radius: 18px;
  background: var(--surface);
  box-shadow: -2px -2px 14px rgba(39, 45, 55, 0.035);
}

.modebar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  min-height: var(--modebar-height);
  padding: 0 16px;
  border-bottom: 1px solid #dadddf;
  background: rgba(255, 255, 255, 0.94);
}

.mode-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  width: 250px;
  padding: 2px;
  border-radius: 999px;
  background: #f3f3f4;
}

.mode-switch button {
  min-height: 40px;
  padding: 0 24px;
  border: 1px solid transparent;
  border-radius: 999px;
  color: #777b82;
  background: transparent;
  font-size: 13px;
}

.mode-switch button.is-active {
  color: var(--text);
  border-color: #e3e3e4;
  background: #fff;
  box-shadow: 0 2px 6px rgba(34, 37, 43, 0.06);
  font-weight: 650;
}

.modebar-actions {
  display: flex;
  justify-content: flex-end;
}

.view-stack {
  position: relative;
  max-width: 100%;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.workspace-view {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  height: 100%;
  overflow-y: auto;
}

.home-stage {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 500px;
  min-width: 0;
  padding: 14px clamp(22px, 3vw, 44px) 18px;
  overflow: auto;
}

.connection-banner {
  position: absolute;
  top: 14px;
  left: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 999px;
  color: #6e727a;
  background: #f7f7f8;
  font-size: 10px;
  line-height: 1.4;
  text-align: center;
  transform: translateX(-50%);
}

.connection-banner button {
  padding: 2px 5px;
  color: #5862c7;
  background: transparent;
  font-size: inherit;
}

.route-connectivity-banner {
  position: absolute;
  z-index: 24;
  top: calc(var(--modebar-height) + 8px);
  right: max(12px, var(--safe-right));
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  max-width: min(680px, calc(100% - 24px));
  min-height: 30px;
  gap: 7px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text-soft);
  background: rgba(250, 250, 251, 0.96);
  box-shadow: 0 5px 18px rgba(24, 29, 38, 0.07);
  font-size: 10px;
  line-height: 1.35;
}

.route-connectivity-banner[data-state="degraded"] {
  border-color: #e4cfaa;
  background: rgba(255, 248, 232, 0.97);
}

.route-connectivity-banner[data-state="error"] {
  border-color: #e4c0be;
  background: rgba(255, 241, 240, 0.97);
}

.route-connectivity-boundary {
  color: var(--text-faint);
}

body.settings-active .route-connectivity-banner {
  top: 8px;
}

.home-center {
  position: absolute;
  top: 42.5%;
  left: 50%;
  width: min(946px, calc(100% - 80px));
  max-width: 100%;
  min-width: 0;
  margin: 0;
  transform: translate(-50%, -20%);
}

.home-kicker {
  margin: 0 0 9px;
  color: #a0a3a9;
  font-size: 10px;
  text-align: center;
}

.home-center h1 {
  margin: 0 0 38px;
  font-size: clamp(30px, 3.1vw, 43px);
  font-weight: 520;
  letter-spacing: -0.045em;
  text-align: center;
  text-wrap: balance;
  overflow-wrap: anywhere;
}

.composer-shell {
  position: relative;
  min-width: 0;
  overflow: hidden;
  border: 1px solid #e0e1e4;
  border-radius: 24px;
  background: #fff;
  box-shadow: 0 8px 28px rgba(30, 34, 42, 0.08);
}

.composer-shell textarea {
  display: block;
  width: 100%;
  min-height: 96px;
  padding: 22px 20px 10px;
  resize: none;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 14px;
  line-height: 1.55;
}

.composer-shell textarea::placeholder {
  color: #b6b8bd;
}

.composer-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 55px;
  gap: 12px;
  padding: 4px 10px 9px;
}

.composer-left,
.composer-right {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 4px;
}

.composer-add {
  color: #3a3e44;
}

.text-control,
.model-control {
  display: flex;
  align-items: center;
  min-height: 34px;
  gap: 6px;
  padding: 5px 9px;
  border-radius: 9px;
  color: #797d84;
  background: transparent;
  font-size: 12px;
}

.text-control:hover,
.model-control:hover {
  color: var(--text);
  background: #f4f4f5;
}

.model-control {
  color: #4c5057;
}

.model-control .icon:first-child {
  width: 15px;
  color: #181a1e;
}

.voice-button {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 50%;
  color: #fff;
  background: #17191d;
}

.voice-button:hover {
  background: #32353b;
}

.composer-boundary {
  position: absolute;
  top: calc(100% + 58px);
  left: 0;
  right: 0;
  margin: 0;
  color: #a0a3a9;
  font-size: 9px;
  text-align: center;
}

.composer-subbar {
  display: flex;
  align-items: center;
  min-height: 54px;
  margin: 0 20px;
  padding: 0 10px;
  border-radius: 0 0 18px 18px;
  background: #f5f5f5;
}

.composer-subbar button {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  gap: 7px;
  padding: 6px 10px;
  border-radius: 9px;
  color: #53575e;
  background: transparent;
  font-size: 12px;
}

.composer-subbar button:hover {
  background: #e9e9ea;
}

.composer-subbar .subbar-device {
  margin-left: auto;
  color: #8c9096;
}

.plugin-glyph {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 6px;
  color: #fff;
  background: linear-gradient(135deg, #52c4ff, #8169ff 55%, #f683c2);
}

.suggestion-list {
  display: grid;
  width: min(620px, 90%);
  gap: 4px;
  margin: 40px auto 0;
}

.suggestion-list button {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px;
  min-height: 42px;
  padding: 7px 10px;
  border-radius: 10px;
  color: #858991;
  background: transparent;
  text-align: left;
}

.suggestion-list button:hover {
  color: #53575e;
  background: #f7f7f8;
}

.suggestion-list small {
  color: #b0b3b8;
  font-size: 9px;
}

.suggestion-icon {
  color: #8c9097;
  font-size: 18px;
}

.voice-promo {
  position: absolute;
  right: 50%;
  bottom: 18px;
  display: grid;
  grid-template-columns: 50px minmax(0, 1fr) auto;
  align-items: center;
  width: min(946px, calc(100% - 80px));
  max-width: 100%;
  min-width: 0;
  min-height: 72px;
  gap: 12px;
  padding: 10px 18px;
  border: 1px solid #e5e5e7;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 2px 8px rgba(26, 29, 35, 0.03);
  text-align: left;
  transform: translateX(50%);
}

.voice-promo:hover {
  border-color: #d9dae0;
  background: #fcfcfd;
}

.voice-orb {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 68% 28%, rgba(255, 255, 255, 0.85), transparent 23%),
    radial-gradient(circle at 30% 72%, #a9e4ff, transparent 38%),
    linear-gradient(145deg, #6b6fff, #c689ff);
  box-shadow: inset 0 0 18px rgba(255, 255, 255, 0.5);
}

.voice-promo > span:nth-child(2) {
  display: grid;
  gap: 3px;
}

.voice-promo strong {
  font-size: 13px;
}

.voice-promo small {
  color: var(--text-soft);
  font-size: 11px;
}

.promo-action {
  padding: 9px 16px;
  border-radius: 999px;
  color: #fff;
  background: #202226;
  font-size: 11px;
}

.list-view {
  padding: clamp(30px, 6vw, 78px);
}

.view-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  max-width: 1040px;
  margin: 0 auto 26px;
  gap: 28px;
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--text-faint);
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.view-header h1 {
  margin: 0;
  font-size: 34px;
  font-weight: 590;
  letter-spacing: -0.04em;
}

.view-header p:not(.eyebrow) {
  max-width: 610px;
  margin: 9px 0 0;
  color: var(--text-soft);
  font-size: 13px;
  line-height: 1.65;
}

.primary-button,
.secondary-button,
.empty-state > button {
  min-height: 38px;
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 620;
}

.primary-button {
  color: #fff;
  background: #222429;
}

.primary-button:hover {
  background: #3a3d43;
}

.secondary-button,
.empty-state > button {
  color: #44484f;
  background: #eeeef0;
}

.secondary-button:hover,
.empty-state > button:hover {
  background: #e4e4e7;
}

.view-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1040px;
  gap: 16px;
  margin: 0 auto 18px;
}

.inline-search {
  display: flex;
  align-items: center;
  width: min(420px, 100%);
  min-height: 40px;
  gap: 8px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fafafa;
}

.inline-search input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
}

.boundary-chip,
.connection-pill,
.status-badge {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  min-height: 26px;
  gap: 7px;
  padding: 4px 9px;
  border-radius: 999px;
  color: #666b73;
  background: #f0f1f3;
  font-size: 10px;
}

.empty-state {
  display: grid;
  place-items: center;
  max-width: 1040px;
  min-height: 360px;
  margin: 0 auto;
  padding: 52px 24px;
  border: 1px dashed #d9dce1;
  border-radius: 20px;
  background: #fafafb;
  text-align: center;
}

.empty-state.is-compact {
  min-height: 250px;
  border: 0;
  background: transparent;
}

.empty-icon,
.node-device-icon {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: 16px;
  color: #6a6f77;
  background: #eceef1;
}

.empty-state h2,
.empty-state h3 {
  margin: 16px 0 0;
  font-size: 18px;
}

.empty-state p {
  max-width: 520px;
  margin: 9px auto 18px;
  color: var(--text-soft);
  font-size: 12px;
  line-height: 1.7;
}

.node-detail-card {
  max-width: 1040px;
  margin: 0 auto;
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
  box-shadow: var(--shadow-sm);
}

.node-detail-heading {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) auto;
  align-items: center;
  gap: 15px;
}

.node-detail-heading h2 {
  margin: 0;
  font-size: 18px;
}

.node-detail-heading p {
  margin: 4px 0 0;
  color: var(--text-soft);
  font-size: 11px;
}

.status-badge {
  color: var(--success);
  background: var(--success-soft);
}

.status-badge.is-pending {
  color: var(--warning);
  background: var(--warning-soft);
}

.fact-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin: 24px 0 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}

.fact-grid div {
  min-width: 0;
  padding: 15px;
  border-right: 1px solid var(--line);
}

.fact-grid div:last-child {
  border-right: 0;
}

.fact-grid dt {
  margin-bottom: 5px;
  color: var(--text-faint);
  font-size: 10px;
}

.fact-grid dd {
  overflow: hidden;
  margin: 0;
  font-size: 13px;
  font-weight: 620;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.node-boundary,
.drawer-notice,
.search-boundary {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 18px;
  padding: 12px;
  border-radius: 12px;
  color: #3f6255;
  background: var(--success-soft);
}

.node-boundary .icon,
.drawer-notice .icon,
.search-boundary .icon {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
}

.node-boundary p,
.drawer-notice p,
.search-boundary p {
  margin: 0;
  font-size: 11px;
  line-height: 1.6;
}

.extension-grid {
  display: grid;
  max-width: 1040px;
  gap: 10px;
  margin: 0 auto;
}

.extension-grid > button {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 13px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  text-align: left;
}

.extension-grid > button:hover {
  background: #fafafb;
}

.extension-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  color: #fff;
  background: linear-gradient(145deg, #555de9, #8869ec);
  font-weight: 750;
}

.extension-grid > button > span:nth-child(2) {
  display: grid;
  gap: 4px;
}

.extension-grid small {
  color: var(--text-soft);
}

body.settings-active .main-frame {
  grid-template-rows: minmax(0, 1fr);
}

body.settings-active .modebar {
  display: none;
}

.settings-view {
  overflow: hidden;
}

.settings-shell {
  display: grid;
  grid-template-columns: 292px minmax(0, 1fr);
  width: 100%;
  height: 100%;
  min-height: 0;
  background: #fff;
}

.settings-navigation {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  padding: 16px 9px 24px;
  border-right: 1px solid var(--line);
  background: linear-gradient(160deg, #f4f5ed, #eff6df);
}

.settings-back {
  display: inline-flex;
  align-items: center;
  align-self: flex-start;
  min-height: 38px;
  gap: 7px;
  padding: 6px 9px;
  border-radius: 9px;
  color: #777b72;
  background: transparent;
  font-size: 12px;
}

.settings-back:hover,
.settings-nav-group button:hover {
  color: var(--text);
  background: rgba(219, 223, 210, 0.64);
}

.settings-search {
  display: flex;
  align-items: center;
  min-height: 38px;
  gap: 7px;
  margin: 8px 0 13px;
  padding: 0 10px;
  border: 1px solid #dfe2d8;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
}

.settings-search .icon {
  width: 16px;
  height: 16px;
  color: #8b8f87;
}

.settings-search input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 11px;
}

#settings-nav-list {
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-color: #c7cbbd transparent;
  scrollbar-width: thin;
}

.settings-nav-group + .settings-nav-group {
  margin-top: 17px;
}

.settings-nav-group h2 {
  margin: 0 8px 5px;
  color: #8c9186;
  font-size: 10px;
  font-weight: 600;
}

.settings-nav-group button {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  align-items: center;
  width: 100%;
  min-height: 31px;
  gap: 7px;
  padding: 5px 8px;
  border-radius: 8px;
  color: #4f544c;
  background: transparent;
  font-size: 11px;
  text-align: left;
}

.settings-nav-group button .icon {
  width: 15px;
  height: 15px;
}

.settings-nav-group button.is-active {
  color: var(--text);
  background: rgba(218, 221, 209, 0.82);
  font-weight: 650;
}

.settings-no-results {
  margin: 14px 8px;
  color: var(--text-faint);
  font-size: 11px;
}

.settings-content {
  min-width: 0;
  min-height: 0;
  padding: clamp(46px, 7vh, 86px) clamp(34px, 7vw, 108px) 80px;
  overflow-y: auto;
  scroll-behavior: smooth;
}

.settings-page {
  width: min(850px, 100%);
  margin: 0 auto;
}

.settings-page-header {
  margin-bottom: 38px;
}

.settings-page-header h1 {
  margin: 0;
  font-size: clamp(27px, 3vw, 35px);
  font-weight: 590;
  letter-spacing: -0.04em;
}

.settings-page-header p:not(.eyebrow) {
  max-width: 680px;
  margin: 8px 0 0;
  color: var(--text-soft);
  font-size: 12px;
  line-height: 1.65;
}

.settings-card,
.settings-profile-card,
.usage-plan-card,
.quota-bucket {
  border: 1px solid #e2e4e6;
  border-radius: 15px;
  background: #fff;
}

.settings-card {
  overflow: hidden;
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 68px;
  gap: 22px;
  padding: 14px 17px;
  border-bottom: 1px solid #eceef0;
}

.settings-row:last-child {
  border-bottom: 0;
}

.settings-row > span:first-child,
.usage-plan-card > span:first-child,
.quota-bucket > div:first-child {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.settings-row strong,
.usage-plan-card strong,
.quota-bucket strong {
  font-size: 12px;
  font-weight: 650;
}

.settings-row small,
.usage-plan-card small,
.quota-bucket small,
.settings-profile-card small {
  color: var(--text-faint);
  font-size: 10px;
  line-height: 1.5;
}

.settings-value {
  flex: 0 1 auto;
  max-width: 52%;
  color: #777b82;
  font-size: 10px;
  text-align: right;
  overflow-wrap: anywhere;
}

.settings-value.is-safe {
  color: var(--success);
}

.settings-boundary {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 18px;
  padding: 13px 14px;
  border-radius: 12px;
  color: #3f6255;
  background: var(--success-soft);
}

.settings-boundary.is-pending {
  color: #6e531f;
  background: var(--warning-soft);
}

.settings-boundary .icon {
  flex: 0 0 auto;
  width: 17px;
  height: 17px;
}

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

.settings-profile-card {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
  padding: 18px;
}

.settings-profile-card > div {
  display: grid;
  gap: 4px;
}

.settings-unverified {
  display: grid;
  place-items: center;
  min-height: 310px;
  padding: 42px 24px;
  border: 1px dashed #d8dbe0;
  border-radius: 18px;
  background: #fafafb;
  text-align: center;
}

.settings-unverified > .icon {
  width: 32px;
  height: 32px;
  color: #7d828a;
}

.settings-unverified h2 {
  margin: 16px 0 0;
  font-size: 17px;
}

.settings-unverified p {
  max-width: 520px;
  margin: 8px 0 17px;
  color: var(--text-soft);
  font-size: 11px;
  line-height: 1.65;
}

.settings-unverified span {
  padding: 5px 9px;
  border-radius: 999px;
  color: var(--warning);
  background: var(--warning-soft);
  font-size: 9px;
}

.shortcut-list kbd {
  flex: 0 0 auto;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 7px;
  color: #686c73;
  background: #f7f7f8;
  font: inherit;
  font-size: 9px;
}

.usage-section + .usage-section {
  margin-top: 36px;
}

.usage-section h2 {
  margin: 0 0 12px;
  font-size: 13px;
  font-weight: 670;
}

.usage-plan-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 67px;
  gap: 22px;
  padding: 14px 17px;
}

.quota-bucket {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(110px, 180px) 72px;
  align-items: center;
  min-height: 68px;
  gap: 18px;
  padding: 14px 17px;
}

.quota-bucket + .quota-bucket {
  margin-top: 10px;
}

.quota-meter {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #e5e7e9;
}

.quota-meter span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: #1f2227;
  transition: width 260ms ease;
}

.quota-bucket > span:last-child {
  color: #72767d;
  font-size: 10px;
  text-align: right;
}

.usage-sampled {
  margin: 10px 3px 0;
  color: var(--text-faint);
  font-size: 9px;
  text-align: right;
}

.inspector-drawer {
  position: fixed;
  z-index: var(--z-overlay);
  top: calc(var(--safe-top) + var(--menubar-height));
  right: var(--safe-right);
  bottom: var(--safe-bottom);
  width: min(390px, calc(100vw - 24px));
  padding: 20px;
  border-left: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.97);
  box-shadow: -18px 0 50px rgba(24, 29, 38, 0.13);
  overflow-y: auto;
  transform: translateX(104%);
  transition: transform 190ms ease;
}

.inspector-drawer.is-open {
  transform: translateX(0);
}

.drawer-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.drawer-header h2 {
  margin: 0;
  font-size: 21px;
  letter-spacing: -0.03em;
}

.drawer-status {
  display: grid;
  grid-template-columns: 10px 1fr;
  align-items: center;
  gap: 8px;
  margin: 18px 0;
  padding: 13px;
  border-radius: 12px;
  background: #f5f6f7;
  font-size: 12px;
}

.drawer-status small {
  grid-column: 2;
  color: var(--text-faint);
}

.drawer-facts {
  margin: 0;
}

.drawer-facts div {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 12px 0;
  border-bottom: 1px solid #eceef0;
  font-size: 11px;
}

.drawer-facts dt {
  color: var(--text-soft);
}

.drawer-facts dd {
  margin: 0;
  text-align: right;
}

.safe-value {
  color: var(--success);
}

.capability-section {
  margin-top: 26px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.section-heading h3 {
  margin: 0;
  font-size: 13px;
}

.section-heading span {
  color: var(--text-faint);
  font-size: 10px;
}

.capability-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.capability-list li {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  align-items: center;
  min-height: 57px;
  gap: 9px;
  border-bottom: 1px solid #eceef0;
}

.capability-list li > span:nth-child(2) {
  display: grid;
  gap: 3px;
}

.capability-list strong {
  font-size: 11px;
}

.capability-list small,
.capability-state {
  color: var(--text-faint);
  font-size: 9px;
}

.capability-icon {
  display: grid;
  place-items: center;
  width: 25px;
  height: 25px;
  border-radius: 50%;
  color: var(--warning);
  background: var(--warning-soft);
}

.capability-icon .icon {
  width: 13px;
  height: 13px;
}

.capability-list li[data-status^="verified"] .capability-icon {
  color: var(--success);
  background: var(--success-soft);
}

.capability-list li[data-status^="verified"] .capability-state {
  color: var(--success);
}

.drawer-notice {
  color: #56517a;
  background: #f0eefb;
}

.account-hero {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 22px 0;
}

.account-hero h3 {
  margin: 0;
  font-size: 16px;
}

.account-hero p {
  margin: 4px 0 0;
  color: var(--text-soft);
  font-size: 11px;
}

.drawer-action {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  align-items: center;
  width: 100%;
  gap: 9px;
  margin-top: 18px;
  padding: 12px;
  border-radius: 12px;
  background: #f5f5f6;
  text-align: left;
}

.drawer-action:hover {
  background: #eceef0;
}

.drawer-action span {
  display: grid;
  gap: 3px;
}

.drawer-action strong {
  font-size: 11px;
}

.drawer-action small {
  color: var(--text-soft);
  font-size: 9px;
}

.drawer-scrim,
.sidebar-scrim {
  position: fixed;
  z-index: var(--z-scrim);
  inset: calc(var(--safe-top) + var(--menubar-height)) var(--safe-right) var(--safe-bottom) var(--safe-left);
  background: rgba(23, 27, 34, 0.18);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
}

.drawer-scrim.is-open {
  opacity: 1;
  pointer-events: auto;
}

.app-menu {
  position: fixed;
  z-index: var(--z-menu);
  min-width: 220px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: var(--shadow-md);
}

.app-menu button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 34px;
  gap: 20px;
  padding: 7px 10px;
  border-radius: 7px;
  background: transparent;
  font-size: 11px;
  text-align: left;
}

.app-menu button:hover {
  background: #eff0f2;
}

.app-menu button:disabled {
  color: #a2a5aa;
}

.app-menu kbd {
  color: #9a9da3;
  font: inherit;
  font-size: 9px;
}

.app-menu hr {
  height: 1px;
  margin: 5px 4px;
  border: 0;
  background: var(--line);
}

.account-popover-scrim {
  position: fixed;
  z-index: calc(var(--z-menu) - 1);
  inset: 0;
  background: transparent;
}

.account-popover {
  position: fixed;
  z-index: var(--z-menu);
  width: min(382px, calc(100vw - 24px));
  max-height: calc(100dvh - var(--safe-top) - var(--safe-bottom) - 24px);
  padding: 9px;
  border: 1px solid #dadddf;
  border-radius: 21px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: var(--shadow-lg);
  overflow-y: auto;
}

.account-popover-header {
  display: grid;
  grid-template-columns: 31px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  padding: 5px 10px 12px;
  border-bottom: 1px solid #e2e4e6;
}

.account-popover-header > span:last-child {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.account-popover-header strong,
.account-popover-header small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-popover-header strong {
  font-size: 13px;
}

.account-popover-header small {
  color: var(--text-faint);
  font-size: 9px;
}

.account-popover-items {
  padding: 6px 0 2px;
}

.account-popover-items button {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  align-items: center;
  width: 100%;
  min-height: 43px;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 10px;
  background: transparent;
  font-size: 13px;
  text-align: left;
}

.account-popover-items button:hover,
.account-popover-items button:focus-visible {
  background: #efeff0;
}

.account-popover-items button > .icon:first-child {
  width: 20px;
  height: 20px;
  color: #52575e;
}

.account-popover-items small,
.account-popover-items kbd,
.account-chevron {
  color: #92969c;
  font: inherit;
  font-size: 9px;
}

.account-chevron {
  width: 17px;
  height: 17px;
}

.account-popover-items hr {
  height: 1px;
  margin: 4px 6px;
  border: 0;
  background: #e2e4e6;
}

.account-popover-note {
  margin: 5px 8px 2px;
  color: var(--text-faint);
  font-size: 8px;
  line-height: 1.5;
}

.modal {
  z-index: 400;
  width: min(500px, calc(100vw - 28px));
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 18px;
  color: var(--text);
  background: #fff;
  box-shadow: var(--shadow-lg);
}

.modal::backdrop {
  background: rgba(24, 28, 35, 0.26);
  backdrop-filter: blur(3px);
}

.modal form {
  margin: 0;
  padding: 22px;
}

.modal header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.modal-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  color: #565ee1;
  background: var(--accent-soft);
}

.modal h2 {
  margin: 16px 0 0;
  font-size: 22px;
  letter-spacing: -0.03em;
}

.modal > form > p {
  margin: 10px 0 0;
  color: var(--text-soft);
  font-size: 12px;
  line-height: 1.7;
}

.feature-boundary {
  margin-top: 18px;
  padding: 12px;
  border-radius: 11px;
  color: #6e531f;
  background: var(--warning-soft);
  font-size: 11px;
  line-height: 1.6;
}

.modal menu {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin: 22px 0 0;
  padding: 0;
}

.search-modal {
  align-self: start;
  width: min(680px, calc(100vw - 28px));
  margin-top: min(16vh, 150px);
}

.search-modal h2 {
  margin: 0;
}

.modal-search {
  display: flex;
  align-items: center;
  min-height: 48px;
  gap: 9px;
  margin-top: 20px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
}

.modal-search input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
}

.modal-search kbd {
  padding: 3px 5px;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--text-faint);
  background: #f5f5f6;
  font: inherit;
  font-size: 9px;
}

.search-boundary {
  color: #56517a;
  background: #f2f0fb;
}

body.sidebar-collapsed .app-shell {
  grid-template-columns: 0 minmax(0, 1fr);
}

body.sidebar-collapsed .sidebar {
  opacity: 0;
  pointer-events: none;
  transform: translateX(-100%);
}

@media (max-height: 760px) and (min-width: 761px) {
  .mapping-card {
    display: none;
  }

  .home-center {
    margin-top: 6px;
  }

  .home-center h1 {
    margin-bottom: 24px;
  }

  .suggestion-list {
    margin-top: 24px;
  }
}

@media (min-width: 1280px) and (max-width: 1439px) {
  :root {
    --sidebar-width: 340px;
  }
}

@media (min-width: 981px) and (max-width: 1279px) {
  :root {
    --sidebar-width: 300px;
  }
}

@media (max-width: 980px) {
  :root {
    --sidebar-width: 270px;
  }

  .home-stage {
    padding-inline: 26px;
  }

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

  .fact-grid div:nth-child(2) {
    border-right: 0;
  }

  .fact-grid div:nth-child(-n + 2) {
    border-bottom: 1px solid var(--line);
  }
}

@media (max-width: 860px) {
  :root {
    --menubar-height: 46px;
  }

  .icon-button,
  .sidebar-nav-item,
  .thread-summary,
  .thread-placeholders button,
  .mapping-card button,
  .account-button,
  .text-control,
  .model-control,
  .composer-subbar button,
  .suggestion-list button,
  .view-header button,
  .empty-state button,
  .extension-grid > button,
  .drawer-action,
  .primary-button,
  .secondary-button,
  .app-menu button,
  .account-popover-items button,
  .modal menu button {
    min-height: 44px;
  }

  .icon-button {
    width: 44px;
    height: 44px;
  }

  .app-shell {
    grid-template:
      "menubar" var(--menubar-height)
      "main" minmax(0, 1fr)
      / minmax(0, 1fr);
  }

  .app-menubar {
    grid-template-columns: 1fr auto;
    padding-inline: 8px;
  }

  .menubar-title,
  .history-button,
  .desktop-menus,
  .menubar-connection {
    display: none;
  }

  .menu-sidebar-toggle {
    display: inline-grid;
  }

  .sidebar {
    position: fixed;
    z-index: var(--z-overlay);
    top: calc(var(--safe-top) + var(--menubar-height));
    left: var(--safe-left);
    bottom: var(--safe-bottom);
    width: min(312px, calc(100vw - 46px));
    box-shadow: 14px 0 46px rgba(25, 30, 38, 0.18);
    transform: translateX(-104%);
    opacity: 1;
  }

  body.mobile-sidebar-open .sidebar {
    transform: translateX(0);
  }

  .sidebar-scrim {
    z-index: var(--z-scrim);
  }

  body.mobile-sidebar-open .sidebar-scrim {
    opacity: 1;
    pointer-events: auto;
  }

  body.sidebar-collapsed .app-shell {
    grid-template-columns: minmax(0, 1fr);
  }

  body.sidebar-collapsed .sidebar {
    opacity: 1;
    pointer-events: auto;
  }

  .main-frame {
    grid-area: main;
    grid-template-rows: 52px minmax(0, 1fr);
    border-left: 0;
    border-top-left-radius: 0;
    max-width: 100vw;
  }

  .modebar {
    min-height: 52px;
    padding-inline: 8px;
  }

  .mode-switch {
    width: 190px;
  }

  .mode-switch button {
    min-height: 36px;
    padding-inline: 16px;
  }

  .home-stage {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto minmax(0, 1fr) auto;
    height: auto;
    min-height: 100%;
    padding: 10px 14px 14px;
    overflow-x: clip;
  }

  .connection-banner {
    position: static;
    max-width: 100%;
    border-radius: 16px;
    transform: none;
  }

  .capability-legend {
    position: static;
    width: 100%;
    padding-top: 2px;
    transform: none;
  }

  .route-connectivity-banner {
    top: 60px;
    right: max(8px, var(--safe-right));
    max-width: calc(100% - 16px - var(--safe-left) - var(--safe-right));
    border-radius: 14px;
  }

  .home-center {
    position: static;
    justify-self: start;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    margin: 10px 0 12px;
    transform: none;
  }

  .home-kicker {
    display: none;
  }

  .home-center h1 {
    margin-bottom: 24px;
    max-width: 100%;
    font-size: clamp(25px, 7.4vw, 34px);
    line-height: 1.16;
    overflow-wrap: anywhere;
  }

  .composer-shell {
    border-radius: 20px;
  }

  .composer-shell textarea {
    min-height: 88px;
    padding: 18px 16px 8px;
  }

  .text-control span,
  .model-control span {
    display: none;
  }

  .composer-controls {
    max-width: 100%;
    overflow: hidden;
    padding-inline: 7px;
  }

  .composer-left,
  .composer-right {
    flex: 0 1 auto;
    min-width: 0;
  }

  .composer-right {
    justify-content: flex-end;
  }

  .text-control,
  .model-control {
    min-width: 44px;
    justify-content: center;
    padding-inline: 8px;
  }

  .composer-subbar {
    margin-inline: 10px;
  }

  .composer-boundary {
    top: calc(100% + 56px);
  }

  .suggestion-list {
    width: 100%;
    margin-top: 34px;
  }

  .suggestion-list small {
    display: none;
  }

  .suggestion-list button {
    grid-template-columns: 24px 1fr;
  }

  .voice-promo {
    position: static;
    justify-self: stretch;
    width: auto;
    max-width: none;
    min-height: 64px;
    padding-inline: 12px;
    transform: none;
  }

  .voice-orb {
    width: 40px;
    height: 40px;
  }

  .promo-action {
    padding-inline: 11px;
  }

  .list-view {
    padding: 28px 18px;
    max-width: 100%;
  }

  .view-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 14px;
  }

  .view-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .boundary-chip {
    align-self: flex-start;
  }

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

  .fact-grid div {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .fact-grid div:last-child {
    border-bottom: 0;
  }

  .node-detail-heading {
    grid-template-columns: 46px minmax(0, 1fr);
  }

  .node-detail-heading .status-badge {
    grid-column: 1 / -1;
    justify-self: start;
  }

  .node-device-icon {
    width: 46px;
    height: 46px;
  }

  .drawer-scrim {
    inset-top: var(--menubar-height);
  }

  .inspector-drawer {
    top: calc(var(--safe-top) + var(--menubar-height));
    right: var(--safe-right);
    bottom: var(--safe-bottom);
    width: min(390px, calc(100vw - var(--safe-left) - var(--safe-right)));
  }

  .drawer-facts dd,
  .view-header p,
  .empty-state p {
    min-width: 0;
    overflow-wrap: anywhere;
  }

  .settings-shell {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
  }

  .settings-navigation {
    max-height: 238px;
    padding: 8px 10px 10px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .settings-back {
    min-height: 44px;
  }

  .settings-search {
    flex: 0 0 auto;
    min-height: 44px;
    margin: 3px 0 7px;
  }

  #settings-nav-list {
    display: flex;
    gap: 5px;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x proximity;
  }

  .settings-nav-group,
  .settings-nav-group + .settings-nav-group {
    display: flex;
    flex: 0 0 auto;
    gap: 5px;
    margin: 0;
    scroll-snap-align: start;
  }

  .settings-nav-group h2 {
    display: none;
  }

  .settings-nav-group button {
    grid-template-columns: 18px auto;
    width: auto;
    min-width: max-content;
    min-height: 44px;
    padding-inline: 10px;
  }

  .settings-content {
    padding: 28px 18px 56px;
  }

  .settings-page-header {
    margin-bottom: 24px;
  }

  .settings-row,
  .usage-plan-card {
    align-items: flex-start;
    flex-direction: column;
    gap: 9px;
  }

  .settings-value {
    max-width: 100%;
    text-align: left;
  }

  .settings-profile-card {
    grid-template-columns: 52px minmax(0, 1fr);
  }

  .settings-profile-card .status-badge {
    grid-column: 1 / -1;
    justify-self: start;
  }

  .quota-bucket {
    grid-template-columns: minmax(0, 1fr) 64px;
    gap: 11px;
  }

  .quota-meter {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .quota-bucket > span:last-child {
    grid-column: 2;
    grid-row: 1;
  }

  .account-popover {
    border-radius: 18px;
  }
}

/* A short tablet landscape viewport behaves like the phone shell. This also
   keeps the settings and composer usable when a virtual keyboard reduces the
   visual viewport to roughly 390–500 CSS px. */
@media (max-height: 500px) and (min-width: 761px) and (max-width: 900px) {
  :root {
    --menubar-height: 46px;
  }

  .app-shell {
    grid-template:
      "menubar" var(--menubar-height)
      "main" minmax(0, 1fr)
      / minmax(0, 1fr);
  }

  .app-menubar {
    grid-template-columns: 1fr auto;
    padding-inline: 8px;
  }

  .menubar-title,
  .history-button,
  .desktop-menus,
  .menubar-connection {
    display: none;
  }

  .menu-sidebar-toggle {
    display: inline-grid;
  }

  .sidebar {
    position: fixed;
    z-index: var(--z-overlay);
    top: calc(var(--safe-top) + var(--menubar-height));
    left: var(--safe-left);
    bottom: var(--safe-bottom);
    width: min(312px, calc(100vw - 46px));
    opacity: 1;
    pointer-events: auto;
    transform: translateX(-104%);
    box-shadow: 14px 0 46px rgba(25, 30, 38, 0.18);
  }

  body.mobile-sidebar-open .sidebar {
    transform: translateX(0);
  }

  body.mobile-sidebar-open .sidebar-scrim {
    opacity: 1;
    pointer-events: auto;
  }

  .main-frame {
    grid-area: main;
    grid-template-rows: 52px minmax(0, 1fr);
    max-width: 100vw;
    border-left: 0;
    border-top-left-radius: 0;
  }

  .modebar {
    min-height: 52px;
    padding-inline: 8px;
  }

  .home-stage {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr) auto;
    height: auto;
    min-height: 100%;
    padding: 8px 14px 12px;
    overflow-x: clip;
  }

  .connection-banner {
    position: static;
    max-width: 100%;
    border-radius: 16px;
    transform: none;
  }

  .home-center {
    position: static;
    justify-self: start;
    width: 100%;
    max-width: 100%;
    margin: 8px 0;
    transform: none;
  }

  .home-kicker,
  .voice-promo {
    display: none;
  }

  .home-center h1 {
    margin-bottom: 16px;
    font-size: 27px;
    line-height: 1.15;
  }

  .composer-shell textarea {
    min-height: 64px;
    padding-top: 14px;
  }

  .settings-shell {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
  }

  .settings-navigation {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-rows: 44px;
    gap: 5px;
    max-height: 54px;
    padding: 5px 8px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .settings-back {
    grid-column: 1;
    min-height: 44px;
  }

  .settings-search {
    display: none;
  }

  #settings-nav-list {
    display: flex;
    grid-column: 2;
    gap: 5px;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x proximity;
  }

  .settings-nav-group,
  .settings-nav-group + .settings-nav-group {
    display: flex;
    flex: 0 0 auto;
    gap: 5px;
    margin: 0;
  }

  .settings-nav-group h2 {
    display: none;
  }

  .settings-nav-group button {
    grid-template-columns: 18px auto;
    width: auto;
    min-width: max-content;
    min-height: 44px;
    padding-inline: 10px;
  }

  .settings-content {
    padding: 18px 18px 44px;
  }

  .settings-page-header {
    margin-bottom: 20px;
  }
}

@media (max-width: 420px) {
  .modebar-spacer {
    width: 32px;
  }

  .mode-switch {
    width: 172px;
  }

  .home-stage {
    padding-inline: 10px;
  }

  .home-center h1 {
    font-size: 27px;
  }

  .composer-subbar button {
    padding-inline: 7px;
  }

  .voice-promo small {
    display: none;
  }

  .promo-action {
    display: none;
  }

  .settings-content {
    padding-inline: 12px;
  }

  .settings-page-header h1 {
    font-size: 27px;
  }
}

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

@media (forced-colors: active) {
  .brand-mark,
  .voice-button,
  .primary-button,
  .promo-action {
    border: 1px solid ButtonText;
  }

  .state-dot,
  .mapping-check {
    border: 1px solid CanvasText;
  }
}

/* Current-client full surface contract. These rules render only structure and
   capability state; they do not imply that a runtime action is connected. */
[data-capability-state] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 22px;
  padding: 3px 8px;
  border: 1px solid transparent;
  border-radius: 999px;
  white-space: nowrap;
  font-size: 10px;
  font-weight: 650;
}

[data-capability-state="verified"] {
  color: #167755;
  border-color: #bde5d4;
  background: #eaf7f1;
}

[data-capability-state="read-only"] {
  color: #365fa5;
  border-color: #c8d8f2;
  background: #eef4fe;
}

[data-capability-state="protocol-only"] {
  color: #725cab;
  border-color: #d9cff4;
  background: #f3effd;
}

[data-capability-state="pending"] {
  color: #8b611c;
  border-color: #ead3aa;
  background: #fff7e8;
}

[data-capability-state="unsupported"] {
  color: #8d4843;
  border-color: #e8c6c3;
  background: #fff0ef;
}

.capability-legend {
  position: absolute;
  top: 50px;
  left: 50%;
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  width: min(600px, calc(100% - 36px));
  transform: translateX(-50%);
}

.primary-nav {
  max-height: min(460px, 48vh);
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-width: thin;
}

.primary-nav .entry-state[data-capability-state] {
  min-height: 18px;
  padding: 2px 5px;
  font-size: 8px;
}

.surface-hub {
  padding: clamp(28px, 4vw, 58px) clamp(22px, 5vw, 76px) 70px;
}

.surface-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 22px 0 26px;
  padding: 4px;
  border-radius: 12px;
  background: #f1f3f5;
}

.surface-tabs a {
  min-height: 36px;
  padding: 9px 14px;
  border-radius: 9px;
  color: var(--text-soft);
  text-decoration: none;
  font-size: 12px;
}

.surface-tabs a:hover,
.surface-tabs a:focus-visible,
.surface-tabs a[aria-current="page"] {
  color: var(--text);
  background: #fff;
  box-shadow: var(--shadow-sm);
}

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

.surface-card {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  min-height: 92px;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  text-align: left;
  box-shadow: var(--shadow-sm);
}

.surface-card:hover {
  border-color: var(--line-strong);
  background: #fafafb;
}

.surface-card > span:nth-child(2) {
  display: grid;
  gap: 5px;
}

.surface-card strong {
  font-size: 13px;
}

.surface-card small {
  color: var(--text-soft);
  line-height: 1.45;
}

.surface-card-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  color: #5149bd;
  background: #eeecff;
  font-weight: 750;
}

.task-view {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  background: #fbfbfc;
}

.task-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 84px;
  padding: 14px clamp(18px, 3vw, 38px);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
}

.task-title-block {
  min-width: 0;
}

.task-title-block .eyebrow {
  margin-bottom: 3px;
}

.task-title-block h1 {
  margin: 0;
  font-size: 19px;
  letter-spacing: -0.02em;
}

.task-title-block p:last-child {
  margin: 4px 0 0;
  color: var(--text-faint);
  font-size: 10px;
}

.task-header-actions,
.task-composer-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
}

.task-status-strip {
  display: flex;
  align-items: center;
  gap: 18px;
  min-height: 36px;
  padding: 7px clamp(18px, 3vw, 38px);
  border-bottom: 1px solid var(--line);
  color: var(--text-soft);
  background: #f5f6f8;
  overflow-x: auto;
  white-space: nowrap;
  font-size: 9px;
}

.task-status-strip > span:first-child {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--success);
}

.task-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 176px;
  min-height: 0;
  flex: 1;
  overflow: hidden;
}

.timeline {
  display: grid;
  align-content: start;
  gap: 14px;
  min-width: 0;
  padding: 26px clamp(18px, 4vw, 54px) 34px;
  overflow-y: auto;
}

.timeline-notice,
.timeline-card {
  width: min(780px, 100%);
  margin-inline: auto;
}

.timeline-notice {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid #d8d2f1;
  border-radius: 13px;
  color: #56517a;
  background: #f3f1fb;
  font-size: 11px;
}

.timeline-notice p {
  margin: 0;
  line-height: 1.55;
}

.timeline-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: #fff;
  box-shadow: 0 2px 10px rgba(24, 29, 38, 0.04);
}

.timeline-card header,
.timeline-card footer,
.approval-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.timeline-kind {
  color: var(--text-faint);
  font: 700 9px/1.2 ui-monospace, SFMono-Regular, Consolas, monospace;
  letter-spacing: 0.08em;
}

.timeline-card h2 {
  margin: 12px 0 9px;
  font-size: 14px;
}

.timeline-card p,
.timeline-card li,
.timeline-card dd,
.timeline-card dt,
.timeline-card footer {
  color: var(--text-soft);
  font-size: 10px;
  line-height: 1.55;
}

.plan-card ol {
  display: grid;
  gap: 7px;
  margin: 0;
  padding-left: 22px;
}

.plan-card li.is-done {
  color: var(--success);
  text-decoration: line-through;
}

.plan-card li.is-active {
  color: #4c49a8;
  font-weight: 650;
}

.command-card pre,
.terminal-screen {
  margin: 8px 0 12px;
  padding: 13px;
  border-radius: 10px;
  color: #e3e7ed;
  background: #20242b;
  overflow: auto;
  white-space: pre-wrap;
  font: 10px/1.6 ui-monospace, SFMono-Regular, Consolas, monospace;
}

.timeline-card button,
.approval-actions button,
.option-grid button,
.task-composer-actions button,
.panel-action-grid button,
.diff-toolbar button,
.mini-tabs button,
.terminal-command button {
  min-height: 34px;
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--text-soft);
  background: #f7f7f8;
  font-size: 10px;
}

.timeline-card dl {
  display: grid;
  gap: 5px;
  margin: 10px 0;
}

.timeline-card dl div {
  display: grid;
  grid-template-columns: 95px minmax(0, 1fr);
}

.timeline-card dd {
  margin: 0;
  color: var(--text);
}

.approval-actions {
  justify-content: flex-end;
}

.approval-actions button:last-child,
.task-send {
  color: #fff !important;
  border-color: #292b30 !important;
  background: #292b30 !important;
}

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

.file-card > button,
.agent-card > button {
  margin-top: 8px;
}

.task-tool-rail {
  display: grid;
  align-content: start;
  gap: 5px;
  padding: 16px 12px;
  border-left: 1px solid var(--line);
  background: #f4f5f7;
  overflow-y: auto;
}

.task-tool-rail button {
  display: grid;
  gap: 3px;
  min-height: 52px;
  padding: 9px 11px;
  border-radius: 10px;
  background: transparent;
  text-align: left;
}

.task-tool-rail button:hover {
  background: #e7e9ed;
}

.task-tool-rail span {
  font-size: 11px;
  font-weight: 650;
}

.task-tool-rail small {
  color: var(--text-faint);
  font-size: 8px;
}

.task-composer {
  width: min(920px, calc(100% - 36px));
  margin: 12px auto 16px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  box-shadow: var(--shadow-md);
}

.task-composer textarea {
  width: 100%;
  min-height: 64px;
  padding: 5px;
  border: 0;
  outline: 0;
  resize: vertical;
  background: transparent;
}

.task-composer-actions {
  justify-content: flex-start;
}

.task-send {
  margin-left: auto;
}

.task-drawer-panel {
  padding-bottom: 24px;
}

.panel-heading {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  margin: 18px 0;
}

.panel-heading h3,
.panel-heading p {
  margin: 0;
}

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

.panel-heading p {
  margin-top: 4px;
  color: var(--text-faint);
  font-size: 9px;
  line-height: 1.4;
}

.panel-icon,
.agent-node {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  color: #5149bd;
  background: #eeecff;
  font-weight: 750;
}

.panel-status-grid,
.panel-action-grid,
.mini-tabs,
.diff-toolbar,
.terminal-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 14px 0;
}

.goal-preview,
.artifact-placeholder,
.visualization-placeholder,
.agent-tree {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f8f8f9;
}

.goal-preview {
  display: grid;
  gap: 12px;
}

.goal-preview strong,
.goal-preview small,
.artifact-placeholder h4,
.artifact-placeholder p {
  display: block;
  margin: 0;
}

.goal-preview small,
.artifact-placeholder p {
  margin-top: 4px;
  color: var(--text-faint);
  font-size: 9px;
}

.goal-meter {
  height: 7px;
  border-radius: 999px;
  background: #e3e5e8;
  overflow: hidden;
}

.goal-meter span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--accent);
}

.mini-tabs {
  padding: 3px;
  border-radius: 10px;
  background: #f1f2f4;
}

.mini-tabs button[aria-selected="true"] {
  color: var(--text);
  background: #fff;
}

.diff-placeholder {
  display: grid;
  gap: 4px;
  padding: 14px;
  border-radius: 12px;
  background: #20242b;
  font: 9px/1.55 ui-monospace, SFMono-Regular, Consolas, monospace;
}

.diff-line.is-removed {
  color: #ffb3ad;
}

.diff-line.is-added {
  color: #9be2bd;
}

.artifact-placeholder {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding-block: 34px;
  text-align: center;
}

.terminal-meta {
  color: var(--text-faint);
  font-size: 8px;
}

.terminal-screen {
  min-height: 250px;
}

.terminal-command,
.browser-chrome {
  display: flex;
  gap: 7px;
}

.terminal-command input,
.browser-chrome div {
  min-width: 0;
  flex: 1;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--text-faint);
  background: #f4f5f6;
  font-size: 9px;
}

.browser-chrome button {
  min-width: 35px;
  border-radius: 9px;
  background: #eceef1;
}

.visualization-placeholder {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 260px;
  color: var(--text-faint);
  overflow: hidden;
}

.visualization-placeholder::before {
  content: "";
  position: absolute;
  inset: 18px;
  background-image: linear-gradient(#e6e8eb 1px, transparent 1px), linear-gradient(90deg, #e6e8eb 1px, transparent 1px);
  background-size: 28px 28px;
}

.visualization-placeholder span {
  z-index: 1;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(248, 248, 249, 0.92);
  font-size: 10px;
}

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

.agent-tree > div {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
}

.agent-tree > div.is-child {
  margin-left: 30px;
}

.agent-tree strong,
.agent-tree small {
  display: block;
}

.agent-tree small {
  margin-top: 4px;
  color: var(--text-faint);
  font-size: 9px;
}

@media (min-width: 1440px) {
  .inspector-drawer:has(.task-drawer-panel:not([hidden])) {
    width: min(520px, calc(100vw - 24px));
  }
}

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

  .task-workspace {
    grid-template-columns: minmax(0, 1fr);
  }

  .task-tool-rail {
    grid-template-columns: repeat(4, minmax(116px, 1fr));
    order: -1;
    border-left: 0;
    border-bottom: 1px solid var(--line);
    overflow-x: auto;
  }

  .task-tool-rail button {
    min-width: 116px;
  }
}

@media (max-width: 760px) {
  .capability-legend {
    position: static;
    width: 100%;
    padding-top: 42px;
    transform: none;
  }

  .surface-hub {
    padding: 24px 14px 54px;
  }

  .surface-card {
    grid-template-columns: 38px minmax(0, 1fr);
  }

  .surface-card > [data-capability-state] {
    grid-column: 1 / -1;
    justify-self: start;
  }

  .task-header {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
    padding: 12px 14px;
  }

  .task-status-strip {
    padding-inline: 14px;
  }

  .task-tool-rail {
    grid-template-columns: repeat(7, minmax(124px, 1fr));
  }

  .timeline {
    padding: 18px 12px 26px;
  }

  .task-composer {
    width: calc(100% - 20px);
    margin-block: 8px 10px;
  }

  .task-composer-actions {
    flex-wrap: nowrap;
    overflow-x: auto;
  }

  .task-composer-actions button {
    min-width: max-content;
    min-height: 44px;
  }

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

  .panel-heading {
    grid-template-columns: 38px minmax(0, 1fr);
  }

  .panel-heading > [data-capability-state] {
    grid-column: 1 / -1;
    justify-self: start;
  }
}

@media (max-width: 420px) {
  .surface-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
  }

  .task-title-block h1 {
    font-size: 16px;
  }

  .timeline-card {
    padding: 13px;
  }

  .timeline-card dl div {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Private read surface. It remains visibly locked until the user explicitly
   authorizes temporary display of private project and task content. */
.view-header-actions,
.readonly-breadcrumb,
.readonly-heading,
.readonly-pagination {
  display: flex;
  align-items: center;
  gap: 10px;
}

.view-header-actions {
  justify-content: flex-end;
  flex-wrap: wrap;
}

.read-state-card {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  margin-top: 18px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
}

.read-state-card[data-state="unsupported"],
.read-state-card[data-state="stale"] {
  border-color: color-mix(in srgb, #a36a20 42%, var(--line));
  background: color-mix(in srgb, #fff3d7 42%, var(--surface));
}

.read-state-card[data-state="error"] {
  border-color: color-mix(in srgb, #b84d4d 45%, var(--line));
}

.read-state-card h2,
.readonly-heading h2,
.read-empty-state h2 {
  margin: 0;
  font-size: 17px;
}

.read-state-card p,
.readonly-heading p,
.read-empty-state p {
  margin: 5px 0 0;
  color: var(--text-soft);
  line-height: 1.55;
}

.read-state-icon {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 12px;
  background: var(--surface-soft);
}

.readonly-list {
  display: grid;
  gap: 9px;
  margin-top: 16px;
}

.readonly-row,
.sidebar-live-threads button {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
  text-align: left;
}

.readonly-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  padding: 14px 16px;
}

.node-origin-tag,
.task-origin-tag,
[data-node-origin] {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  max-width: 100%;
  min-height: 24px;
  padding: 3px 8px;
  border: 1px solid color-mix(in srgb, var(--accent) 22%, var(--line));
  border-radius: 999px;
  color: #5148b8;
  background: color-mix(in srgb, var(--accent-soft) 76%, var(--surface));
  font-size: 11px;
  font-weight: 650;
  line-height: 1.2;
  white-space: nowrap;
}

.node-state-grid,
[data-node-state-grid] {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr));
  gap: 10px;
  max-width: 100%;
}

.node-state-grid .node-detail-card {
  min-width: 0;
  margin: 0;
}

.node-task-index {
  display: grid;
  gap: 14px;
  margin: 0 0 24px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: color-mix(in srgb, var(--surface-soft) 72%, var(--surface));
}

.task-index-controls,
.node-index-actions,
.node-account-heading,
.node-status-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.node-capability-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.connectivity-layer-list {
  display: grid;
  gap: 7px;
  margin-top: 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: color-mix(in srgb, var(--surface-soft) 72%, var(--surface));
}

.connectivity-layer-row {
  display: grid;
  grid-template-columns: 9px minmax(0, 1fr);
  align-items: start;
  gap: 8px;
}

.connectivity-layer-dot {
  width: 8px;
  height: 8px;
  margin-top: 4px;
  border-radius: 50%;
  background: #9da2aa;
}

.connectivity-layer-row[data-state="online"] .connectivity-layer-dot {
  background: #2b9a70;
}

.connectivity-layer-row[data-state="degraded"] .connectivity-layer-dot,
.connectivity-layer-row[data-state="stale"] .connectivity-layer-dot,
.connectivity-layer-row[data-state="flapping"] .connectivity-layer-dot {
  background: #c28a31;
}

.connectivity-layer-row[data-state$="unavailable"] .connectivity-layer-dot,
.connectivity-layer-row[data-state$="offline"] .connectivity-layer-dot,
.connectivity-layer-row[data-state$="unreachable"] .connectivity-layer-dot {
  background: #c05d57;
}

.connectivity-layer-copy {
  min-width: 0;
}

.connectivity-layer-copy strong,
.connectivity-layer-copy small {
  display: block;
  overflow-wrap: anywhere;
}

.connectivity-layer-copy strong {
  font-size: 10px;
}

.connectivity-layer-copy small,
.connectivity-layer-empty {
  margin: 2px 0 0;
  color: var(--text-faint);
  font-size: 9px;
  line-height: 1.45;
}

.task-index-controls .is-active {
  color: #fff;
  border-color: var(--text);
  background: var(--text);
}

.node-thread-card,
.node-account-card {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--surface);
}

.node-thread-card[data-read-state="error"],
.node-thread-card[data-read-state="offline"] {
  border-color: color-mix(in srgb, #b84d4d 42%, var(--line));
}

.node-thread-card[data-read-state="stale"] {
  border-color: color-mix(in srgb, #a36a20 42%, var(--line));
  background: color-mix(in srgb, #fff3d7 24%, var(--surface));
}

.node-thread-card header,
.node-account-card header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.node-thread-card h3,
.node-account-card h3 {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 15px;
}

.node-thread-card header p,
.node-account-card header p,
.node-read-message,
.node-account-card small {
  margin: 4px 0 0;
  color: var(--text-soft);
  font-size: 12px;
  line-height: 1.45;
}

.node-thread-list {
  display: grid;
  gap: 7px;
  margin-top: 12px;
}

.node-thread-list .readonly-row {
  padding: 11px 12px;
}

.node-status-chip {
  flex: 0 0 auto;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  color: var(--text-soft);
  background: var(--surface-soft);
  font-size: 11px;
  white-space: nowrap;
}

.node-status-chip[data-state="online"] {
  color: #176b42;
  background: #e7f5ed;
}

.node-status-chip[data-state="offline"],
.node-status-chip[data-state="error"] {
  color: #9a3434;
  background: #fdeaea;
}

.node-status-chip[data-state="stale"],
.node-status-chip[data-state="flapping"] {
  color: #8a5a13;
  background: #fff1d6;
}

.node-index-actions {
  justify-content: space-between;
  margin-top: 12px;
}

.node-index-actions button {
  min-height: 36px;
}

.node-account-list,
.account-node-switcher {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.account-node-switcher {
  max-height: 210px;
  margin: 0;
  padding: 8px 12px;
  overflow: auto;
  border-bottom: 1px solid var(--line);
}

.account-node-switcher .node-account-card {
  padding: 10px;
  background: var(--surface-soft);
}

.node-account-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px 12px;
  margin: 10px 0 0;
}

.node-account-facts div {
  min-width: 0;
}

.node-account-facts dt {
  color: var(--text-faint);
  font-size: 10px;
}

.node-account-facts dd {
  margin: 2px 0 0;
  overflow-wrap: anywhere;
  font-size: 12px;
}

.node-detail-card .fact-grid dd,
.node-detail-card .fact-grid dt {
  overflow-wrap: anywhere;
}

.readonly-row-copy {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.readonly-row-copy strong,
.sidebar-live-threads strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.readonly-row-copy small,
.sidebar-live-threads small,
.sidebar-live-status,
.readonly-row-action,
.readonly-breadcrumb > span {
  color: var(--text-soft);
  font-size: 12px;
}

.readonly-breadcrumb {
  justify-content: space-between;
  margin: 4px 0 18px;
}

.readonly-heading {
  justify-content: space-between;
  align-items: flex-start;
}

.readonly-pagination {
  justify-content: center;
  margin-top: 18px;
}

.read-empty-state {
  padding: 28px 18px;
  text-align: center;
}

.sidebar-live-status {
  padding: 7px 10px;
}

.sidebar-live-threads {
  display: grid;
  gap: 5px;
  margin-bottom: 8px;
}

.sidebar-live-threads button {
  display: grid;
  gap: 3px;
  padding: 9px 10px;
}

.live-thread-surface {
  min-height: 0;
  overflow: auto;
  padding: 20px clamp(16px, 3vw, 42px) 36px;
}

.turn-history {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.turn-card {
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
}

.turn-card header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.turn-card header span,
.turn-empty,
.history-truncation {
  color: var(--text-soft);
  font-size: 12px;
}

.turn-content {
  margin: 8px 0 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.62;
}

.history-truncation {
  padding: 12px 14px;
  border-radius: 12px;
  background: color-mix(in srgb, #fff3d7 45%, var(--surface));
}

@media (max-width: 760px) {
  .view-header-actions,
  .readonly-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .readonly-row {
    align-items: flex-start;
    gap: 10px;
  }

  .readonly-row-action {
    flex: 0 0 auto;
  }

  .node-origin-tag,
  .task-origin-tag,
  [data-node-origin] {
    max-width: calc(100vw - 56px);
  }

  .node-task-index {
    padding: 13px;
  }

  .task-index-controls,
  .node-index-actions {
    width: 100%;
  }

  .task-index-controls button,
  .node-index-actions button {
    flex: 1 1 auto;
  }

  .node-thread-card header,
  .node-account-card header {
    flex-direction: column;
  }

  .node-account-facts {
    grid-template-columns: minmax(0, 1fr);
  }

  .live-thread-surface {
    padding: 14px;
  }
}

@media (max-width: 560px) {
  .home-center h1 {
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    margin-inline: auto;
    padding-inline: 4px;
    overflow: visible;
    font-size: clamp(23px, 7vw, 29px);
    line-height: 1.18;
    letter-spacing: -0.035em;
    text-align: center;
    text-wrap: balance;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: normal;
  }
}

/* Passkey gate is inert until the gateway explicitly advertises authentication
   or a private-read request returns 401/403. It stores no browser state. */
.passkey-modal {
  width: min(460px, calc(100vw - 32px));
  max-height: min(760px, calc(100dvh - 32px));
  padding: 0;
  border: 0;
  border-radius: 22px;
  color: #17202a;
  background: #fff;
  box-shadow: 0 24px 80px rgb(20 30 45 / 28%);
}

.passkey-modal::backdrop {
  background: rgb(21 28 38 / 48%);
  backdrop-filter: blur(8px);
}

.passkey-panel {
  display: grid;
  gap: 16px;
  padding: 24px;
}

.passkey-panel > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.passkey-panel h2,
.passkey-panel h3,
.passkey-panel p {
  margin: 0;
}

.passkey-status,
.passkey-boundary {
  padding: 12px 14px;
  border: 1px solid #dce3ec;
  border-radius: 14px;
  background: #f6f8fb;
  color: #465568;
  line-height: 1.5;
}

.passkey-status[data-state="working"] {
  border-color: #9fc2ff;
  background: #edf4ff;
  color: #2458a6;
}

.passkey-status[data-state="error"] {
  border-color: #f1b5b5;
  background: #fff1f1;
  color: #9a2f2f;
}

.passkey-status[data-state="success"] {
  border-color: #a8d9be;
  background: #effaf3;
  color: #277249;
}

.passkey-authenticate,
.passkey-enrollment button,
.passkey-enrollment input {
  min-height: 44px;
}

.passkey-enrollment {
  display: grid;
  gap: 10px;
  padding-top: 4px;
}

.passkey-enrollment[hidden] {
  display: none;
}

.passkey-enrollment label {
  font-size: 13px;
  font-weight: 650;
  color: #3c4958;
}

.passkey-enrollment input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #cbd4df;
  border-radius: 12px;
  font: inherit;
  letter-spacing: .08em;
}

.passkey-boundary {
  font-size: 12px;
}

@media (max-width: 560px) {
  .passkey-modal {
    width: calc(100vw - max(20px, env(safe-area-inset-left)) - max(20px, env(safe-area-inset-right)));
    max-height: calc(100dvh - max(20px, env(safe-area-inset-top)) - max(20px, env(safe-area-inset-bottom)));
    border-radius: 18px;
  }

  .passkey-panel {
    padding: 20px;
  }
}

/* Touch contract for the HarmonyOS/browser control surface. Keep this after
   component rules so every enabled target remains at least 44 × 44 CSS px. */
@media (max-width: 860px) {
  button:not(:disabled),
  a[href],
  input:not(:disabled):not([type="hidden"]),
  textarea:not(:disabled),
  select:not(:disabled) {
    min-height: 44px;
  }

  button:not(:disabled),
  a[href] {
    min-width: 44px;
  }

  .icon-button:not(:disabled) {
    width: 44px;
    height: 44px;
  }

  .surface-tabs a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .mode-switch button,
  .approval-actions button,
  .option-grid button,
  .task-tool-rail button,
  .task-composer-actions button,
  .panel-action-grid button,
  .mini-tabs button,
  .diff-toolbar button,
  .terminal-command button,
  .account-popover-items button,
  .task-header-actions button {
    min-width: 44px;
    min-height: 44px;
  }
}
