/* Profile and Searches pages. Tokens live in tokens.css, shared motion in
   motion.css. Desktop: a sticky section rail beside one column of cards.
   Tablet and phone: the rail becomes a sticky strip and cards stack. */

/* ── Page shell ─────────────────────────────────────────────────── */
/* A page scrolls the document, so Back, find-in-page and mobile browser
   chrome behave as they do on any page. */
#app:is([data-view="profile"], [data-view="searches"]) {
  height: auto;
  min-height: 100vh;
  min-height: 100dvh;
}
.page {
  width: 100%;
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 0 128px;
}
.page-head {
  padding: 28px 0 28px;
}
.page-head h1 {
  font-size: var(--text-heading);
  line-height: 1.15;
  font-weight: 600;
  letter-spacing: var(--tracking-display);
}
.page-head h1:focus,
.pcard-title h2:focus {
  outline: none;
}
.page-head h1:focus-visible,
.pcard-title h2:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 4px;
  border-radius: var(--radius-small);
}
.page-lead {
  max-width: 62ch;
  margin-top: 8px;
  color: var(--muted);
  font-size: var(--text-body);
  line-height: 1.5;
}
.page-autosave {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
  color: var(--muted);
  font-size: var(--text-caption);
  font-weight: 500;
}
.page-autosave svg {
  width: 14px;
  height: 14px;
}
.page-grid {
  display: grid;
  grid-template-columns: 196px minmax(0, 1fr);
  align-items: start;
  gap: 32px;
}

