:root {
  --pc-base: #fff;
  --pc-panel: #f7f7f9;
  --pc-raised: #f1f1f5;
  --pc-rule: #e8e8ed;
  --pc-control: #898b98;
  --pc-input-rule: #d7d7e0;
  --pc-ink: #24252b;
  --pc-muted: #666873;
  --pc-accent: #463b91;
  --pc-accent-hover: #362d73;
  --pc-selected: #efedf8;
  --pc-on-accent: #fff;
  --pc-success: #32614a;
  --pc-success-tint: #edf6f0;
  --pc-warn: #79511d;
  --pc-warn-tint: #fffaef;
  --pc-error: #a13535;
  --pc-error-tint: #fdf0ef;
  --pc-ui: system-ui, -apple-system, "Segoe UI", sans-serif;
  --pc-mono: ui-monospace, "SFMono-Regular", Consolas, monospace;
  --pc-gutter: clamp(24px, 4vw, 58px);
  --pc-radius: 7px;
}

body:has(> #app), body.dashboard-active { margin: 0; }
:where(body:has(> #app), body.dashboard-active, .app-shell, .auth-page, .modal, #hosted-dashboard) {
  color-scheme: light;
  background: var(--pc-base);
  color: var(--pc-ink);
  font: 14px/1.5 var(--pc-ui);
}
:where(.app-shell, .auth-page, .modal, #hosted-dashboard > .view),
:where(.app-shell, .auth-page, .modal) *,
:where(.app-shell, .auth-page, .modal) *::before,
:where(.app-shell, .auth-page, .modal) *::after { box-sizing: border-box; }

:is(.app-shell, .auth-page, .modal) :is(h1, h2, h3, h4, p) { margin: 0; overflow-wrap: anywhere; }
:is(.app-shell, .auth-page, .modal) :is(h1, h2, h3, h4) {
  color: var(--pc-ink);
  font: 600 20px/1.25 var(--pc-ui);
  letter-spacing: -.025em;
}
:is(.app-shell, .auth-page, .modal) p { color: inherit; font: inherit; }
:is(.app-shell, .auth-page, .modal) :is(button, input, select, textarea) { font: inherit; }
:is(.app-shell, .auth-page, .modal) button { cursor: pointer; }
:is(.app-shell, .auth-page, .modal) button:disabled { cursor: default; opacity: .6; }
:is(.app-shell, .auth-page, .modal) :is(a, button, input, select, textarea, summary):focus-visible,
.editor-panel:focus-visible, .app-shell .view:focus-visible, .skip-link:focus-visible {
  outline: 2px solid var(--pc-accent);
  outline-offset: 3px;
}
:is(.app-shell, .auth-page, .modal) :is(kbd, code, pre) { font-family: var(--pc-mono); }
:is(.app-shell, .auth-page, .modal) pre { max-width: 100%; overflow: auto; }
:is(.app-shell, .auth-page, .modal) summary { cursor: pointer; color: var(--pc-ink); }
:is(.app-shell, .auth-page, .modal) ::placeholder { color: var(--pc-muted); opacity: 1; }
:is(.app-shell, .auth-page, .modal) ::selection { color: var(--pc-on-accent); background: var(--pc-accent); }
:is(.app-shell, .auth-page, .modal) :is(.muted, .small-text, .fine-print) { color: var(--pc-muted); }
:is(.app-shell, .auth-page, .modal) :is(.small-text, .fine-print) { font-size: 12px; line-height: 1.55; }

:is(.app-shell, .auth-page, .modal) .eyebrow,
.workspace-nav-label, .editor-label {
  color: var(--pc-muted);
  font: 600 12px/1.4 var(--pc-ui);
}

.skip-link {
  position: absolute;
  z-index: 20;
  inset: -100px auto auto 12px;
  padding: 10px 14px;
  border-radius: var(--pc-radius);
  background: var(--pc-accent);
  color: var(--pc-on-accent);
  font: 600 14px/1.3 var(--pc-ui);
}
.skip-link:focus { top: 12px; }

/* Shared controls and feedback */
:is(.app-shell, .auth-page, .modal) :is(.button, .icon-button, .top-search, .document-actions summary) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-width: 0;
  max-width: 100%;
  min-height: 40px;
  padding: 7px 13px;
  border: 1px solid var(--pc-input-rule);
  border-radius: 6px;
  color: var(--pc-ink);
  background: var(--pc-base);
  font: 600 13px/1.35 var(--pc-ui);
  text-align: center;
  overflow-wrap: anywhere;
}
:is(.app-shell, .auth-page, .modal) :is(.button, .icon-button, .top-search, .document-actions summary):hover:not(:disabled) {
  border-color: var(--pc-control);
  background: var(--pc-panel);
}
:is(.app-shell, .auth-page, .modal) .button.primary {
  width: auto;
  border-color: var(--pc-accent);
  background: var(--pc-accent);
  color: var(--pc-on-accent);
}
:is(.app-shell, .auth-page, .modal) .button.primary:hover:not(:disabled) {
  border-color: var(--pc-accent-hover);
  background: var(--pc-accent-hover);
}
:is(.app-shell, .auth-page, .modal) .button.danger { color: var(--pc-error); }
:is(.app-shell, .auth-page, .modal) .button.danger:hover:not(:disabled) { background: var(--pc-error-tint); }
:is(.app-shell, .auth-page, .modal) .button.quiet { background: transparent; }
:is(.app-shell, .auth-page, .modal) .button.small { padding-inline: 10px; }
:is(.app-shell, .auth-page, .modal) .button.wide { width: 100%; }

:is(.app-shell, .auth-page, .modal) :is(.text-button, .summary-link, .demo-link) {
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--pc-accent-hover);
  font: inherit;
  font-weight: 600;
  text-align: left;
  text-decoration: underline;
  text-underline-offset: .22em;
}
:is(.app-shell, .auth-page, .modal) .text-button { min-height: 38px; font-size: 13px; }
:is(.app-shell, .auth-page, .modal) :is(.text-button, .summary-link, .demo-link):hover {
  color: var(--pc-ink);
  text-decoration-thickness: 2px;
}

.pill {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  width: fit-content;
  padding: 3px 6px;
  border-radius: 4px;
  color: var(--pc-muted);
  font: 550 11px/1.3 var(--pc-ui);
  white-space: nowrap;
}
.pill.live { color: var(--pc-success); background: var(--pc-success-tint); }
.pill.purple { color: var(--pc-accent); }
.pill.warning { color: var(--pc-warn); background: var(--pc-warn-tint); }

.status-dot { flex: 0 0 7px; width: 7px; height: 7px; border-radius: 50%; background: var(--pc-muted); }
.status-dot.online { background: var(--pc-success); }
.status-dot.warning { background: var(--pc-warn); }

:is(.app-shell, .auth-page, .modal) .message {
  margin: 12px 0;
  padding: 10px 13px;
  border: 1px solid var(--pc-rule);
  border-left: 3px solid var(--pc-muted);
  border-radius: 6px;
  background: var(--pc-panel);
  color: var(--pc-ink);
  overflow-wrap: anywhere;
}
:is(.app-shell, .auth-page, .modal) .message.error { border-left-color: var(--pc-error); background: var(--pc-error-tint); color: var(--pc-error); }
:is(.app-shell, .auth-page, .modal) .message.success { border-left-color: var(--pc-success); background: var(--pc-success-tint); color: var(--pc-success); }
:is(.app-shell, .auth-page, .modal) .message.warning { border-left-color: var(--pc-warn); background: var(--pc-warn-tint); color: var(--pc-warn); }
.message ul { padding-left: 20px; margin: 6px 0 0; }
.app-shell .error-text { color: var(--pc-error); }

/* Workspace frame */
.app-shell {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  min-width: 0;
  min-height: 100vh;
}
.sidebar {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 19px;
  padding: 20px 15px 16px;
  border-right: 1px solid var(--pc-rule);
  background: var(--pc-panel);
}
.app-shell .brand {
  display: flex;
  align-items: center;
  align-self: flex-start;
  gap: 9px;
  padding: 0 3px;
  color: var(--pc-ink);
  font: 650 20px/1.1 var(--pc-ui);
  letter-spacing: -.025em;
  text-decoration: none;
}
.brand-mark {
  position: relative;
  display: inline-block;
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  color: var(--pc-accent);
  font-size: 0;
}
.brand-mark::before, .brand-mark::after { position: absolute; content: ""; }
.brand-mark::before { inset: 5px; border: 1px solid currentColor; transform: rotate(45deg); }
.brand-mark::after {
  top: 1px;
  left: 10px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 9px 9px currentColor, 0 18px currentColor, -9px 9px currentColor;
}

.team-picker {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
  padding: 8px 0;
  border-block: 1px solid var(--pc-rule);
}
.team-picker select {
  width: 100%;
  min-width: 0;
  min-height: 38px;
  padding: 2px 5px;
  border: 0;
  border-radius: 4px;
  background: var(--pc-panel);
  color: var(--pc-ink);
  font-weight: 600;
  text-overflow: ellipsis;
}
.app-shell .team-picker .text-button {
  min-height: 34px;
  justify-self: start;
  margin-inline: 4px;
  font-size: 12px;
}
.app-shell .team-picker .team-manage { color: var(--pc-muted); }

.app-shell .main-nav { display: grid; min-width: 0; gap: 3px; }
.workspace-nav-label { margin: 12px 0 1px; padding: 3px 9px; color: var(--pc-muted); }
.app-shell .nav-button {
  position: relative;
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  min-height: 38px;
  padding: 6px 8px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--pc-muted);
  font-size: 13px;
  font-weight: 600;
  text-align: left;
}
.nav-button::before {
  display: grid;
  place-items: center;
  flex: 0 0 20px;
  height: 20px;
  color: inherit;
  font: 16px/1 var(--pc-ui);
  content: "·";
}
.nav-button[data-view="Now"]::before { content: "◷"; }
.nav-button[data-view="To do"]::before { content: "✓"; }
.nav-button[data-view="Library"]::before { content: "▤"; }
.nav-button[data-view="Decisions"]::before { content: "◇"; }
.nav-button[data-view="People"]::before { content: "◎"; }
.nav-button[data-view="Projects"]::before { content: "▧"; }
.nav-button[data-view="Team"]::before { content: "◫"; }
.nav-button[data-view="Agents"]::before { content: "↗"; }
.nav-button[data-view="Devices"]::before { content: "▣"; }
.nav-button[data-view="Local setup"]::before { content: "⌘"; }
.app-shell .nav-button:hover { background: var(--pc-raised); color: var(--pc-ink); }
.app-shell .nav-button:is(.active, [aria-current="page"]) {
  background: var(--pc-selected);
  color: var(--pc-accent);
}

