:root {
  --pc-paper: #f6f4ee;
  --pc-surface: #fffefa;
  --pc-ink: #202421;
  --pc-muted: #666b64;
  --pc-line: #dedfd5;
  --pc-border: #a2a69b;
  --pc-accent: #c81500;
  --pc-accent-dark: #a20f00;
  --pc-accent-wash: #f8e8e2;
  --pc-sage: #e8ede5;
  --pc-green: #3a6447;
  --pc-warn: #745118;
  --pc-warn-wash: #f8efdc;
  --pc-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --pc-serif: Georgia, "Times New Roman", serif;
  --pc-mono: ui-monospace, "SFMono-Regular", Consolas, monospace;
  --pc-radius: 6px;
  --pc-gutter: clamp(24px, 4.3vw, 64px);
}

:where(body:has(> #app), body.dashboard-active) { margin: 0; }
:where(body:has(> #app), body.dashboard-active, .app-shell, .auth-page, .modal) {
  background: var(--pc-paper);
  color: var(--pc-ink);
  font: 14px/1.5 var(--pc-sans);
}

:where(.app-shell, .auth-page, .modal),
: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; }
:is(.app-shell, .auth-page, .modal) :is(h1, h2, h3, h4) {
  color: var(--pc-ink);
  font: 400 24px/1.18 var(--pc-serif);
  letter-spacing: -.025em;
  overflow-wrap: anywhere;
}

:is(.app-shell, .auth-page, .modal) p {
  color: inherit;
  font-size: inherit;
  line-height: inherit;
  overflow-wrap: anywhere;
}

:is(.app-shell, .auth-page, .modal) :is(button, input, textarea, select) { font: inherit; }
:is(.app-shell, .auth-page, .modal) button { cursor: pointer; }
:is(.app-shell, .auth-page, .modal) button:disabled { cursor: default; opacity: .65; }
:is(.app-shell, .auth-page, .modal) :is(button, a, select, input, textarea, summary):focus-visible,
.skip-link:focus-visible {
  outline: 2px solid var(--pc-accent);
  outline-offset: 3px;
}

:is(.app-shell, .auth-page, .modal) :is(code, pre, kbd) { 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; }

.skip-link {
  position: absolute;
  z-index: 20;
  top: -100px;
  left: 12px;
  padding: 10px 14px;
  border-radius: var(--pc-radius);
  background: var(--pc-surface);
  color: var(--pc-accent-dark);
  font: 650 14px/1.3 var(--pc-sans);
}
.skip-link:focus { top: 12px; }

:is(.app-shell, .auth-page, .modal) .eyebrow,
.workspace-nav-label,
.editor-label {
  color: var(--pc-muted);
  font: 600 11px/1.35 var(--pc-mono);
  letter-spacing: .075em;
  text-transform: uppercase;
}

:is(.app-shell, .auth-page, .modal) .muted { color: var(--pc-muted); }
:is(.app-shell, .auth-page, .modal) .fine-print,
.small-text {
  color: var(--pc-muted);
  font-size: 12px;
  line-height: 1.55;
}

/* Controls and status cues */
:is(.app-shell, .auth-page, .modal) .button,
:is(.app-shell, .auth-page, .modal) .icon-button,
.top-search {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
  min-height: 42px;
  padding: 9px 14px;
  border: 1px solid var(--pc-border);
  border-radius: var(--pc-radius);
  background: var(--pc-surface);
  color: var(--pc-ink);
  font: 650 13px/1.35 var(--pc-sans);
  text-align: center;
  overflow-wrap: anywhere;
}

:is(.app-shell, .auth-page, .modal) .button:hover:not(:disabled),
:is(.app-shell, .auth-page, .modal) .icon-button:hover:not(:disabled),
.top-search:hover { background: var(--pc-sage); border-color: var(--pc-muted); }

:is(.app-shell, .auth-page, .modal) .button.primary {
  width: auto;
  background: var(--pc-accent);
  border-color: var(--pc-accent);
  color: var(--pc-surface);
}

:is(.app-shell, .auth-page, .modal) .button.primary:hover:not(:disabled) {
  background: var(--pc-accent-dark);
  border-color: var(--pc-accent-dark);
}

:is(.app-shell, .auth-page, .modal) .button.danger { color: var(--pc-accent-dark); }
:is(.app-shell, .auth-page, .modal) .button.danger:hover:not(:disabled) { background: var(--pc-accent-wash); }
: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) .text-button,
:is(.app-shell, .auth-page, .modal) :is(.summary-link, .demo-link) {
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--pc-accent-dark);
  font: inherit;
  font-weight: 600;
  text-align: left;
  text-decoration: underline;
  text-underline-offset: .22em;
  text-decoration-thickness: 1px;
}