/* ── Section rail ───────────────────────────────────────────────── */
.page-rail {
  position: sticky;
  top: 84px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.page-rail a {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 36px;
  padding: 0 12px;
  border-radius: var(--radius-control);
  color: var(--muted);
  font-size: var(--text-meta);
  font-weight: 500;
  text-decoration: none;
  transition:
    background-color var(--duration-quick) var(--ease-smooth-out),
    color var(--duration-quick) var(--ease-smooth-out),
    box-shadow var(--duration-quick) var(--ease-smooth-out);
}
.page-rail a svg {
  width: 16px;
  height: 16px;
}
.page-rail a:not([aria-current]) svg {
  color: var(--faint) !important;
  transition: color var(--duration-quick) var(--ease-smooth-out);
}
.page-rail a:hover {
  background: var(--overlay-hover);
  color: var(--ink);
}
.page-rail a[aria-current] {
  background: var(--paper);
  color: var(--ink);
  box-shadow:
    0 0 0 1px rgb(0 0 0 / 0.05),
    0 1px 2px rgb(0 0 0 / 0.06);
}
.rail-count {
  margin-left: auto;
  min-width: 20px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--fill);
  color: var(--ink-2);
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

/* ── Cards ──────────────────────────────────────────────────────── */
.page-cards {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
}
.pcard {
  padding: 24px;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-card);
  background: var(--paper);
  box-shadow: var(--shadow-card);
  scroll-margin-top: 84px;
}
.pcard-head {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  align-items: start;
  gap: 12px;
  margin-bottom: 22px;
}
.pcard-icon {
  display: grid;
  place-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-nested);
  background: var(--surface-alt);
  box-shadow: inset 0 0 0 1px var(--hairline);
}
.pcard-icon svg {
  width: 16px;
  height: 16px;
}
.pcard-title h2 {
  font-size: var(--text-body-lg);
  line-height: 1.3;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.pcard-title p {
  margin-top: 3px;
  color: var(--muted);
  font-size: var(--text-meta);
  line-height: 1.45;
}
.pcard-meta {
  padding-top: 2px;
  color: var(--muted);
  font-size: var(--text-caption);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.pcard-body {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
}

/* ── Fields ─────────────────────────────────────────────────────── */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.field-top {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 18px;
}
.field-top label,
.field-label,
.depth-copy label,
.secret label {
  display: inline;
  color: var(--ink-2);
  font-size: var(--text-meta);
  font-weight: 500;
}
.field-required {
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--fill);
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
}
.field-stamp {
  margin-left: auto;
  color: var(--muted);
  font-size: var(--text-caption);
  font-variant-numeric: tabular-nums;
}
:where(
  .page .field input:not([type="file"]),
  .page .field textarea,
  .page .qa textarea,
  .page .search-row input,
  .page .key-create input,
  .page .input-action input
) {
  width: 100%;
  min-height: var(--control-h);
  padding: 7px 14px;
  border: 1px solid transparent;
  border-radius: var(--radius-control);
  background-color: var(--fill);
  color: var(--ink);
  font-size: var(--text-body);
  font-weight: 400;
  line-height: 1.43;
  transition:
    background-color var(--duration-quick) var(--ease-smooth-out),
    border-color var(--duration-quick) var(--ease-smooth-out),
    box-shadow var(--duration-quick) var(--ease-smooth-out);
}
:where(.page .field textarea, .page .qa textarea) {
  display: block;
  max-height: 520px;
  padding: 9px 14px;
  line-height: 1.5;
  /* Textareas grow with their text, so there is no handle to drag. */
  resize: none;
  overflow-y: auto;
}
:where(
    .page .field input:not([type="file"]),
    .page .field textarea,
    .page .qa textarea,
    .page .search-row input,
    .page .key-create input,
    .page .input-action input
  ):hover:not(:focus):not(:disabled) {
  background-color: var(--fill-hover);
}
:where(
  .page .field input:not([type="file"]),
  .page .field textarea,
  .page .qa textarea,
  .page .search-row input,
  .page .key-create input,
  .page .input-action input
):focus {
  outline: none;
  border-color: var(--hairline-strong);
  background-color: var(--paper);
  box-shadow: var(--ring);
}
.page input:disabled,
.page textarea:disabled {
  opacity: 0.5;
}
.page input[readonly] {
  color: var(--ink-2);
}
.page input[type="number"] {
  font-variant-numeric: tabular-nums;
}
.field-hint {
  color: var(--muted);
  font-size: var(--text-caption);
  line-height: 1.45;
}
.field-error {
  color: var(--ember);
  font-size: var(--text-caption);
  font-weight: 500;
  line-height: 1.4;
}
.field-error:empty {
  display: none;
}
:is(.field, [data-report]).is-invalid :is(input:not([type="file"]), textarea),
.page .t-input.is-error {
  border-color: var(--ember) !important;
}
:is(.field, [data-report]).is-invalid :is(input, textarea):focus {
  box-shadow: 0 0 0 3px rgb(231 0 11 / 0.12);
}
.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.field-grid > .is-wide {
  grid-column: 1 / -1;
}
.field-group + .field-group {
  padding-top: 20px;
  border-top: 1px solid var(--hairline);
}
.group-label {
  margin-bottom: 12px;
  color: var(--muted);
  font-size: var(--text-caption);
  font-weight: 500;
  letter-spacing: var(--tracking-caption);
  text-transform: uppercase;
}
.field-group > .field-hint {
  margin: -6px 0 10px;
}

/* Quiet notes inside a card: neutral surface, colour on the glyph only. */
.inline-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--hairline);
  border-radius: 14px;
  background: var(--surface-alt);
  color: var(--ink-2);
  font-size: var(--text-meta);
  line-height: 1.45;
}
.inline-note svg {
  width: 16px;
  height: 16px;
  margin-top: 1px;
  color: var(--muted);
}
.inline-note.is-warning svg {
  color: var(--icon-amber);
}
.inline-note a {
  color: var(--ink);
  font-weight: 500;
}
.empty-line {
  padding: 16px;
  border: 1px dashed var(--hairline-strong);
  border-radius: var(--radius-control);
  color: var(--muted);
  font-size: var(--text-meta);
  line-height: 1.5;
  text-align: center;
}

