/* Shared interaction rules; the canvas, typography and semantic colours stay Nexus's. */
:root { --motion-enter: 160ms; --motion-leave: 90ms; }
:where(button, a, summary, input, select, textarea, [tabindex], [role=tab], [role=option]):focus-visible { outline: 2px solid var(--ink) !important; outline-offset: 2px !important; }
:where(.page:not(.work-page), .messages, .work-side-list, .work-transcript, .work-settings-content, .work-sheet-body, .memory-scroll, .viewer-body, .command-results, .work-diff, .nx-table-scroll) { scrollbar-gutter: stable; overscroll-behavior: contain; }
.palette-trigger { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 32px; padding: 8px; text-align: left; }
.rail > .palette-trigger { margin: 0 0 16px; }
.menu-sheet .palette-trigger { margin-bottom: 8px; }
.rail-nav a { gap: 8px; }
.brand img, .pair img, .work-home img { aspect-ratio: 1; }
.panel-skeleton { display: inline-block; flex: none; width: 64px; height: 12px; border-radius: 4px; background: var(--raised); }
.loading:has(> .panel-skeleton), .memory-loading:has(> .panel-skeleton) { min-height: 128px; }
.work-busy:has(.panel-skeleton) { min-height: 48px; }
.work-side-loading span, .work-opening-lines span, .work-skeleton span, .nx .nx-shimmer, .nx .nx-shimmer-text, .nx-skeleton .nx-sk { background: var(--raised); animation: none; }
@keyframes nexus-enter { from { opacity: 0; transform: translateY(2px); } to { opacity: 1; transform: translateY(0); } }
/* No geometry or grid transition: only newly mounted content enters. */
.app-shell, .main, .work-workspace, .work-panes { transition: none; }
.work-side-head, .memory-bar, .work-top { border-bottom: 1px solid transparent; }
.work-sessions:has(.work-side-list[data-scrolled=true]) > .work-side-head,
.memory-sheet:has(.memory-scroll[data-scrolled=true]) > .memory-bar,
.work-session:has(.work-transcript[data-scrolled=true]) > .work-top { border-bottom-color: var(--hairline); }
.command-palette { width: min(640px, calc(100vw - 32px)); max-height: min(640px, calc(100dvh - 64px)); padding: 0; margin: min(16vh, 128px) auto auto; border: 1px solid var(--hairline); border-radius: var(--radius-panel); background: var(--surface); color: var(--ink); box-shadow: var(--shadow-2); overflow: hidden; }
.command-palette[open] { display: flex; flex-direction: column; }
.command-palette::backdrop, .shortcuts-sheet::backdrop { background: color-mix(in srgb, var(--ink) 18%, transparent); }
.command-input-row { display: flex; align-items: center; gap: 8px; padding: 16px; border-bottom: 1px solid var(--hairline); }
.command-input-row > svg { flex: none; color: var(--secondary); }
input.command-search { min-width: 0; flex: 1; width: 100%; padding: 8px; }
.command-results { min-height: 80px; overflow-y: auto; padding: 8px; }
.command-results h2 { padding: 8px; margin: 0; color: var(--tertiary); font: 550 11px/1.5 var(--font); text-transform: none; letter-spacing: 0; }
.command-row { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 8px; border-radius: var(--radius-small); cursor: pointer; }
.command-row > svg { flex: none; }
.command-row[aria-selected=true] { background: var(--fill); }
.command-copy { display: grid; gap: 2px; min-width: 0; flex: 1; }
.command-copy > span, .command-copy small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.command-copy small { color: var(--tertiary); font-size: 12px; }
.command-status, .command-footer, .command-empty { padding: 8px 16px; color: var(--secondary); font-size: 12px; }
.command-status { min-height: 32px; }
.command-footer { border-top: 1px solid var(--hairline); }
.shortcuts-sheet { width: min(400px, calc(100vw - 32px)); max-height: calc(100dvh - 48px); padding: 24px; border: 1px solid var(--hairline); border-radius: var(--radius-panel); background: var(--surface); color: var(--ink); }
.shortcuts-sheet header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.shortcuts-sheet h2 { margin: 0; color: var(--ink); text-transform: none; font-size: 16px; letter-spacing: 0; }
.shortcut-row { display: flex; justify-content: space-between; gap: 16px; padding: 8px 0; }
.shortcuts-sheet .key-hint { display: inline-block; }
input.work-side-filter { width: 100%; min-width: 0; height: 32px; padding: 0 8px; }
.work-search-all { display: flex; align-items: center; gap: 8px; width: 100%; padding: 4px 0; }
.work-session-row, .work-session-item { border-radius: var(--radius-small); }
.stat-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 0 0 24px; }
.stat-tile { display: flex; flex-direction: column; gap: 8px; min-width: 0; padding: 16px; border: 1px solid var(--hairline); border-radius: var(--radius-control); background: var(--surface); }
.stat-tile dt { color: var(--secondary); font-size: 12px; }
.stat-tile dd { margin: 0; color: var(--ink); font-size: 20px; line-height: 1.3; font-weight: 560; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.stat-tile small { font-size: 11px; color: var(--tertiary); overflow-wrap: anywhere; }
.schedule-table { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 12px; }
.schedule-table th, .schedule-table td { padding: 12px 8px; border-bottom: 1px solid var(--hairline); text-align: left; vertical-align: top; overflow-wrap: anywhere; }
.schedule-table th { font-weight: 500; }
.schedule-table thead { color: var(--tertiary); }
.schedule-table thead th:first-child { width: 28%; }
.schedule-table thead th:last-child { width: 72px; }
.schedule-table td { color: var(--secondary); }
@media (hover: hover) { .schedule-table tbody tr:not(.schedule-group):hover { background: var(--fill); } }
.schedule-group th { padding-top: 24px; color: var(--ink); font-weight: 600; border-bottom: 0; }
.schedule-actions .btn { padding: 0 8px; }
.automation-controls { margin-top: 24px; }
.automation-controls > summary { margin-bottom: 16px; }
.automation-controls .work-auto + .work-auto { margin-top: 24px; }
.reminders-sheet { width: min(960px, calc(100vw - 32px)); }
@media (max-width: 600px) {
  .command-palette { margin-top: 24px; max-height: calc(100dvh - 48px); }
  .stat-tile { padding: 8px; gap: 8px; }
  .stat-tile dt { font-size: 11px; }
  .stat-tile dd { font-size: 16px; }
  .stat-tile small { font-size: 10px; }
  .schedule-table, .schedule-table tbody { display: block; }
  .schedule-table thead { display: none; }
  .schedule-table tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; padding: 8px 0; border-bottom: 1px solid var(--hairline); }
  .schedule-table th, .schedule-table td { display: block; padding: 4px 0; border: 0; }
  .schedule-table th, .schedule-table td:not(.schedule-actions) { grid-column: 1; }
  .schedule-table td[data-label]::before { content: attr(data-label) ": "; color: var(--tertiary); }
  .schedule-table .schedule-actions { grid-column: 2; grid-row: 1 / span 4; padding-left: 8px; }
  .schedule-table .schedule-group { border: 0; padding-top: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
/* A thumbnail's reserved slot is the same before and after its bytes arrive. */
.thumbs.single .thumb, .thumbs.single .thumb.loading, .thumbs.single .thumb.broken { width: 240px; height: 180px; aspect-ratio: 4 / 3; }
.thumbs.single .thumb img { object-fit: contain; }
.thumb.loading { animation: none; background: var(--raised); }
@supports (transition-behavior: allow-discrete) {
  dialog { transition: opacity var(--ctl-leave) var(--ctl-ease), transform var(--ctl-leave) var(--ctl-ease), display var(--ctl-leave) allow-discrete, overlay var(--ctl-leave) allow-discrete; }
  dialog:not([open]) { opacity: 0; transform: scale(.98); }
}
@media (prefers-reduced-motion: reduce) { dialog { transition: none; } }
.main { position: relative; }
.route-loading { position: absolute; inset: 0; z-index: 10; display: flex; flex-direction: column; gap: 16px; padding: 32px; background: var(--canvas); color: var(--secondary); font-size: 13px; }
.route-loading .work-skeleton { width: min(520px, 100%); padding: 0; }
.empty-state .btn { margin-top: 16px; }
.topbar { border-bottom-color: transparent; }
.app-shell:has(.page[data-scrolled=true], .messages[data-scrolled=true]) > .topbar { border-bottom-color: var(--hairline); }

/* Navigation has one rhythm, including Reminders & watches. */
.rail-nav a.ctl-row, .menu-nav a.ctl-row, .reminders-entry.ctl-row {
  display: flex; align-items: center; gap: 8px; height: 32px; min-height: 32px;
  padding: 0 10px; font: 400 13.5px/20px var(--font); box-shadow: none;
}
.reminders-entry-icon { align-self: center; height: 16px; }
.reminders-entry-title { font: inherit; }
.rail-nav a.active { background: var(--fill); box-shadow: none; }
.work-session-row { min-height: 60px; padding-block: 13px; }
.work-session-item.selected { background: transparent; box-shadow: none; }
.work-side-label { letter-spacing: 0; }
.work-search-all { height: auto; white-space: normal; overflow-wrap: anywhere; text-align: left; }
.work-session-time-compact { display: none; }
@media (max-width: 719px) {
  .work-session-row { min-height: 60px; padding-block: 12px; }
  .work-session .work-eyebrow > :not(.work-session-time-compact) { display: none; }
  .work-session .work-eyebrow { font-size: 11px; white-space: nowrap; }
  .work-session-time-compact { display: inline; }
}

/* Search excerpts are text nodes, with quiet monochrome emphasis. */
.command-copy small.command-snippet { white-space: normal; overflow-wrap: anywhere; }
.command-snippet mark { background: #e5e5e5; color: inherit; }
.command-date { color: var(--tertiary); font-size: 11px; white-space: nowrap; margin-left: auto; }
.search-flash { animation: search-flash 1.2s ease-out 1; }
@keyframes search-flash { from { background-color: var(--fill); } to { background-color: transparent; } }
@media (prefers-reduced-motion: reduce) { .search-flash { animation: none; } }

.search-destination:focus-visible { outline: none !important; }
.command-context { color: var(--tertiary); font-weight: 400; }
.command-empty { min-height: 112px; display: grid; place-items: center; text-align: center; margin: 0; }
.command-copy small.command-snippet { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.work-nav-count { margin-left: auto; color: var(--secondary); font-size: 11px; font-variant-numeric: tabular-nums; }
.chat-work-group { margin-bottom: 12px; }
.chat-work-group .rail-head { margin-top: 10px; }
.chat-work-group .rail-head h4 { margin: 0; font-size: 11px; font-weight: 500; color: var(--secondary); }
.chat-work-group a.activity-open { text-decoration: none; color: inherit; }
.chat-work-group .activity-open > svg { flex: none; margin-top: 2px; }
.menu-activity-list { padding: 8px 0; border-top: 1px solid var(--hairline); max-height: 45dvh; overflow-y: auto; }
.menu-activity-list .rail-head { padding-inline: 10px; }

.chat-work-group .work-glyph { color: var(--secondary); }
.menu-activity-list .rail-head h3 { margin: 0; font: 550 11px/1.5 var(--font); color: var(--tertiary); text-transform: uppercase; letter-spacing: .06em; }
.topbar-menu .menu-sheet { max-height: calc(100dvh - 80px); overflow-y: auto; }

/* ---------- Settings, Connections, Files, Reminders, setup: one rhythm, nothing clipped ---------- */
/* A route that loads quickly swaps in place; the loading cover fades in only when loading is slow. */
.route-loading { animation: route-loading-in var(--ctl-enter) var(--ctl-ease) 220ms both; }
@keyframes route-loading-in { from { opacity: 0; } to { opacity: 1; } }
/* Models: the fallback line is a disclosure that wraps, not a one-line button clipped by its card. */
.model-advanced > summary.ctl-button { height: auto; min-height: 28px; padding: 4px 0; align-items: flex-start; justify-content: flex-start; white-space: normal; text-align: left; overflow-wrap: anywhere; line-height: 18px; }
.model-advanced > summary.ctl-button::before { flex: none; margin-top: 6px; }
.model-advanced > summary.ctl-button:hover { background: transparent; text-decoration: underline; text-underline-offset: 3px; }
/* Settings → Devices: Sign out stands apart from pairing. */
.device-signout { margin-top: 20px; }
/* The pronoun choice is labelled like the Name field above it. */
.owner-form .owner-pronouns-label { margin: 14px 0 6px; }
.owner-form > .actions-row { margin-top: 4px; }
.about-actions { margin-top: 12px; }
/* Connections: a name or an error is read in full; on a phone the controls go under it. */
.connection-row .title, .connection-row .sub { white-space: normal; overflow-wrap: anywhere; }
.connection-controls { display: flex; flex: none; align-items: center; gap: 12px; }
@media (max-width: 600px) {
  .connection-row { flex-wrap: wrap; align-items: flex-start; row-gap: 10px; }
  .connection-row > .grow { flex: 1 0 100%; }
}
code.copy { display: inline; box-decoration-break: clone; -webkit-box-decoration-break: clone; }
/* Phones: the reminders sheet is the same full-width bottom sheet as a memory; tiles never split a word. */
@media (max-width: 640px) { .reminders-sheet { width: 100%; } }
.stat-tile dd, .stat-tile small { overflow-wrap: break-word; }
/* The sheet's grid gap is the space between the tiles and the list; margins don't stack on it. */
.reminders-scroll > .stat-tiles { margin-bottom: 0; }
@media (max-width: 600px) { .schedule-table tbody:first-of-type > .schedule-group { padding-top: 0; } }
@media (max-width: 600px) {
  .stat-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat-tiles > :last-child:nth-child(odd) { grid-column: 1 / -1; }
}
/* Menu rows share the navigation's rhythm, so every label starts on the same line. */
.menu-sheet .menu-item.ctl-row { gap: 8px; min-height: 32px; padding: 6px 10px; font: 400 13.5px/20px var(--font); }
/* First run: every step starts at the same height, so moving on never makes the page jump. */
.personal-setup.center { place-items: start center; padding-top: clamp(24px, 10vh, 96px); }
/* Spaces: the full-screen control floats in the Space's top-right corner. As a shared button it was
   positioned in the flow, so every inline Space started with an invisible 32px row and the control
   appeared over the Space's title on the left. */
.space-inline > .space-expand.ctl-button.ctl-button { position: absolute; top: 0; right: 0; }
/* The toast as a top-layer popover keeps its own place and look (no popover box, inset or margin). */
/* Its place is app.css's (over the conversation, just above the composer): a fixed left: 50% and
   bottom here outranked it, so on a wide screen the toast sat over the side panel. */
#toast[popover] { inset: auto; left: var(--toast-x, 50%); bottom: calc(var(--toast-clear, 84px) + 12px); width: max-content; height: auto; margin: 0; border: 0; overflow: visible; }
body:has(.jump-latest:not([hidden])) #toast[popover] { bottom: calc(var(--toast-clear, 84px) + 62px); }