:is(.app-shell, .auth-page, .modal) .text-button { min-height: 40px; font-size: 13px; }
:is(.app-shell, .auth-page, .modal) :is(.text-button, .summary-link, .demo-link):hover {
  color: var(--pc-accent);
  text-decoration-thickness: 2px;
}

.pill {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  padding: 4px 7px;
  border-radius: 4px;
  background: var(--pc-paper);
  color: var(--pc-muted);
  font: 650 10px/1.3 var(--pc-mono);
  letter-spacing: .025em;
  white-space: nowrap;
}

.pill.live { background: var(--pc-sage); color: var(--pc-green); }
.pill.demo, .pill.warning { background: var(--pc-warn-wash); color: var(--pc-warn); }
.pill.purple { background: var(--pc-accent-wash); color: var(--pc-accent-dark); }
.status-dot {
  width: 7px;
  height: 7px;
  flex: 0 0 7px;
  border-radius: 50%;
  background: var(--pc-border);
}
.status-dot.online { background: var(--pc-green); }
.status-dot.demo, .status-dot.warning { background: #9b6e22; }

/* Workspace frame */
.app-shell {
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
  min-height: 100vh;
  min-width: 0;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 23px;
  min-width: 0;
  padding: 24px 18px 18px;
  border-right: 1px solid var(--pc-line);
  background: var(--pc-surface);
}

.app-shell .brand {
  display: flex;
  align-items: center;
  align-self: flex-start;
  gap: 9px;
  color: var(--pc-ink);
  font: 400 27px/1 var(--pc-serif);
  letter-spacing: -.06em;
  text-decoration: none;
}

.brand-mark {
  position: relative;
  display: inline-block;
  flex: 0 0 auto;
  width: 35px;
  height: 35px;
  color: var(--pc-accent);
  font-size: 0;
}

.brand-mark::before {
  position: absolute;
  top: 6px;
  left: 3px;
  width: 19px;
  height: 3px;
  border-radius: 1px;
  background: currentColor;
  box-shadow: 4px 5px currentColor, 0 10px currentColor, 7px 15px currentColor, 3px 20px currentColor;
  content: "";
}

.team-picker {
  display: grid;
  min-width: 0;
  grid-template-columns: minmax(0, 1fr);
  justify-items: start;
  gap: 2px;
  padding: 12px 0;
  border-block: 1px solid var(--pc-line);
}

.team-picker select {
  min-height: 40px;
  width: 100%;
  min-width: 0;
  padding: 4px 25px 4px 0;
  border: 0;
  background: var(--pc-surface);
  color: var(--pc-ink);
  font-weight: 650;
  text-overflow: ellipsis;
}

.app-shell .team-picker .text-button { min-height: 40px; }
.app-shell .team-picker .team-manage { color: var(--pc-muted); }
.app-shell .main-nav { display: grid; gap: 2px; min-width: 0; }
.workspace-nav-label { margin: 0; padding: 2px 9px 6px; }
.nav-button + .workspace-nav-label { margin-top: 12px; }

.app-shell .nav-button {
  display: flex;
  position: relative;
  align-items: center;
  gap: 11px;
  width: 100%;
  min-height: 40px;
  padding: 7px 10px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--pc-muted);
  font-size: 14px;
  font-weight: 550;
  text-align: left;
}