/* ── Buttons ────────────────────────────────────────────────────── */
.ghost-button,
.add-row,
.dock-button,
.icon-button,
.stepper-button {
  -webkit-tap-highlight-color: transparent;
  transition:
    background-color var(--duration-quick) var(--ease-smooth-out),
    border-color var(--duration-quick) var(--ease-smooth-out),
    color var(--duration-quick) var(--ease-smooth-out),
    transform var(--duration-quick) var(--ease-smooth-out);
}
.ghost-button {
  position: relative;
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex: none;
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-control);
  background: var(--paper);
  color: var(--ink);
  font-size: var(--text-meta);
  font-weight: 500;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}
.ghost-button svg {
  width: 14px;
  height: 14px;
}
.ghost-button:hover {
  background: var(--fill);
}
.add-row {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  align-self: flex-start;
  height: 34px;
  padding: 0 14px;
  border: 1px dashed var(--hairline-strong);
  border-radius: var(--radius-control);
  background: transparent;
  color: var(--ink-2);
  font-size: var(--text-meta);
  font-weight: 500;
}
.add-row svg {
  width: 14px;
  height: 14px;
}
.add-row:hover:not(:disabled) {
  border-color: var(--muted);
  background: var(--overlay-hover);
  color: var(--ink);
}
.add-row:disabled {
  opacity: 0.45;
}
.icon-button {
  display: inline-grid;
  place-content: center;
  flex: none;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
}
.icon-button svg {
  width: 16px;
  height: 16px;
}
.icon-button:hover:not(:disabled) {
  background: var(--overlay-hover);
  color: var(--ink);
}
[data-remove-answer]:hover:not(:disabled),
[data-remove-search]:hover:not(:disabled) {
  background: var(--ember-wash);
  color: var(--ember);
}
.ghost-button:active,
.add-row:active:not(:disabled),
.dock-button:active:not(:disabled),
.icon-button:active:not(:disabled),
.stepper-button:active:not(:disabled) {
  transform: scale(var(--scale-medium));
}
.danger-text {
  align-self: flex-start;
  text-decoration: none;
}
.danger-text svg {
  width: 14px;
  height: 14px;
}
.danger-text:hover:not(:disabled) {
  color: var(--ember);
}

/* ── Résumé file ────────────────────────────────────────────────── */
.file-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 10px 10px 12px;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-control);
  background: var(--surface-alt);
}
.file-icon {
  display: inline-grid;
  place-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--paper);
  box-shadow: inset 0 0 0 1px var(--hairline);
  color: var(--ink-2);
}
.file-icon .t-icon {
  display: grid;
  place-content: center;
}
.file-icon [data-icon="b"] svg {
  color: var(--positive);
}
.file-copy {
  display: flex;
  flex-direction: column;
  gap: 1px;
  flex: 1;
  min-width: 0;
}
.file-copy strong {
  overflow: hidden;
  font-size: var(--text-meta);
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.file-copy small {
  overflow: hidden;
  color: var(--muted);
  font-size: var(--text-caption);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.file-pick {
  overflow: hidden;
}
.file-pick input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}
.file-pick:focus-within {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}
.file-row[data-state="uploading"] .file-pick,
.file-row[data-state="uploading"] #pf-file-download {
  opacity: 0.45;
  pointer-events: none;
}
.file-error {
  margin-top: -10px;
}