.member-list { padding: 12px 4px 0; border-top: 1px solid var(--pc-rule); }
.app-shell .member-list h2 { margin-bottom: 7px; }
.member-row { display: flex; align-items: center; gap: 7px; margin-top: 8px; }
.app-shell .avatar {
  display: grid;
  flex: 0 0 27px;
  place-items: center;
  width: 27px;
  height: 27px;
  border-radius: 50%;
  background: var(--pc-raised);
  color: var(--pc-muted);
  font: 600 12px/1 var(--pc-ui);
}
.member-copy { min-width: 0; display: grid; flex: 1; gap: 1px; overflow-wrap: anywhere; }
.member-copy strong { font-size: 12px; }
.member-copy span { color: var(--pc-muted); font-size: 11px; }

.connection { display: flex; align-items: center; gap: 6px; color: var(--pc-muted); font-size: 12px; }
.connection.attention { color: var(--pc-warn); }

.main-column { min-width: 0; container-type: inline-size; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 56px;
  padding: 6px var(--pc-gutter);
  border-bottom: 1px solid var(--pc-rule);
  background: var(--pc-base);
}
.breadcrumb {
  min-width: 0;
  overflow: hidden;
  color: var(--pc-ink);
  font-size: 14px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.topbar-right { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 0 0 auto; }
.app-shell .top-search { min-height: 38px; justify-content: space-between; gap: 10px; background: var(--pc-panel); }
.top-search kbd {
  padding: 2px 4px;
  border: 1px solid var(--pc-rule);
  border-radius: 4px;
  background: var(--pc-panel);
  color: var(--pc-muted);
  font-size: 10px;
}
.app-shell .account-exit { padding: 5px 0 5px 4px; color: var(--pc-muted); white-space: nowrap; }
.app-shell .account-exit:hover { color: var(--pc-ink); }
.app-shell .main-column > :is(.message, [data-pending-invitation]) { margin: 12px var(--pc-gutter) 0; }

/* Now and workspace views */
.app-shell .view,
#hosted-dashboard > .view {
  width: min(100%, 1260px);
  min-width: 0;
  margin: 0 auto;
  padding: clamp(26px, 3.6vw, 48px) var(--pc-gutter) 54px;
}
.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px 18px;
  margin-bottom: 24px;
}
.section-heading > :first-child { min-width: 0; }
.app-shell .section-heading h1 {
  margin-bottom: 5px;
  font-size: clamp(30px, 3.2vw, 42px);
  letter-spacing: -.025em;
  line-height: 1.14;
}
.app-shell .section-heading p { max-width: 64ch; color: var(--pc-muted); font-size: 14px; }