.nav-button::before {
  flex: 0 0 15px;
  width: 15px;
  content: "·";
  font: 14px/1 var(--pc-mono);
  text-align: center;
}
.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-paper); color: var(--pc-ink); }
.app-shell .nav-button:is(.active, [aria-current="page"]) {
  background: var(--pc-accent-wash);
  color: var(--pc-accent-dark);
  font-weight: 700;
}
.nav-button:is(.active, [aria-current="page"])::after {
  position: absolute;
  inset: 8px auto 8px 0;
  width: 2px;
  border-radius: 1px;
  background: var(--pc-accent);
  content: "";
}

.member-list { padding-top: 17px; border-top: 1px solid var(--pc-line); }
.member-row { display: flex; align-items: center; gap: 8px; margin-top: 12px; }
.app-shell .avatar {
  display: grid;
  flex: 0 0 30px;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--pc-sage);
  color: var(--pc-green);
  font: 650 13px/1 var(--pc-sans);
}
.member-copy { display: grid; min-width: 0; flex: 1; gap: 2px; overflow-wrap: anywhere; }
.member-copy strong { font-size: 13px; font-weight: 650; }
.member-copy span { color: var(--pc-muted); font-size: 12px; }

.sidebar-bottom {
  display: grid;
  justify-items: start;
  gap: 6px;
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--pc-line);
}
.local-status, .connection, .connection-line {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--pc-muted);
  font-size: 12px;
}

.main-column { min-width: 0; container-type: inline-size; }
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 66px;
  padding: 9px var(--pc-gutter);
  border-bottom: 1px solid var(--pc-line);
  background: var(--pc-surface);
}
.breadcrumb {
  min-width: 0;
  overflow: hidden;
  color: var(--pc-muted);
  font-size: 13px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.topbar-right { display: flex; flex: 0 0 auto; align-items: center; gap: 12px; min-width: 0; }
.app-shell .top-search { position: relative; flex: 0 0 auto; min-height: 40px; }
.app-shell .top-search::before {
  flex: 0 0 11px;
  width: 11px;
  height: 11px;
  border: 1.5px solid currentColor;
  border-radius: 50%;
  content: "";
}
.app-shell .top-search::after {
  position: absolute;
  top: calc(50% + 4px);
  left: 22px;
  width: 5px;
  height: 1.5px;
  transform: rotate(45deg);
  background: currentColor;
  content: "";
}
.top-search kbd { color: var(--pc-muted); font-size: 11px; }
.topbar-right .text-button { flex: 0 0 auto; white-space: nowrap; }

/* Common canvas and overview */
.app-shell .view {
  width: min(100%, 1440px);
  min-width: 0;
  margin: 0 auto;
  padding: clamp(26px, 3.6vw, 52px) var(--pc-gutter) 64px;
}

.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px 24px;
  margin-bottom: 28px;
  padding-bottom: 21px;
  border-bottom: 1px solid var(--pc-line);
}
.section-heading > div:first-child { min-width: 0; }
.app-shell .section-heading h1 {
  margin: 0 0 7px;
  font-size: clamp(39px, 4.4vw, 62px);
  letter-spacing: -.06em;
  line-height: 1.02;
}
.app-shell .section-heading p { max-width: 66ch; color: var(--pc-muted); font-size: 15px; }
.heading-actions, .toolbar-actions, .device-actions, .demo-actions, .readiness-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
}
.heading-actions { justify-content: flex-end; }

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

.workspace-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0 0 30px;
  border-block: 1px solid var(--pc-line);
  background: var(--pc-sage);
  color: var(--pc-muted);
}
.workspace-summary > span { padding: 11px 14px; font-size: 13px; }
.workspace-summary > span + span { border-left: 1px solid var(--pc-line); }
.workspace-summary strong { color: var(--pc-green); font: 650 16px/1.25 var(--pc-mono); }
.workspace-tools { margin-top: 27px; border-block: 1px solid var(--pc-line); }
.workspace-tools summary { padding: 10px 0; font-size: 13px; font-weight: 650; }
.workspace-tools .readiness.ready { margin: 0; padding: 5px 0 15px; }