/* ── Roles ──────────────────────────────────────────────────────── */
.roles {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.roles[data-empty="true"]::before {
  content: "No roles yet. Add the ones you want forms to be filled with.";
  padding: 14px 16px;
  border: 1px dashed var(--hairline-strong);
  border-radius: var(--radius-control);
  color: var(--muted);
  font-size: var(--text-meta);
  text-align: center;
}
.role {
  border: 1px solid var(--hairline);
  border-radius: var(--radius-control);
  background: var(--paper);
  transition: border-color var(--duration-quick) var(--ease-smooth-out);
}
.role[data-open="true"] {
  border-color: var(--hairline-strong);
}
.role-head {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 52px;
  padding: 8px 14px 8px 10px;
  border: 0;
  border-radius: var(--radius-control);
  background: transparent;
  color: var(--ink);
  text-align: left;
}
.role-head:hover {
  background: var(--surface-alt);
}
.role-mark {
  display: grid;
  place-content: center;
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-nested);
  background: var(--surface-alt);
  box-shadow: inset 0 0 0 1px var(--hairline);
  color: var(--muted);
}
.role-mark svg {
  width: 15px;
  height: 15px;
}
.role-summary {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
}
.role-title,
.role-sub {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.role-title {
  font-size: var(--text-body);
  font-weight: 500;
}
.role-sub {
  color: var(--muted);
  font-size: var(--text-caption);
}
.t-acc-chevron {
  color: var(--muted);
}
.t-acc-chevron svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.role-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 6px 14px 16px;
}
.field.role-dates {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

/* Toggle look: a 36×20 track, ink when on. */
.toggle-row {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.toggle-row label {
  display: inline;
  color: var(--ink-2);
  font-size: var(--text-meta);
  font-weight: 500;
  cursor: pointer;
}
.t-toggle {
  --toggle-travel: 16px;
  position: relative;
  display: inline-flex;
  align-items: center;
  flex: none;
  width: 36px;
  height: 20px;
  padding: 2px;
  border: 0;
  border-radius: 999px;
  background: var(--fill-strong);
}
.t-toggle[data-on="true"] {
  background: var(--ink-soft);
}
.t-toggle-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--paper);
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.2);
}

/* ── Saved answers ──────────────────────────────────────────────── */
.answer-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.answer-tabs .t-tab,
.segmented .t-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: var(--text-meta);
  font-weight: 500;
  white-space: nowrap;
}
.answer-tabs .t-tabs-pill,
.segmented .t-tabs-pill {
  box-shadow:
    0 0 0 1px rgb(0 0 0 / 0.04),
    0 1px 2px rgb(0 0 0 / 0.08);
}
.t-tab[aria-checked="true"] {
  color: var(--tabs-text-active);
}
.tab-count {
  min-width: 18px;
  padding: 0 6px;
  border-radius: 999px;
  background: rgb(0 0 0 / 0.05);
  color: var(--ink-2);
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 18px;
  text-align: center;
}
.answer-filter {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border-radius: var(--radius-control);
  background: var(--fill);
  color: var(--muted);
}
.answer-filter svg {
  width: 14px;
  height: 14px;
}
.answer-filter input {
  width: 150px;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--ink);
  font-size: var(--text-meta);
}
.answer-panel,
.qa-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.qa {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 12px 12px 14px;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-control);
  background: var(--paper);
}
.qa.is-waiting {
  background: var(--surface-alt);
}
.qa-question {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}
/* The question reads as the card's title and edits in place. */
.qa .qa-title {
  flex: 1;
  min-width: 0;
  min-height: 0;
  margin: -1px 0 -1px -9px;
  padding: 2px 8px;
  border-radius: 8px;
  background-color: transparent;
  font-size: var(--text-body);
  font-weight: 500;
  line-height: 1.45;
}
.qa .qa-title:hover:not(:focus):not(:disabled) {
  background-color: var(--fill);
}
.qa .qa-title:focus {
  background-color: var(--paper);
}
/* Only the field with the problem turns red, not its neighbour. */
.qa.is-invalid textarea:not([aria-invalid="true"]):not(:focus) {
  border-color: transparent !important;
}
.qa-field {
  flex: none;
  max-width: 40%;
  margin-top: 2px;
  overflow: hidden;
  padding: 2px 8px;
  border: 1px solid var(--hairline);
  border-radius: 999px;
  background: var(--paper);
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.qa-question .icon-button {
  margin: -4px -4px 0 0;
}
.qa-jobs {
  color: var(--muted);
  font-size: var(--text-caption);
  line-height: 1.45;
}
.qa-answer {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}
.qa-answer textarea {
  flex: 1;
}
.qa .primary.small {
  flex: none;
  min-height: var(--control-h);
}
.qa .primary.small svg {
  width: 14px;
  height: 14px;
}

/* ── Saved searches ─────────────────────────────────────────────── */
.search-rows {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.search-row {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 4px 8px;
}
.search-row .field-error {
  grid-column: 2 / -1;
}
.search-loading {
  display: flex;
  align-items: center;
  min-height: var(--control-h);
  padding: 0 14px;
  border-radius: var(--radius-control);
  background: var(--fill);
  font-size: var(--text-body);
}
.search-index {
  display: grid;
  place-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--surface-alt);
  box-shadow: inset 0 0 0 1px var(--hairline);
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.search-row input {
  text-overflow: ellipsis;
}
.depth-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 4px 16px;
  padding-top: 18px;
  border-top: 1px solid var(--hairline);
}
.depth-row .field-error {
  grid-column: 1 / -1;
}
.depth-copy {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.stepper {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  border-radius: var(--radius-control);
  background: var(--fill);
}
.stepper-button {
  display: inline-grid;
  place-content: center;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-2);
}
.stepper-button svg {
  width: 14px;
  height: 14px;
}
.stepper-button:hover {
  background: var(--paper);
  color: var(--ink);
}
.stepper input {
  width: 44px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-small);
  background: transparent;
  color: var(--ink);
  font-size: var(--text-body);
  font-weight: 600;
  text-align: center;
  appearance: textfield;
  -moz-appearance: textfield;
}
.stepper input::-webkit-outer-spin-button,
.stepper input::-webkit-inner-spin-button {
  margin: 0;
  -webkit-appearance: none;
}
.stepper input:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 1px;
}
.depth-row.is-invalid .stepper {
  box-shadow: inset 0 0 0 1px var(--ember);
}
.segmented {
  max-width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
  align-self: flex-start;
}
.segmented::-webkit-scrollbar {
  display: none;
}