.heading-actions, .toolbar-actions, .device-actions, .demo-actions, .readiness-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 8px;
}
.heading-actions { justify-content: flex-end; }
.two-column { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.overview-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
  align-items: start;
  gap: clamp(20px, 3vw, 38px);
}
.overview-main, .overview-rail { min-width: 0; }
.overview-rail { padding-left: clamp(17px, 2.6vw, 32px); border-left: 1px solid var(--pc-rule); }
.view-overview .section-heading { margin-bottom: 12px; }
.demo-guide { display: flex; flex-wrap: wrap; align-items: center; gap: 0 12px; color: var(--pc-muted); font-size: 13px; }
.workspace-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 3px 9px;
  margin-bottom: 25px;
  color: var(--pc-muted);
  font-size: 13px;
}
.workspace-summary strong { font-weight: 600; }
.workspace-summary > span + span::before { content: "·"; margin-right: 9px; }

.readiness, .fingerprint-card, .recovery-card {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  margin-bottom: 17px;
  padding: 12px 0;
  border-block: 1px solid var(--pc-rule);
}
.readiness-copy, :is(.fingerprint-card, .recovery-card) > div { flex: 1 1 240px; min-width: 0; }
.app-shell :is(.readiness, .fingerprint-card, .recovery-card) h2 { margin: 3px 0 4px; }
.readiness.pending { padding: 13px; border: 1px solid var(--pc-rule); border-radius: var(--pc-radius); background: var(--pc-warn-tint); }
.app-shell .fingerprint-inline { flex: 1 0 100%; color: var(--pc-warn); font: 12px/1.5 var(--pc-mono); }
.app-shell .inline-note { margin: 0 0 16px; }
.workspace-tools { margin-top: 24px; border-top: 1px solid var(--pc-rule); }
.workspace-tools summary { min-height: 38px; padding: 8px 0; font-size: 13px; font-weight: 600; }
.workspace-tools .readiness { margin-bottom: 0; }