.overview-card {
  min-width: 0;
  padding: 16px 0 2px;
  border-top: 2px solid var(--pc-line);
  overflow-wrap: anywhere;
}
.app-shell .overview-card > p + p { margin-top: 12px; }
.app-shell .overview-card > h2 { margin-bottom: 9px; }

.card-heading, .section-subhead {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px 14px;
  margin-bottom: 13px;
}
.card-heading > div { min-width: 0; }
.app-shell .card-heading p { margin-top: 4px; color: var(--pc-muted); font-size: 13px; }
.app-shell .view-overview .card-heading h2,
.app-shell .view-overview .section-subhead h2 { font-size: clamp(23px, 2.4vw, 33px); }

.overview-lines {
  min-width: 0;
  color: var(--pc-ink);
  font-size: 15px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}
.app-shell .overview-line { padding: 9px 0; border-bottom: 1px solid var(--pc-line); }
.app-shell .overview-line:first-child { padding-top: 2px; }
.app-shell .overview-line:last-child { border-bottom: 0; }
.app-shell .overview-empty { color: var(--pc-muted); }

.demo-guide, .readiness {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 22px;
  justify-content: space-between;
  min-width: 0;
  margin-bottom: 25px;
  padding: 16px 20px;
  border: 1px solid var(--pc-line);
  border-left: 3px solid var(--pc-green);
  border-radius: var(--pc-radius);
  background: var(--pc-surface);
}