/* ── Your agent's read ──────────────────────────────────────────── */
.agent-read {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.agent-summary {
  color: var(--ink);
  font-size: 15px;
  line-height: 1.55;
}
.agent-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px 20px;
  margin: 0;
}
.agent-facts dt {
  color: var(--muted);
  font-size: var(--text-caption);
  font-weight: 500;
}
.agent-facts dd {
  margin: 6px 0 0;
  color: var(--ink-2);
  font-size: var(--text-meta);
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.chip-outline {
  padding: 2px 10px;
  border: 1px solid var(--hairline);
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink-2);
  font-size: var(--text-caption);
  font-weight: 500;
  line-height: 1.5;
}
.muted {
  color: var(--muted);
}
.agent-more summary {
  display: inline-flex;
  color: var(--ink-2);
  font-size: var(--text-meta);
  font-weight: 500;
  text-decoration: underline;
  text-decoration-color: var(--hairline-strong);
  text-underline-offset: 3px;
}
.agent-more p {
  margin-top: 8px;
  color: var(--ink-2);
  font-size: var(--text-meta);
  line-height: 1.6;
}

/* ── Account ────────────────────────────────────────────────────── */
.account-line {
  color: var(--ink-2);
  font-size: var(--text-body);
}
.account-line:empty {
  display: none;
}
.input-action,
.key-create {
  display: flex;
  align-items: center;
  gap: 8px;
}
.input-action input,
.key-create input {
  flex: 1;
  min-width: 0;
}
.input-action input {
  font-family: var(--font-mono);
  font-size: var(--text-meta);
}
.key-create .subtle-button {
  flex: none;
}
.key-create .subtle-button svg {
  width: 14px;
  height: 14px;
}
.link-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--muted);
  font-size: var(--text-meta);
}
.link-list:not(:empty) + .link-list {
  margin-top: 8px;
}
.agent-key-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 8px 8px 14px;
  border: 1px solid var(--hairline);
  border-radius: 14px;
  background: var(--paper);
}
.agent-key-row > span {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.agent-key-row strong {
  overflow: hidden;
  color: var(--ink);
  font-size: var(--text-meta);
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.agent-key-row small {
  color: var(--muted);
  font-size: var(--text-caption);
}
.agent-key-row .text-button {
  flex: none;
  padding: 6px 10px;
}
.secret {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--hairline);
  border-radius: var(--radius-control);
  background: var(--surface-alt);
}
.inline-status {
  margin-top: 8px;
  color: var(--ink-2);
  font-size: var(--text-caption);
}
.inline-status:empty {
  display: none;
}

/* ── Save capsule (transitions.dev toast motion) ────────────────── */
.save-dock {
  position: fixed;
  right: 0;
  bottom: 24px;
  left: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  gap: 10px;
  width: max-content;
  max-width: calc(100vw - 32px);
  height: 48px;
  margin: 0 auto;
  padding: 0 6px 0 16px;
  border: 1px solid var(--hairline);
  border-radius: 999px;
  background: var(--paper);
  box-shadow: var(--shadow-popover);
  color: var(--ink-2);
  font-size: var(--text-meta);
  font-weight: 500;
}
.save-dock:not(:has(.dock-button:not([hidden]))) {
  padding-right: 18px;
}
.dock-icon {
  flex: none;
  width: 16px;
  height: 16px;
}
.dock-icon .t-icon {
  display: grid;
  place-content: center;
}
.dock-icon svg {
  width: 16px;
  height: 16px;
  color: var(--muted);
}
.save-dock[data-tone="alert"] [data-icon="a"] svg {
  color: var(--ember);
}
.dock-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dock-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}
.dock-actions:not(:has(:not([hidden]))) {
  display: none;
}
.dock-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  border: 1px solid var(--hairline);
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
  font-size: var(--text-meta);
  font-weight: 500;
  white-space: nowrap;
}
.dock-button svg {
  width: 14px;
  height: 14px;
}
.dock-button:hover:not(:disabled) {
  background: var(--fill);
}
.dock-button.is-strong {
  border-color: transparent;
  background: var(--ink-soft);
  color: var(--on-ink);
}
.dock-button.is-strong:hover:not(:disabled) {
  background: var(--ink-hover);
}
.dock-button:disabled {
  opacity: 0.45;
}
/* The spinner turns only while a save is in flight. */
@media (prefers-reduced-motion: no-preference) {
  .dock-icon[data-state="b"] .dock-spinner svg {
    animation: spin 900ms var(--ease-linear) infinite;
  }
}
body:has(.save-dock.is-open) #toast {
  bottom: 84px;
}