.overview-card { min-width: 0; overflow-wrap: anywhere; }
.app-shell .overview-card > h2 { margin-bottom: 8px; }
.app-shell .overview-card > p + p { margin-top: 8px; }
.app-shell .view > .overview-card + .overview-card { margin-top: 26px; }
.card-heading, .section-subhead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  margin-bottom: 8px;
}
.card-heading > div { min-width: 0; }
.app-shell .card-heading p { margin-top: 4px; color: var(--pc-muted); font-size: 13px; }

.overview-lines { min-width: 0; border-top: 1px solid var(--pc-rule); font-size: 14px; line-height: 1.5; overflow-wrap: anywhere; }
.app-shell .overview-line { display: flex; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--pc-rule); color: var(--pc-muted); }
.app-shell .overview-owner { margin-top: 2px; }
.overview-copy { min-width: 0; }
.app-shell .overview-description { margin-top: 3px; color: var(--pc-muted); }
.app-shell .view-overview .overview-line .summary-link { color: var(--pc-accent); text-decoration: none; }
.app-shell .view-overview .overview-line .summary-link:hover { text-decoration: underline; }
.app-shell .overview-empty { padding: 11px 0; color: var(--pc-muted); }
.recent-section { margin-top: 24px; }

/* Library, folders, notes and Markdown */
.doc-list { min-width: 0; border-top: 1px solid var(--pc-rule); }
.doc-list:has(> .empty-inline) { border-top: 0; }
.app-shell .doc-row {
  display: flex;
  align-items: center;
  gap: 8px 10px;
  width: 100%;
  min-width: 0;
  min-height: 56px;
  padding: 8px;
  border: 0;
  border-bottom: 1px solid var(--pc-rule);
  background: transparent;
  color: var(--pc-ink);
  text-align: left;
}
.app-shell .doc-row:hover { background: var(--pc-panel); }
.app-shell .doc-row:is(.selected, [aria-current="true"]) { background: var(--pc-selected); }
.app-shell .doc-row:focus-visible { outline-offset: -2px; }
.doc-icon, .device-symbol {
  display: grid;
  flex: 0 0 22px;
  width: 22px;
  height: 24px;
  place-items: center;
  color: var(--pc-muted);
  font: 15px/1 var(--pc-ui);
}
.doc-row:is(.selected, [aria-current="true"]) .doc-icon { color: var(--pc-accent); }