.demo-guide { border-left-color: var(--pc-accent); }
.readiness.pending { background: var(--pc-warn-wash); border-left-color: #9b6e22; }
.readiness.ready {
  padding: 9px 0;
  margin-bottom: 12px;
  border: 0;
  background: transparent;
}
.app-shell .readiness.ready h2 { font: 650 14px/1.3 var(--pc-sans); letter-spacing: 0; }
.app-shell .readiness.ready .readiness-copy > p:not(.eyebrow) { color: var(--pc-muted); }
.readiness-copy, .demo-guide > div:first-child { min-width: 0; flex: 1 1 285px; }
.app-shell :is(.demo-guide, .readiness) h2 { margin: 4px 0 6px; }
.app-shell .demo-guide p + p { margin-top: 7px; }
.app-shell .fingerprint-inline { flex: 1 0 100%; color: var(--pc-warn); font: 12px/1.5 var(--pc-mono); }
.connection-line { margin: 0 0 22px; }
.app-shell .inline-note { margin-bottom: 18px; }
.recent-section { margin-top: 32px; }

.message {
  margin: 14px 0;
  padding: 10px 13px;
  border: 1px solid var(--pc-line);
  border-left-width: 3px;
  border-radius: var(--pc-radius);
  background: var(--pc-surface);
  overflow-wrap: anywhere;
}
.main-column > .message { margin: 12px var(--pc-gutter) 0; }
:is(.app-shell, .auth-page, .modal) .message.error {
  border-color: #d9a29a;
  background: var(--pc-accent-wash);
  color: var(--pc-accent-dark);
}
:is(.app-shell, .auth-page, .modal) .message.success {
  display: block;
  border-color: #a4b8a4;
  background: var(--pc-sage);
  color: var(--pc-green);
}
:is(.app-shell, .auth-page, .modal) .message.warning {
  border-color: #c9b68e;
  background: var(--pc-warn-wash);
  color: var(--pc-warn);
}
.message ul { margin: 8px 0 0; padding-left: 18px; }
.app-shell .error-text { color: var(--pc-accent-dark); }

/* Documents, filters and reading */
.doc-list { min-width: 0; border-top: 1px solid var(--pc-line); }
.doc-list:has(> .empty-inline) { border-top: 0; }
.app-shell .doc-row {
  display: flex;
  align-items: center;
  gap: 9px 12px;
  width: 100%;
  min-width: 0;
  min-height: 60px;
  padding: 10px 9px;
  border: 0;
  border-bottom: 1px solid var(--pc-line);
  background: transparent;
  color: var(--pc-ink);
  text-align: left;
}
.app-shell .doc-row:hover { background: var(--pc-surface); }
.app-shell .doc-row.selected { background: var(--pc-accent-wash); }
.doc-icon, .device-symbol {
  display: grid;
  flex: 0 0 29px;
  width: 29px;
  height: 29px;
  place-items: center;
  border-radius: 4px;
  background: var(--pc-sage);
  color: var(--pc-green);
  font: 14px/1 var(--pc-mono);
}
.doc-row.selected .doc-icon { background: transparent; color: var(--pc-accent-dark); }
.doc-row-copy { display: grid; min-width: 0; flex: 1; gap: 3px; overflow-wrap: anywhere; }
.doc-row-copy strong { font-size: 15px; font-weight: 650; }
.doc-row-copy > :not(strong) { color: var(--pc-muted); font-size: 12px; }
.doc-row :is(time, .doc-date, .document-date) { color: var(--pc-muted); font: 11px/1.4 var(--pc-mono); }
.doc-row .pill.neutral { background: transparent; border: 1px solid var(--pc-line); }

.empty-inline, .empty-state {
  padding: 18px;
  border: 1px dashed var(--pc-border);
  border-radius: var(--pc-radius);
}
:is(.app-shell, .auth-page, .modal) :is(.empty-inline, .empty-state) { 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: 6px; margin: 0 0 18px; }
.app-shell .filter-chip {
  min-height: 40px;
  padding: 6px 10px;
  border: 1px solid var(--pc-border);
  border-radius: var(--pc-radius);
  background: transparent;
  color: var(--pc-muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}
.app-shell .filter-chip:hover { background: var(--pc-surface); color: var(--pc-ink); }
.app-shell .filter-chip:is(.active, [aria-pressed="true"]) {
  border-color: var(--pc-accent);
  background: var(--pc-accent-wash);
  color: var(--pc-accent-dark);
  font-weight: 650;
}

.library-layout { display: flex; flex-direction: column; min-width: 0; gap: 20px; }
.library-layout > .editor-panel { margin: 0; }
.editor-panel {
  min-width: 0;
  margin-bottom: 22px;
  border: 1px solid var(--pc-line);
  border-radius: var(--pc-radius);
  background: var(--pc-surface);
  scroll-margin-top: 12px;
}
.editor-panel:focus-visible { outline: 2px solid var(--pc-accent); outline-offset: 3px; }

.editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px 18px;
  min-width: 0;
  padding: 20px clamp(14px, 3vw, 30px);
  border-bottom: 1px solid var(--pc-line);
}

.editor-toolbar > :first-child { flex: 1 1 230px; min-width: 0; }
.app-shell .editor-toolbar h2 {
  margin: 0 0 6px;
  font-size: clamp(28px, 3vw, 40px);
  letter-spacing: -.045em;
  overflow-wrap: anywhere;
}
.app-shell .document-context {
  margin-bottom: 6px;
  color: var(--pc-muted);
  font: 12px/1.5 var(--pc-mono);
}
:is(.app-shell, .modal) .path-label {
  color: var(--pc-muted);
  font: 12px/1.5 var(--pc-mono);
  overflow-wrap: anywhere;
}
.app-shell .note-close { border-color: var(--pc-line); 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(15px, 3vw, 30px); }
.preview-wrap { border-left: 1px solid var(--pc-line); background: #fafaf5; }
.reading-wrap { max-width: 78ch; margin: 0 auto; }

.editor-label { margin-bottom: 13px; }
.app-shell .editor {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 320px;
  padding: 12px;
  border: 1px solid var(--pc-border);
  border-radius: var(--pc-radius);
  background: var(--pc-surface);
  color: var(--pc-ink);
  font: 13px/1.65 var(--pc-mono);
  resize: vertical;
}
.rendered-markdown { color: var(--pc-ink); font: 16px/1.7 var(--pc-sans); overflow-wrap: anywhere; }
.app-shell .rendered-markdown :is(h1, h2, h3, h4) { margin: 22px 0 9px; }
.app-shell .rendered-markdown > :first-child { margin-top: 0; }
.app-shell .rendered-markdown h1 { font-size: 28px; }
.app-shell .rendered-markdown h2 { font-size: 24px; }
.app-shell .rendered-markdown :is(h3, h4) { font-size: 19px; }
.app-shell .rendered-markdown p { margin: 0 0 12px; }
.app-shell .rendered-markdown :is(ul, ol) { margin: 0 0 14px; 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-green);
  vertical-align: -.08em;
}
.app-shell .rendered-markdown code { padding: 1px 4px; border-radius: 4px; background: var(--pc-sage); font-size: .88em; }
.rendered-markdown :is(pre, table) { display: block; max-width: 100%; overflow: auto; }
.source-details { margin-top: 22px; padding-top: 12px; border-top: 1px solid var(--pc-line); }
.source-details summary { min-height: 32px; color: var(--pc-muted); font-size: 13px; }
.source-details pre, .branch pre, .branch-draft pre, .draft-content {
  margin: 9px 0 0;
  padding: 12px;
  border-radius: var(--pc-radius);
  background: var(--pc-paper);
  color: var(--pc-ink);
  font: 12px/1.65 var(--pc-mono);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.conflict-box {
  margin: 14px;
  padding: 14px;
  border: 1px solid #c9b68e;
  border-radius: var(--pc-radius);
  background: var(--pc-warn-wash);
}
.conflict-heading strong { color: var(--pc-warn); }
.app-shell .conflict-heading p { margin-top: 4px; }
.branch, .branch-draft {
  margin: 10px 0;
  padding: 9px;
  border: 1px solid var(--pc-line);
  border-radius: var(--pc-radius);
  background: var(--pc-surface);
}
.branch summary { font-size: 13px; overflow-wrap: anywhere; }
.branch pre, .branch-draft pre { max-height: 300px; }
.conflict-box > .button { margin: 4px 8px 0 0; }
.draft-content { min-height: 100px; max-height: min(50dvh, 480px); margin: 0; border: 1px solid var(--pc-line); }

/* People, devices, setup and access */
.device-list { margin: 28px 0; min-width: 0; }
.device-list > .muted { margin-bottom: 14px; }
.device-row {
  display: flex;
  align-items: center;
  gap: 8px 13px;
  min-width: 0;
  padding: 13px 4px;
  border-top: 1px solid var(--pc-line);
}
.device-row:last-child { border-bottom: 1px solid var(--pc-line); }
.device-details { display: grid; flex: 1; gap: 3px; min-width: 0; overflow-wrap: anywhere; }
.device-details strong { font-size: 15px; font-weight: 650; }
.device-details span { color: var(--pc-muted); font-size: 13px; }
.device-details code { color: var(--pc-muted); font-size: 12px; }

.fingerprint-card, .recovery-card, .setup-card {
  min-width: 0;
  margin-bottom: 16px;
  padding: 16px 18px;
  border: 1px solid var(--pc-line);
  border-radius: var(--pc-radius);
  background: var(--pc-surface);
}
.fingerprint-card, .recovery-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 17px;
}
.fingerprint-card > div, .recovery-card > div { flex: 1 1 230px; min-width: 0; }
.app-shell :is(.fingerprint-card, .recovery-card) h2 { margin-bottom: 5px; }
.app-shell :is(.fingerprint-card, .setup-card) .eyebrow { margin-bottom: 5px; }
.setup-card { display: grid; justify-items: start; align-content: start; gap: 12px; }
.setup-card :is(.field, details) { width: 100%; }
.setup-card details .fine-print { margin: 7px 0; }
.app-shell .setup-card h2 + p { margin-top: 5px; }
.main-column > [data-pending-invitation] { margin: 16px var(--pc-gutter) 0; }

.setup-detail {
  display: grid;
  grid-template-columns: minmax(0, 132px) minmax(0, 1fr);
  gap: 12px;
  padding: 8px 0;
  border-top: 1px solid var(--pc-line);
}
.setup-detail code { overflow-wrap: anywhere; }
.local-setup-details .fine-print { margin-top: 12px; }

.stack { display: grid; gap: 12px; min-width: 0; }
:is(.app-shell, .auth-page, .modal) .field {
  display: grid;
  gap: 5px;
  min-width: 0;
  margin: 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: 9px 10px;
  border: 1px solid var(--pc-border);
  border-radius: var(--pc-radius);
  background: var(--pc-surface);
  color: var(--pc-ink);
  font: 400 16px/1.4 var(--pc-sans);
}
:is(.app-shell, .modal) .invite-code { min-height: 90px; 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; }

.auth-page { min-height: 100vh; padding: clamp(32px, 6vw, 80px) var(--pc-gutter) 32px; }
.welcome-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.18fr) minmax(0, 1fr);
  gap: 26px clamp(26px, 7vw, 96px);
  width: min(100%, 1040px);
  margin: 0 auto;
}
.welcome-intro { padding: 14px 0; }
.welcome-intro .brand-mark { margin-bottom: 20px; }
.auth-page .welcome-intro h1 {
  margin: 8px 0 13px;
  font-size: clamp(49px, 7.5vw, 94px);
  letter-spacing: -.075em;
  line-height: 1;
}
.auth-page .welcome-lede { max-width: 35ch; margin-bottom: 12px; font: 400 clamp(21px, 2.5vw, 30px)/1.3 var(--pc-serif); }
.welcome-intro .muted { max-width: 48ch; }
.auth-card {
  align-self: start;
  min-width: 0;
  padding: clamp(18px, 3vw, 28px);
  border: 1px solid var(--pc-line);
  border-top: 3px solid var(--pc-accent);
  border-radius: var(--pc-radius);
  background: var(--pc-surface);
}
.auth-page .auth-card h2 { margin: 7px 0; font-size: 28px; }
.auth-page .auth-card > .muted { margin-bottom: 17px; }
.auth-options, .welcome-secondary, .welcome-recovery { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.auth-options { margin-top: 10px; }
.welcome-divider { margin: 15px 0; border-top: 1px solid var(--pc-line); }
.welcome-secondary .fine-print { flex: 1 1 120px; }

.install-steps {
  grid-column: 1 / -1;
  min-width: 0;
  padding: 20px 0 0;
  border-top: 1px solid var(--pc-line);
}
.auth-page .install-steps h2 { margin: 5px 0 7px; }
.command-block {
  margin: 12px 0 8px;
  padding: 12px 15px;
  border-radius: var(--pc-radius);
  background: var(--pc-ink);
  color: var(--pc-surface);
  font: 13px/1.65 var(--pc-mono);
}
.welcome-recovery { width: min(100%, 1040px); margin: 12px auto 0; }

/* Native dialogs and search */
.modal {
  width: min(560px, calc(100% - 28px));
  max-width: none;
  max-height: min(88vh, 760px);
  max-height: min(88dvh, 760px);
  padding: 0;
  border: 1px solid var(--pc-line);
  border-radius: 8px;
  background: var(--pc-surface);
  box-shadow: 0 16px 55px #20242133;
}
.modal::backdrop { background: #20242175; }
.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: 12px;
  padding: 13px 18px;
  border-bottom: 1px solid var(--pc-line);
  background: var(--pc-surface);
}
.modal-heading .icon-button { flex: 0 0 auto; }
.modal-content { display: grid; gap: 14px; min-width: 0; padding: 18px; }
.modal .modal-content h3 { font-size: 20px; }
.modal-content > form + form { padding-top: 16px; border-top: 1px solid var(--pc-line); }
.modal .message { margin: 0; }
.modal-content ol { margin: 0; padding-left: 21px; }

.search-modal { width: min(700px, calc(100% - 28px)); }
.search-form { display: grid; gap: 9px; min-width: 0; }
.search-input-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.search-filters { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.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-top: 1px solid var(--pc-line); }
.result-row {
  display: grid;
  gap: 4px;
  width: 100%;
  min-width: 0;
  padding: 11px 8px;
  border: 0;
  border-bottom: 1px solid var(--pc-line);
  background: transparent;
  color: var(--pc-ink);
  text-align: left;
  overflow-wrap: anywhere;
}
.result-row:hover { background: var(--pc-sage); }
.result-row:focus-visible { outline-offset: -2px; }
.result-path { color: var(--pc-muted); font: 11px/1.45 var(--pc-mono); }
.result-excerpt { font-size: 13px; }

/* The portal enables this sheet for its hosted workspace and browser 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: 930px) {
  .library-layout:has(.reading-wrap) {
    display: grid;
    grid-template-columns: minmax(240px, .85fr) minmax(0, 1.9fr);
    align-items: start;
  }
  .library-layout:has(.reading-wrap) > .editor-panel { grid-column: 2; grid-row: 1; }
  .library-layout:has(.reading-wrap) > .doc-list { grid-column: 1; grid-row: 1; }
}

@container (max-width: 920px) {
  .topbar .connection { display: none; }
}
@container (max-width: 700px) {
  .editor-grid { grid-template-columns: minmax(0, 1fr); }
  .preview-wrap { border-top: 1px solid var(--pc-line); border-left: 0; }
  .section-heading { align-items: flex-start; flex-direction: column; }
  .heading-actions { justify-content: flex-start; }
  .topbar-right { gap: 8px; }
}
@container (max-width: 500px) {
  .topbar-right .pill, .top-search kbd { display: none; }
  .two-column { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .toolbar-actions .pill { padding-inline: 4px; }
  .device-row { flex-wrap: wrap; align-items: flex-start; }
  .device-details { flex-basis: calc(100% - 50px); }
  .device-row > :is(.button, .device-actions, .pill) { margin-left: 42px; }
  .doc-row :is(time, .doc-date, .document-date) { white-space: normal; }
  .workspace-summary > span { display: grid; padding: 9px 8px; text-align: center; }
}

@media (min-width: 761px) {
  :is(#app, #hosted-dashboard) .sidebar {
    position: sticky;
    top: 0;
    align-self: start;
    height: 100vh;
    height: 100dvh;
    overflow: auto;
  }
}

@media (max-width: 1000px) {
  .app-shell { grid-template-columns: 206px minmax(0, 1fr); }
  .sidebar { padding-inline: 13px; }
  .workspace-nav-label { padding-inline: 7px; }
}

@media (max-width: 760px) {
  :root { --pc-gutter: 16px; }
  .app-shell { display: block; }
  .sidebar { gap: 10px; padding: 10px 12px 8px; border: 0; border-bottom: 1px solid var(--pc-line); }
  .app-shell .brand { font-size: 24px; }
  .team-picker { grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 1px 8px; padding: 4px 0; }
  .team-picker .eyebrow { grid-column: 1 / -1; }
  .team-picker:has(.text-button:not(.team-manage)) select { grid-column: 1 / -1; }
  .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; padding: 6px 2px 2px; }
  .nav-button + .workspace-nav-label { margin-top: 0; }
  .app-shell .nav-button { justify-content: center; width: 100%; padding: 5px 3px; font-size: 13px; text-align: center; }
  .nav-button::before { display: none; }
  .member-list, .sidebar-bottom { display: none; }
  .topbar { min-height: 55px; gap: 7px; padding-block: 7px; }
  .app-shell .view { padding-top: 24px; }
  .section-heading { margin-bottom: 22px; padding-bottom: 16px; }
  .welcome-layout { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 440px) {
  .app-shell .top-search { padding-inline: 8px; }
  .app-shell .top-search::before, .app-shell .top-search::after { display: none; }
  .demo-guide, .readiness, .fingerprint-card, .recovery-card, .setup-card { padding-inline: 13px; }
  .card-heading, .section-subhead { flex-wrap: wrap; }
  .app-shell .doc-row { gap: 8px; padding-inline: 4px; }
  .app-shell .doc-row-copy strong { font-size: 14px; }
  .app-shell .doc-row .pill { white-space: normal; }
  .modal .modal-heading, .modal-content { padding-inline: 12px; }
  .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: 3px; }
}