/* Profile nav: a dot when questions are waiting for an answer. */
.nav-item .nav-badge {
  top: 3px;
  right: 3px;
}

/* ── Desktop and tablet: the top bar stays while a page scrolls ─── */
@media (min-width: 701px) {
  #app:is([data-view="profile"], [data-view="searches"]) .topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    margin: 0 calc(-1 * var(--gutter));
    padding: 0 var(--gutter);
    background: var(--frost-canvas);
    -webkit-backdrop-filter: saturate(1.6) blur(16px);
    backdrop-filter: saturate(1.6) blur(16px);
  }
}

/* ── Tablet: the rail becomes a sticky strip ────────────────────── */
@media (max-width: 1100px) {
  .page {
    max-width: 760px;
  }
  .page-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
  }
  .page-rail {
    top: 60px;
    z-index: 20;
    flex-direction: row;
    gap: 6px;
    margin: 0 calc(-1 * var(--gutter));
    padding: 8px var(--gutter);
    overflow-x: auto;
    background: var(--frost-canvas);
    -webkit-backdrop-filter: saturate(1.6) blur(16px);
    backdrop-filter: saturate(1.6) blur(16px);
    scrollbar-width: none;
    overscroll-behavior-x: contain;
  }
  .page-rail::-webkit-scrollbar {
    display: none;
  }
  .page-rail a {
    flex: none;
    min-height: 32px;
    gap: 6px;
    border: 1px solid var(--hairline);
    background: var(--paper);
    white-space: nowrap;
  }
  .page-rail a[aria-current] {
    border-color: var(--ink-soft);
    background: var(--ink-soft);
    color: var(--on-ink);
    box-shadow: none;
  }
  .page-rail a[aria-current] svg {
    color: var(--on-ink) !important;
  }
  .page-rail a[aria-current] .rail-count {
    background: rgb(255 255 255 / 0.18);
    color: var(--on-ink);
  }
  .pcard {
    scroll-margin-top: 124px;
  }
}