.doc-row-copy, .device-details { display: grid; min-width: 0; flex: 1; gap: 3px; overflow-wrap: anywhere; }
.doc-row-copy strong, .device-details strong { font-size: 14px; font-weight: 600; }
.doc-row-copy .document-context { color: var(--pc-muted); font-size: 12px; }
:is(.app-shell, .auth-page, .modal) :is(.empty-inline, .empty-state) {
  padding: 15px;
  border: 1px dashed var(--pc-input-rule);
  border-radius: var(--pc-radius);
  color: var(--pc-muted);
}
.empty-state strong { color: var(--pc-ink); }
:is(.app-shell, .auth-page, .modal) .empty-state p { margin-top: 4px; }

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 0 0 15px;
}
.app-shell .filter-chip {
  min-height: 37px;
  padding: 6px 10px;
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
  color: var(--pc-muted);
  font-size: 13px;
  font-weight: 550;
  overflow-wrap: anywhere;
}
.app-shell .filter-chip:hover { background: var(--pc-panel); color: var(--pc-ink); }
.app-shell .filter-chip:is(.active, [aria-pressed="true"]) {
  background: var(--pc-selected);
  color: var(--pc-accent);
}

.library-layout { display: grid; min-width: 0; gap: 20px; }
.library-layout > .editor-panel { margin: 0; }
.editor-panel {
  min-width: 0;
  margin-bottom: 14px;
  border-block: 1px solid var(--pc-rule);
  background: var(--pc-base);
  scroll-margin-top: 66px;
}
.editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 14px;
  min-width: 0;
  padding: 13px 0;
  border-bottom: 1px solid var(--pc-rule);
  background: var(--pc-base);
}
.editor-heading { flex: 1 1 205px; min-width: 0; }
.app-shell .editor-toolbar h2 { margin-bottom: 5px; font-size: clamp(22px, 2.1vw, 28px); }
:is(.app-shell, .modal) .path-label { color: var(--pc-muted); font: 11px/1.55 var(--pc-mono); overflow-wrap: anywhere; }
.note-location { max-width: 100%; }
.app-shell .note-location .path-label { min-height: 24px; padding-block: 3px; }
.note-location code {
  display: block;
  max-width: 100%;
  margin-top: 3px;
  padding: 5px 7px;
  border: 1px solid var(--pc-rule);
  border-radius: 4px;
  background: var(--pc-base);
  color: var(--pc-ink);
  font-size: 11px;
  overflow-wrap: anywhere;
  user-select: all;
}
.document-actions { position: relative; }
.app-shell .document-actions summary { list-style: none; }
.document-actions summary::-webkit-details-marker { display: none; }
.document-actions summary::after {
  width: 6px;
  height: 6px;
  margin-top: -3px;
  transform: rotate(45deg);
  border-right: 1px solid currentColor;
  border-bottom: 1px solid currentColor;
  content: "";
}
.document-actions[open] summary::after { margin-top: 3px; transform: rotate(225deg); }
.document-action-menu {
  position: absolute;
  z-index: 3;
  inset: calc(100% + 4px) 0 auto auto;
  display: grid;
  gap: 4px;
  min-width: 108px;
  padding: 5px;
  border: 1px solid var(--pc-input-rule);
  border-radius: 6px;
  background: var(--pc-base);
  box-shadow: 0 6px 20px #24252b1a;
}
.note-close { white-space: nowrap; }