/* ── Phone ──────────────────────────────────────────────────────── */
@media (max-width: 700px) {
  .page {
    padding-bottom: 84px;
  }
  .page-head {
    padding: 8px 0 16px;
  }
  .page-head h1 {
    font-size: var(--text-heading-sm);
    letter-spacing: var(--tracking-heading);
  }
  .page-autosave {
    display: none;
  }
  /* Like the stage strip: 44px tall, slim chips, the page scrolls beneath. */
  .page-rail {
    top: env(safe-area-inset-top);
    height: 48px;
    align-items: center;
    padding-top: 0;
    padding-bottom: 0;
  }
  .page-rail a {
    position: relative;
    isolation: isolate;
    min-height: 44px;
    padding: 0 12px;
    border: 0;
    background: transparent;
  }
  .page-rail a::before {
    content: "";
    position: absolute;
    inset: 6px 0;
    z-index: -1;
    border: 1px solid var(--hairline);
    border-radius: 999px;
    background: var(--paper);
  }
  .page-rail a[aria-current] {
    border: 0;
    background: transparent;
  }
  .page-rail a[aria-current]::before {
    border-color: var(--ink-soft);
    background: var(--ink-soft);
  }
  .pcard {
    padding: 18px 16px 20px;
    border-radius: 20px;
    scroll-margin-top: 64px;
  }
  .pcard-head {
    margin-bottom: 18px;
  }
  .field-grid,
  .agent-facts {
    grid-template-columns: minmax(0, 1fr);
  }
  .page textarea,
  .page input {
    font-size: 16px !important;
  }
  .page .stepper input {
    font-size: 16px !important;
  }
  .file-row {
    flex-wrap: wrap;
  }
  .file-copy {
    flex-basis: calc(100% - 44px);
  }
  .file-row .ghost-button {
    flex: 1;
  }
  .ghost-button,
  .add-row,
  .icon-button,
  .stepper-button {
    min-height: var(--touch);
  }
  .icon-button {
    width: var(--touch);
  }
  .stepper-button {
    width: var(--touch);
  }
  .qa-answer {
    flex-direction: column;
    align-items: stretch;
  }
  .qa .primary.small {
    min-height: var(--touch);
  }
  .qa-field {
    max-width: 45%;
  }
  .key-create {
    flex-direction: column;
    align-items: stretch;
  }
  .key-create .subtle-button {
    min-height: var(--touch);
  }
  .answer-filter {
    width: 100%;
    height: var(--touch);
  }
  .answer-filter input {
    flex: 1;
    width: auto;
  }
  .save-dock {
    bottom: calc(var(--nav-h, 60px) + 10px);
    height: 56px;
    padding-left: 16px;
  }
  .dock-button {
    height: var(--touch);
  }
  body:has(.save-dock.is-open) #toast {
    bottom: calc(var(--nav-h, 60px) + 76px);
  }
  .nav-item .nav-badge {
    top: 4px;
    right: calc(50% - 20px);
  }
}
@media (hover: none), (pointer: coarse) {
  .icon-button {
    width: var(--touch);
    height: var(--touch);
  }
  .role-head {
    min-height: 56px;
  }
}