.editor-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.editor-wrap, .preview-wrap, .reading-wrap { min-width: 0; padding: clamp(13px, 2vw, 24px); }
.preview-wrap { border-left: 1px solid var(--pc-rule); background: var(--pc-panel); }
.reading-wrap { max-width: 79ch; margin: 0 auto; }
.editor-label { margin-bottom: 11px; }
.app-shell .editor {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 285px;
  padding: 11px;
  resize: vertical;
  border: 1px solid var(--pc-input-rule);
  border-radius: 6px;
  background: var(--pc-base);
  color: var(--pc-ink);
  font: 13px/1.6 var(--pc-mono);
}
.rendered-markdown { color: var(--pc-ink); font: 16px/1.7 var(--pc-ui); overflow-wrap: anywhere; }
.app-shell .rendered-markdown :is(h1, h2, h3, h4) { margin: 20px 0 7px; }
.app-shell .rendered-markdown > :first-child { margin-top: 0; }
.app-shell .rendered-markdown h1 { font-size: 24px; }
.app-shell .rendered-markdown h2 { font-size: 20px; }
.app-shell .rendered-markdown :is(h3, h4) { font-size: 17px; }
.app-shell .rendered-markdown p { margin: 0 0 12px; }
.app-shell .rendered-markdown :is(ul, ol) { margin: 0 0 13px; padding-left: 22px; }
.app-shell .rendered-markdown li { margin: 4px 0; padding: 0; }
.app-shell .rendered-markdown input[type="checkbox"] { appearance: auto; width: 15px; height: 15px; margin: 0 7px 0 0; padding: 0; accent-color: var(--pc-accent); vertical-align: -.09em; }
.app-shell .rendered-markdown code { padding: 1px 4px; border-radius: 4px; background: var(--pc-raised); color: var(--pc-accent-hover); font-size: .87em; }
.rendered-markdown :is(pre, table) { display: block; max-width: 100%; overflow: auto; }
.source-details { margin-top: 18px; padding-top: 10px; border-top: 1px solid var(--pc-rule); }
.app-shell .source-details summary { min-height: 36px; padding-top: 5px; color: var(--pc-muted); font-size: 13px; }
.source-details pre, .branch pre, .branch-draft pre, .draft-content {
  margin: 7px 0 0;
  padding: 10px;
  border-radius: 5px;
  background: var(--pc-base);
  color: var(--pc-ink);
  font: 12px/1.6 var(--pc-mono);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.conflict-box { margin: 12px; padding: 12px; border: 1px solid var(--pc-input-rule); border-radius: 6px; background: var(--pc-warn-tint); }
.conflict-heading strong { color: var(--pc-warn); }
.app-shell .conflict-heading p { margin-top: 4px; }
.branch, .branch-draft { margin: 8px 0; padding: 8px; border: 1px solid var(--pc-rule); border-radius: 5px; background: var(--pc-panel); }
.branch summary { font-size: 13px; overflow-wrap: anywhere; }
.branch pre, .branch-draft pre { max-height: 285px; }
.conflict-box > .button { margin: 4px 6px 0 0; }
.draft-content { min-height: 100px; max-height: min(48dvh, 440px); margin: 0; border: 1px solid var(--pc-rule); }

/* Devices, agents, team settings and forms */
.device-list { min-width: 0; margin: 20px 0; }
.app-shell .device-list > .muted { margin-bottom: 10px; }
.device-row {
  display: flex;
  align-items: center;
  gap: 7px 11px;
  min-width: 0;
  padding: 10px 0;
  border-top: 1px solid var(--pc-rule);
}
.device-row:last-child { border-bottom: 1px solid var(--pc-rule); }
.device-details span { color: var(--pc-muted); font-size: 12px; }
.device-details code { color: var(--pc-muted); font-size: 11px; }

.setup-card {
  display: grid;
  justify-items: start;
  align-content: start;
  gap: 10px;
  min-width: 0;
  padding: 14px 0;
  border-top: 1px solid var(--pc-rule);
}
.setup-card :is(.field, details) { width: 100%; }
.app-shell .setup-card .eyebrow, .app-shell .setup-card h2 + p { margin: 4px 0; }
.setup-card details .fine-print { margin: 6px 0; }
.setup-detail {
  display: grid;
  grid-template-columns: minmax(0, 130px) minmax(0, 1fr);
  gap: 8px;
  padding: 7px 0;
  border-top: 1px solid var(--pc-rule);
}
.setup-detail code { overflow-wrap: anywhere; }
.app-shell .local-setup-details .fine-print { margin-top: 9px; }

.stack { display: grid; min-width: 0; gap: 10px; }
:is(.app-shell, .auth-page, .modal) .field {
  display: grid;
  gap: 5px;
  min-width: 0;
  color: var(--pc-ink);
  font-size: 13px;
  font-weight: 650;
}
:is(.app-shell, .auth-page, .modal) :is(.field input, .field textarea, .field select, .invite-code, .search-input-row input, .search-filters select, .modal-content > input) {
  width: 100%;
  min-width: 0;
  min-height: 42px;
  padding: 8px 10px;
  border: 1px solid var(--pc-control);
  border-radius: 6px;
  color: var(--pc-ink);
  background: var(--pc-base);
  font: 400 16px/1.4 var(--pc-ui);
}
:is(.app-shell, .modal) .invite-code { min-height: 88px; font: 12px/1.5 var(--pc-mono); }
:is(.app-shell, .auth-page, .modal) :is(.field textarea, .invite-code) { resize: vertical; }
.modal .new-content { min-height: 130px; }

/* Local access and onboarding */
.auth-page { min-height: 100vh; padding: clamp(24px, 8vh, 80px) var(--pc-gutter) 32px; }
.welcome-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: start;
  gap: 26px;
  width: min(100%, 960px);
  margin: 0 auto;
}
.welcome-intro { min-width: 0; padding: clamp(14px, 4vw, 32px) clamp(4px, 2vw, 20px) 14px 0; }
.welcome-intro .brand-mark { margin-bottom: 15px; }
.auth-page .welcome-intro h1 {
  margin: 7px 0 11px;
  font-size: clamp(35px, 4vw, 52px);
  letter-spacing: -.025em;
  line-height: 1;
}
.auth-page .welcome-lede { max-width: 33ch; margin-bottom: 9px; font: 550 clamp(17px, 1.8vw, 23px)/1.4 var(--pc-ui); }
.welcome-intro .muted { max-width: 49ch; }
.auth-card, .install-steps {
  min-width: 0;
  padding: clamp(15px, 2.2vw, 23px);
  border: 1px solid var(--pc-rule);
  border-radius: var(--pc-radius);
  background: var(--pc-base);
}
.install-steps { background: var(--pc-panel); }
.auth-page .auth-card h2 { margin: 6px 0; font-size: 24px; }
.auth-page .auth-card > .muted { margin-bottom: 14px; }
.auth-options, .welcome-secondary, .welcome-recovery { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.auth-options { margin-top: 8px; }
.welcome-divider { margin: 12px 0; border-top: 1px solid var(--pc-rule); }
.welcome-secondary .fine-print { flex: 1 1 140px; }
.install-steps { grid-column: 1 / -1; }
.auth-page .install-steps h2 { margin: 4px 0 6px; }
.command-block {
  margin: 10px 0 7px;
  padding: 10px 13px;
  border: 1px solid var(--pc-rule);
  border-radius: 6px;
  background: var(--pc-base);
  color: var(--pc-ink);
  font: 13px/1.65 var(--pc-mono);
}
.welcome-recovery { width: min(100%, 960px); margin: 10px auto 0; }

/* Native dialogs and search */
.modal {
  width: min(535px, calc(100% - 26px));
  max-width: none;
  max-height: min(89vh, 770px);
  max-height: min(89dvh, 770px);
  padding: 0;
  border: 1px solid var(--pc-rule);
  border-radius: 10px;
  background: var(--pc-base);
  box-shadow: 0 12px 38px #24252b20;
}
.modal::backdrop { background: #24252b52; }
.modal-card { min-width: 0; margin: 0; padding: 0; }
.modal-heading {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px 11px;
  padding: 10px 15px;
  border-bottom: 1px solid var(--pc-rule);
  background: var(--pc-base);
}
.modal-heading .icon-button { flex: 0 0 auto; }
.modal-content { display: grid; gap: 10px; min-width: 0; padding: 15px; }
.modal .modal-content h3 { font-size: 17px; }
.modal-content > form + form { padding-top: 12px; border-top: 1px solid var(--pc-rule); }
.modal .modal-content .message { margin: 0; }
.modal-content ol { margin: 0; padding-left: 20px; }

.search-modal { width: min(670px, calc(100% - 26px)); }
.search-form { display: grid; gap: 8px; min-width: 0; }
.search-input-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 7px; }
.search-filters { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; }
.modal .search-filters select { font-size: 14px; }
.modal .search-status { color: var(--pc-muted); font-size: 13px; }
.search-dialog-results { min-width: 0; max-height: min(45dvh, 420px); overflow: auto; }
.search-dialog-results:empty { display: none; }
.search-results { border: 1px solid var(--pc-rule); border-radius: 6px; }
.result-row {
  display: grid;
  gap: 3px;
  width: 100%;
  min-width: 0;
  padding: 9px 10px;
  border: 0;
  border-bottom: 1px solid var(--pc-rule);
  background: transparent;
  color: var(--pc-ink);
  text-align: left;
  overflow-wrap: anywhere;
}
.result-row:last-child { border: 0; }
.result-row:hover { background: var(--pc-raised); }
.modal .result-row:focus-visible { outline-offset: -3px; }
.result-path { color: var(--pc-muted); font: 11px/1.45 var(--pc-mono); }
.result-excerpt { font-size: 13px; }

/* Hosted dashboard, standalone workspace and the embedded preview */
body.dashboard-active > .header, body.dashboard-active > #main, body.dashboard-active > footer { display: none; }
#hosted-dashboard { min-height: 100vh; }
#hosted-dashboard[hidden] { display: none; }

@container (min-width: 850px) {
  .library-layout.is-readonly {
    grid-template-columns: minmax(216px, .8fr) minmax(0, 1.75fr);
    align-items: start;
  }
  .library-layout.is-readonly > .editor-panel {
    grid-column: 2;
    grid-row: 1;
    padding-left: 18px;
    border-top: 0;
    border-left: 1px solid var(--pc-rule);
  }
  .library-layout.is-readonly > .doc-list { grid-column: 1; grid-row: 1; }
}

@container (max-width: 820px) {
  .topbar .connection:not(.attention) { display: none; }
}
@container (min-width: 610px) {
  .demo-dashboard .view-overview:has(> .demo-guide) { display: grid; grid-template-columns: minmax(0, 1fr) auto; }
  .demo-dashboard .view-overview > :not(.section-heading, .demo-guide) { grid-column: 1 / -1; }
  .demo-dashboard .view-overview > .section-heading { grid-area: 1 / 1; }
  .demo-dashboard .view-overview > .demo-guide { grid-area: 1 / 2; align-self: start; }
}
@container (max-width: 610px) {
  .editor-grid { grid-template-columns: minmax(0, 1fr); }
  .preview-wrap { border-top: 1px solid var(--pc-rule); border-left: 0; }
  .section-heading { flex-direction: column; align-items: flex-start; }
  .heading-actions { justify-content: flex-start; }
  .two-column, .overview-grid { grid-template-columns: minmax(0, 1fr); }
  .overview-rail { padding: 0; border: 0; }
}
@container (max-width: 470px) {
  .topbar-right { gap: 7px; }
  .top-search kbd { display: none; }
  .topbar:has(.attention) { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; row-gap: 3px; }
  .topbar-right:has(.attention) { display: contents; }
  .topbar .connection.attention { grid-area: 2 / 1 / auto / -1; }
  .main-column:has(.attention) .editor-panel { scroll-margin-top: 85px; }
  .device-row { flex-wrap: wrap; align-items: flex-start; }
  .device-details { flex-basis: calc(100% - 43px); }
  .device-row > :is(.button, .device-actions, .pill) { margin-left: 40px; }
}

@media (min-width: 761px) {
  :is(#app, #hosted-dashboard, .demo-dashboard) .sidebar {
    position: sticky;
    top: 0;
    align-self: start;
    height: 100vh;
    height: 100dvh;
    overflow: auto;
  }
  #demo-content { container-type: size; }
  #demo-content .sidebar { height: 100cqh; }
}
@media (min-width: 761px) and (max-width: 950px) {
  .app-shell { grid-template-columns: 192px minmax(0, 1fr); }
  .sidebar { padding-inline: 9px; }
}
@media (max-width: 760px) {
  :root { --pc-gutter: 13px; }
  .app-shell { display: block; }
  .sidebar { gap: 8px; padding: 9px; border-right: 0; border-bottom: 1px solid var(--pc-rule); }
  .app-shell .brand { font-size: 18px; }
  .team-picker { grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 0 5px; padding: 4px; }
  .team-picker:has(.text-button:not(.team-manage)) select { grid-column: 1 / -1; }
  .app-shell .team-picker .text-button { min-height: 39px; }
  .app-shell .team-picker .team-manage { justify-self: end; }
  .app-shell .main-nav { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 3px; }
  .workspace-nav-label { grid-column: 1 / -1; margin: 1px 0 0; padding: 3px 1px 0; }
  .app-shell .nav-button { justify-content: center; min-height: 40px; padding-inline: 3px; text-align: center; }
  .nav-button::before, .member-list { display: none; }
  .topbar { min-height: 51px; gap: 7px; padding-block: 5px; }
  .app-shell .view { padding-top: 18px; }
  .section-heading { margin-bottom: 13px; }
  .filter-row { flex-wrap: nowrap; overflow-x: auto; }
  .app-shell .filter-chip { flex: 0 0 auto; white-space: nowrap; }
  .welcome-layout { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 440px) {
  .app-shell .top-search { padding-inline: 8px; }
  .card-heading, .section-subhead { flex-wrap: wrap; }
  .app-shell .doc-row { gap: 6px; padding-inline: 6px; }
  .doc-row .pill { white-space: normal; }
  .modal-heading, .modal-content { padding-inline: 11px; }
  .search-filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .search-filters > :last-child { grid-column: 1 / -1; }
  .setup-detail { grid-template-columns: minmax(0, 1fr); gap: 2px; }
}
