/* Environmental Data Analyst — field-guide design system.
   Values follow the design plates: warm light only, Inter for the product
   and its headlines (as on the landing page), IBM Plex Mono for identifiers
   and figures. Color never carries meaning alone: every status has an icon and
   a word. */

/* ------------------------------------------------------------ tokens */

:root {
  /* Surfaces */
  --canvas: #f4f1e9;
  --raised: #fffefa;
  --subtle: #ecede5;
  --selected: #e5ebdc;

  /* Text */
  --text: #252b26;
  --text-secondary: #60675e;
  --text-inverse: #fffefa;

  /* Action */
  --action: #425c46;
  --action-hover: #304633;
  --action-pressed: #252b26;
  --focus: #286aa6;
  --disabled: #e2e3da;

  /* Status: foreground / background */
  --success: #425c46;
  --success-bg: #e5ebdc;
  --warning: #805b18;
  --warning-bg: #f4e9ce;
  --error: #9b3f36;
  --error-bg: #f7e7e2;
  --info: #35677d;
  --info-bg: #ecede5;

  /* Lines */
  --separator: #d3d6ca;
  --boundary: #899080;

  /* Space (4 px base) */
  --s1: 4px;
  --s2: 8px;
  --s3: 12px;
  --s4: 16px;
  --s5: 24px;
  --s6: 32px;
  --s7: 48px;
  --s8: 64px;

  /* Shape and depth */
  --radius-control: 6px;
  --radius-card: 10px;
  --shadow-popover: 0 8px 28px #252b2614;

  /* Type */
  --font-sans:
    'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono:
    'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --sidebar-width: 280px;
  --topbar-height: 64px;
}

/* ------------------------------------------------------------ base */

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
}

body {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 24px;
  color: var(--text);
  background: var(--canvas);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: 'tnum' 1;
}

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

/* One focus treatment everywhere: 2 px focus blue, 2 px offset. */
:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.hidden {
  display: none !important;
}

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

.muted {
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 20px;
}

.mono {
  font-family: var(--font-mono);
}

/* Section labels: small mono capitals, like the plates' plate numbers. */
.eyebrow {
  display: block;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 18px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: var(--s2);
}

.display-title {
  font-weight: 600;
  font-size: 34px;
  line-height: 40px;
  letter-spacing: -0.03em;
  color: var(--text);
}

/* ------------------------------------------------------------ icons */

.icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  stroke: currentColor;
  stroke-width: 1.5;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: middle;
}

.icon-sm {
  width: 16px;
  height: 16px;
}

[data-icon] {
  display: inline-flex;
}

.spin {
  animation: spin 1.1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ------------------------------------------------------------ buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s2);
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: var(--radius-control);
  font-size: 14px;
  line-height: 20px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  background: none;
}

.btn-primary {
  background: var(--action);
  color: var(--text-inverse);
}

.btn-primary:hover:not(:disabled) {
  background: var(--action-hover);
}

.btn-primary:active:not(:disabled) {
  background: var(--action-pressed);
}

/* A soft outline: the button's shape without a hard line on the warm
   page; a little stronger on hover. */
.btn-secondary {
  background: var(--raised);
  border-color: rgba(48, 47, 37, 0.16);
  color: var(--text);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--selected);
  border-color: rgba(48, 47, 37, 0.28);
}

.btn:disabled {
  background: var(--disabled);
  border-color: var(--disabled);
  color: var(--text-secondary);
  cursor: not-allowed;
}

.btn-compact {
  min-height: 36px;
  padding: 0 12px;
  font-size: 14px;
}

.btn-icon {
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  color: var(--text-secondary);
}

.btn-icon:hover {
  color: var(--text);
  background: var(--subtle);
}

.btn-block {
  width: 100%;
}

.link {
  color: var(--action);
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

.link:hover {
  color: var(--action-hover);
}

/* ------------------------------------------------------------ inputs */

.field {
  display: flex;
  flex-direction: column;
  gap: var(--s1);
  margin-bottom: var(--s4);
}

.field-label {
  font-size: 14px;
  line-height: 20px;
  font-weight: 500;
}

.input {
  width: 100%;
  min-height: 44px;
  padding: 0 var(--s3);
  background: var(--raised);
  border: 1px solid var(--boundary);
  border-radius: var(--radius-control);
  font-size: 14px;
  line-height: 20px;
}

.input:focus-visible {
  outline-offset: 2px;
}

/* Only text inputs: browsers also count every <select> as read-only. */
input.input[readonly] {
  background: var(--subtle);
  color: var(--text-secondary);
}

.select {
  appearance: none;
  padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2360675E' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  cursor: pointer;
}

.field-error {
  min-height: 18px;
  font-size: 12px;
  line-height: 18px;
  color: var(--error);
  margin-bottom: var(--s3);
}

/* ------------------------------------------------------------ badges and chips */

.badge {
  display: inline-flex;
  align-items: center;
  gap: var(--s1);
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  line-height: 18px;
  font-weight: 500;
  white-space: nowrap;
}

.badge .icon {
  width: 14px;
  height: 14px;
}

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

.badge-warning {
  color: var(--warning);
  background: var(--warning-bg);
}

.badge-error {
  color: var(--error);
  background: var(--error-bg);
}

.badge-info {
  color: var(--info);
  background: var(--info-bg);
}

/* ------------------------------------------------------------ brand */

.brand {
  display: flex;
  align-items: center;
  gap: var(--s2);
  min-width: 0;
}

/* The mark: a hill in contour lines, the landing page's logo. */
.brand-mark {
  display: inline-flex;
  color: var(--action);
}

.brand-svg {
  width: 24px;
  height: 24px;
}

.brand-name {
  font-size: 16px;
  line-height: 24px;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ------------------------------------------------------------ sign in */

.auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--s4);
}

.auth-card {
  width: 100%;
  max-width: 360px;
  padding: var(--s5);
  background: var(--raised);
  border: 1px solid var(--separator);
  border-radius: var(--radius-card);
}

.auth-card .brand {
  margin-bottom: var(--s5);
}

.auth-title {
  font-size: 20px;
  line-height: 28px;
  font-weight: 500;
  margin-bottom: var(--s4);
}

.auth-subtitle {
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 20px;
  margin: calc(-1 * var(--s3)) 0 var(--s4);
}

.auth-subtitle:empty {
  display: none;
}

/* ------------------------------------------------------------ app frame */

.app {
  height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  flex-shrink: 0;
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  gap: var(--s3);
  padding: 0 var(--s5);
  background: var(--canvas);
  border-bottom: 1px solid var(--separator);
}

.menu-button {
  display: none;
}

.account {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: var(--s2);
  min-width: 0;
}

/* The top bar's two chips (the budget, the account), each opening a small
   menu under it. */
.topbar-pop {
  position: relative;
}

.topbar-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  height: 34px;
  padding: 0 var(--s3);
  border: 1px solid rgba(48, 47, 37, 0.16);
  border-radius: var(--radius-control);
  background: var(--raised);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  white-space: nowrap;
  cursor: pointer;
}

.topbar-chip:hover,
.topbar-chip[aria-expanded='true'] {
  border-color: rgba(48, 47, 37, 0.28);
}

/* Quiet: plain grey text until hovered or opened. */
.budget-chip {
  border-color: transparent;
  background: none;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-secondary);
}

.budget-chip:hover,
.budget-chip[aria-expanded='true'] {
  border-color: transparent;
  background: var(--subtle);
  color: var(--text);
}

/* Under a dollar left: amber; spent: red. */
.budget-chip.is-low {
  border-color: transparent;
  background: var(--warning-bg);
  color: var(--warning);
}

.budget-chip.is-out {
  border-color: transparent;
  background: var(--error-bg);
  color: var(--error);
}

/* Budget requests waiting for this person. */
.chip-count {
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--action);
  color: var(--text-inverse);
  font-family: var(--font-sans);
  font-size: 11px;
  line-height: 18px;
  text-align: center;
}

.account-initial {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--action);
  color: var(--text-inverse);
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
}

/* The account: the person's initial alone (the menu says who). */
.account-chip {
  padding: 0;
  border-color: transparent;
  background: none;
  color: var(--text-secondary);
}

/* No box: the initial's circle darkens a little on hover and while open. */
.account-chip:hover,
.account-chip[aria-expanded='true'] {
  border-color: transparent;
}

.account-chip:hover .account-initial,
.account-chip[aria-expanded='true'] .account-initial {
  box-shadow:
    0 0 0 2px var(--canvas, #f3f1ea),
    0 0 0 3px rgba(48, 47, 37, 0.28);
}

.topbar-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 60;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: var(--s2);
  min-width: 240px;
  padding: var(--s3);
  border: 1px solid var(--separator);
  border-radius: var(--radius-card);
  background: var(--raised);
  box-shadow: var(--shadow-popover);
}

.topbar-menu[hidden] {
  display: none;
}

.topbar-menu-title {
  margin: 0;
  font-size: 14px;
  font-weight: 500;
}

.topbar-menu-note {
  margin: 0;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 18px;
}

.topbar-menu-item {
  padding: 7px var(--s2);
  border: 0;
  border-radius: var(--radius-control);
  background: none;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
}

.topbar-menu-item:hover {
  background: var(--selected);
}

.banner {
  display: flex;
  align-items: center;
  gap: var(--s3);
  padding: var(--s2) var(--s5);
  background: var(--selected);
  border-bottom: 1px solid var(--separator);
}

.banner-text {
  flex: 1;
  min-width: 0;
  font-size: 14px;
  line-height: 20px;
  overflow-wrap: anywhere;
}

.layout {
  flex: 1;
  display: flex;
  min-height: 0;
}

/* ------------------------------------------------------------ sidebar */

.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  overflow-y: auto;
  padding: var(--s5) var(--s4);
  border-right: 1px solid var(--separator);
  background: var(--canvas);
  display: flex;
  flex-direction: column;
  gap: var(--s5);
}

.sidebar-section {
  display: flex;
  flex-direction: column;
}

/* "This task" with the fold button beside it. */
.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s2);
}

.sidebar-head .eyebrow {
  margin-bottom: var(--s2);
}

.sidebar-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  margin: -6px -4px var(--s2) 0;
  padding: 0;
  border: 0;
  border-radius: var(--radius-control);
  background: none;
  color: var(--text-secondary);
  cursor: pointer;
}

.sidebar-toggle:hover {
  background: var(--subtle);
  color: var(--text);
}

@media (max-width: 767px) {
  .sidebar-toggle {
    display: none;
  }
}

/* Folded (wide screens): a narrow strip of the views' icons; names show on
   hover (their title), counts and chats come back when unfolded. */
@media (min-width: 768px) {
  .layout.is-collapsed .sidebar {
    width: 64px;
    padding-right: var(--s2);
    padding-left: var(--s2);
  }

  .layout.is-collapsed .sidebar-head {
    justify-content: center;
  }

  .layout.is-collapsed .sidebar-head .eyebrow,
  .layout.is-collapsed .nav-label,
  .layout.is-collapsed .nav-count,
  .layout.is-collapsed .nav-sub {
    display: none;
  }

  .layout.is-collapsed .sidebar-toggle {
    margin: 0 0 var(--s2);
  }

  .layout.is-collapsed .nav-item {
    justify-content: center;
    padding: 0;
  }
}

.workflow-list,
.dataset-list {
  display: flex;
  flex-direction: column;
  gap: var(--s2);
}

/* Quick starts in the sidebar: compact, one line of hint each. */
.workflow-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
  min-height: 44px;
  padding: var(--s2) var(--s3);
  text-align: left;
  background: var(--raised);
  border: 1px solid var(--separator);
  border-radius: var(--radius-control);
  cursor: pointer;
}

.workflow-item:hover:not(:disabled) {
  border-color: var(--action);
}

.workflow-item:disabled {
  cursor: not-allowed;
  background: var(--subtle);
}

.workflow-item .workflow-title {
  display: flex;
  align-items: center;
  gap: var(--s2);
  font-size: 14px;
  line-height: 20px;
  font-weight: 500;
}

/* Upload */

.upload-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s1);
  padding: var(--s4) var(--s3);
  text-align: center;
  background: var(--raised);
  border: 1px dashed var(--boundary);
  border-radius: var(--radius-card);
}

.upload-zone.dragging {
  border-style: solid;
  border-color: var(--action);
  background: var(--selected);
}

.upload-hint {
  font-size: 14px;
  line-height: 20px;
}

.upload-types {
  font-size: 12px;
  line-height: 18px;
  color: var(--text-secondary);
}

.upload-message {
  font-size: 12px;
  line-height: 18px;
  color: var(--text-secondary);
  margin-top: var(--s2);
  overflow-wrap: anywhere;
}

.upload-message:empty {
  display: none;
}

.upload-message.is-error {
  color: var(--error);
}

.document-list {
  display: flex;
  flex-direction: column;
  margin-top: var(--s3);
}

/* Files: one quiet line each. */
.file-row {
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr) auto auto auto;
  align-items: center;
  column-gap: var(--s2);
  min-height: 36px;
  padding: 0 0 0 var(--s1);
  border-bottom: 1px solid var(--separator);
  font-size: 14px;
  line-height: 20px;
}

.file-type .icon {
  color: var(--text-secondary);
}

.file-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-status {
  display: inline-flex;
}

/* "v3" on a file with earlier versions: opens Versions. */
.file-version-slot:empty {
  display: none;
}

.file-version {
  min-height: 24px;
  padding: 0 var(--s2);
  border-radius: 999px;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.version-list {
  list-style: none;
  margin: var(--s3) 0 0;
  padding: 0;
}

.version-row {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto auto;
  align-items: center;
  column-gap: var(--s2);
  min-height: 40px;
  border-bottom: 1px solid var(--separator);
  font-size: 14px;
}

.version-number {
  font-variant-numeric: tabular-nums;
  color: var(--text-secondary);
}

.version-file {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: var(--s1) 0;
}

/* Date, rows or pages, and who uploaded it, under the file name. */
.version-details {
  display: block;
  font-size: 12px;
  line-height: 16px;
  /* On a narrow screen the details wrap rather than being cut off. */
  white-space: normal;
}

/* On a narrow screen, Make current (or "Current") goes under the name. */
@media (max-width: 520px) {
  .version-row {
    grid-template-columns: 32px minmax(0, 1fr) auto;
    grid-template-areas:
      'number file remove'
      '. state .';
    row-gap: var(--s1);
    padding: var(--s2) 0;
  }

  .version-number {
    grid-area: number;
  }

  .version-file {
    grid-area: file;
  }

  .version-state {
    grid-area: state;
    justify-self: start;
  }

  .version-remove {
    grid-area: remove;
  }
}

/* "Version 2 is now current." above the versions. */
.version-list-notice {
  margin-bottom: var(--s2);
}

.version-current {
  font-size: 12px;
  font-weight: 600;
}

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

.status-warning {
  color: var(--warning);
}

.status-error {
  color: var(--error);
}

.status-info {
  color: var(--info);
}

.file-actions {
  display: flex;
}

/* A file whose delete is running (markDeleting). */
.is-deleting {
  opacity: 0.55;
}

.file-deleting {
  padding: 0 var(--s2);
  font-size: 12px;
  white-space: nowrap;
}

.file-action {
  min-width: 32px;
  min-height: 32px;
}

/* Delete shows on hover or keyboard focus; touch screens always show it. */
.file-delete {
  opacity: 0;
}

.file-row:hover .file-delete,
.file-row:focus-within .file-delete {
  opacity: 1;
}

@media (hover: none) {
  .file-delete {
    opacity: 1;
  }
}

/* A smaller button that fits on a file row. */
.btn-compact {
  min-height: 32px;
  padding: 0 10px;
  font-size: 12px;
  line-height: 18px;
}

.approve-all {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s2);
  padding: var(--s2);
  margin-bottom: var(--s2);
  border-radius: var(--radius-control);
  background: var(--warning-bg);
  color: var(--warning);
  font-size: 12px;
  line-height: 18px;
}

.file-note {
  grid-column: 2 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s2);
  margin: -6px 0 var(--s2);
  font-size: 12px;
  line-height: 18px;
  color: var(--warning);
}

.file-progress {
  color: var(--text-secondary);
}

/* "44 figures not read yet · See figures · Read all": text and links
   together under the name, never in the icon column. */
.file-figures {
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 0 var(--s2);
}

.pf-figures {
  margin-top: 2px;
  font-size: 12px;
  line-height: 18px;
  color: var(--text-secondary);
}

.file-details {
  grid-column: 2 / -1;
  margin: 0 0 var(--s2);
  font-size: 12px;
  line-height: 18px;
  color: var(--text-secondary);
}

.file-details summary {
  cursor: pointer;
  color: var(--text);
  width: fit-content;
}

.file-details dl {
  margin: var(--s1) 0 0;
}

.file-details dt {
  font-weight: 600;
  color: var(--text);
}

.file-details dd {
  margin: 0 0 var(--s1);
  overflow-wrap: anywhere;
}

.file-details code {
  font-size: 11px;
  white-space: pre-wrap;
}

.file-error {
  grid-column: 2 / -1;
  margin: -6px 0 var(--s2);
  font-size: 12px;
  line-height: 18px;
  color: var(--error);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Datasets */

.disclosure > summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 36px;
  cursor: pointer;
  margin-bottom: 0;
}

.disclosure > summary::-webkit-details-marker {
  display: none;
}

.disclosure > summary::after {
  content: '+';
  font-size: 16px;
}

.disclosure[open] > summary::after {
  content: '–';
}

.count {
  margin-left: auto;
  margin-right: var(--s2);
  text-transform: none;
}

.dataset-list {
  margin-top: var(--s2);
}

.dataset-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s2);
  padding: 6px 0;
  border-bottom: 1px solid var(--separator);
  font-size: 12px;
  line-height: 18px;
}

.dataset-name {
  font-family: var(--font-mono);
  overflow-wrap: anywhere;
}

/* Data & files: where each table lives and what it is mapped as. */
.dm-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s1);
  margin-left: auto;
  justify-content: flex-end;
}

.dm-tag {
  padding: 0 var(--s2);
  border: 1px solid var(--separator);
  border-radius: var(--radius-control);
  color: var(--text-secondary);
  font-size: 11px;
  white-space: nowrap;
}

.dm-tag.is-mapped {
  border-color: transparent;
  color: var(--text);
  background: var(--success-bg);
}

.dm-tag.is-project {
  background: var(--info-bg);
}

.dm-tag.is-unmapped {
  border-style: dashed;
}

.dm-tag.is-review {
  color: var(--warning);
  background: var(--warning-bg);
}

.dm-more {
  margin-left: 3px;
}

/* "Not mapped" as the way to map the table. */
button.dm-tag,
a.dm-tag {
  font: inherit;
  font-size: 11px;
  background: none;
  cursor: pointer;
  text-decoration: none;
}

button.dm-tag:hover,
a.dm-tag:hover {
  color: var(--text);
  border-color: var(--text-secondary);
}

/* Narrow screens: a table's labels go under its name. */
@media (max-width: 640px) {
  .dataset-item {
    flex-wrap: wrap;
  }

  .dataset-item .dm-tags {
    order: 3;
    flex-basis: 100%;
    justify-content: flex-start;
    margin-left: 0;
  }
}

.data-guess p + .btn {
  margin-bottom: var(--s2);
}

.dataset-rows {
  color: var(--text-secondary);
  white-space: nowrap;
  font-family: var(--font-mono);
}

/* ------------------------------------------------------------ chat */

.chat {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.messages {
  flex: 1;
  overflow-y: auto;
  padding: var(--s6) var(--s8) var(--s5);
  /* No scroll bar: the rail of questions (.chat-rail) shows where you are;
     wheel, trackpad and keys still scroll. */
  scrollbar-width: none;
}

.messages::-webkit-scrollbar {
  display: none;
}

/* The rail of a long chat's questions, at the right edge of the messages
   (mountChatRail in script.js). */
.chat {
  position: relative;
}

.chat-rail {
  position: absolute;
  right: 12px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: center;
  gap: 7px;
  width: 22px;
  pointer-events: none;
}

.chat-rail-mark {
  position: relative;
  flex: none;
  width: 10px;
  height: 2px;
  padding: 0;
  border: 0;
  border-radius: 1px;
  background: var(--text-secondary);
  opacity: 0.22;
  cursor: pointer;
  pointer-events: auto;
  transition:
    width 0.12s,
    background 0.12s;
}

/* A bigger target than the mark itself. */
.chat-rail-mark::before {
  content: '';
  position: absolute;
  inset: -5px -4px;
}

/* What is on screen: a little darker, not a color of its own. */
.chat-rail-mark.is-here {
  opacity: 0.5;
}

.chat-rail-mark:hover,
.chat-rail-mark:focus-visible {
  width: 18px;
  height: 3px;
  opacity: 0.9;
}

.messages > * {
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
}

/* Welcome */

.welcome {
  padding: var(--s5) 0 var(--s4);
}

.welcome .display-title {
  margin-bottom: var(--s3);
}

.welcome-text {
  color: var(--text-secondary);
  max-width: 640px;
  margin-bottom: var(--s5);
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--s3);
  padding: var(--s4);
  margin-bottom: var(--s5);
  background: var(--raised);
  border: 1px solid var(--separator);
  border-radius: var(--radius-card);
}

.workflow-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--s4);
  margin-bottom: var(--s5);
}

.workflow-card {
  display: flex;
  flex-direction: column;
  gap: var(--s2);
  padding: var(--s4) var(--s4) var(--s4);
  text-align: left;
  background: var(--raised);
  border: 1px solid var(--separator);
  border-radius: var(--radius-card);
  cursor: pointer;
}

.workflow-card:hover:not(:disabled) {
  border-color: var(--action);
}

.workflow-card:disabled {
  cursor: not-allowed;
  background: var(--subtle);
}

.workflow-card .workflow-title {
  display: flex;
  align-items: center;
  gap: var(--s2);
  font-size: 16px;
  line-height: 24px;
  font-weight: 500;
}

.workflow-description {
  font-size: 14px;
  line-height: 20px;
  color: var(--text-secondary);
}

.workflow-hint {
  font-size: 12px;
  line-height: 18px;
  color: var(--text-secondary);
}

/* Messages */

.message {
  margin-bottom: var(--s5);
}

.message.user {
  display: flex;
  justify-content: flex-end;
}

.message.user .bubble {
  max-width: 85%;
  padding: var(--s3) var(--s4);
  background: var(--selected);
  border-radius: var(--radius-card);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.answer {
  padding: var(--s5);
  background: var(--raised);
  border: 1px solid var(--separator);
  border-radius: var(--radius-card);
}

.answer-body {
  overflow-wrap: anywhere;
}

.answer-body > * + * {
  margin-top: var(--s3);
}

.answer-body h1,
.answer-body h2 {
  font-size: 20px;
  line-height: 28px;
  font-weight: 500;
  margin-top: var(--s5);
}

.answer-body h3,
.answer-body h4 {
  font-size: 16px;
  line-height: 24px;
  font-weight: 600;
  margin-top: var(--s4);
}

.answer-body > :first-child {
  margin-top: 0;
}

.answer-body ul,
.answer-body ol {
  padding-left: var(--s5);
}

.answer-body li + li {
  margin-top: var(--s1);
}

.answer-body code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  padding: 1px 4px;
  background: var(--subtle);
  border-radius: 4px;
}

.answer-body pre {
  padding: var(--s3);
  background: var(--subtle);
  border-radius: var(--radius-control);
  overflow-x: auto;
}

.answer-body pre code {
  padding: 0;
  background: none;
}

.answer-body blockquote {
  padding-left: var(--s3);
  border-left: 2px solid var(--separator);
  color: var(--text-secondary);
}

.answer-body hr {
  border: none;
  border-top: 1px solid var(--separator);
}

.answer-body a {
  color: var(--action);
}

/* Tables: the data-table recipe. Square corners, ruled rows, numbers
   right-aligned in tabular figures. Wide tables scroll in their own region. */

.table-scroll {
  overflow-x: auto;
  border: 1px solid var(--separator);
}

.answer-body table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  line-height: 20px;
}

.answer-body th,
.answer-body td {
  padding: 11px 12px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--separator);
}

.answer-body th {
  font-weight: 600;
  font-size: 12px;
  line-height: 18px;
  background: var(--subtle);
}

.answer-body tr:last-child td {
  border-bottom: none;
}

.answer-body .num {
  text-align: right;
  font-family: var(--font-mono);
  font-size: 13px;
  white-space: nowrap;
}

/* Cells break between words, never between letters. The answer's own
   `overflow-wrap: anywhere` would let a text column shrink to one character
   wide beside unbreakable number columns; with these, a table that does not
   fit scrolls sideways instead. */
.answer-body th,
.answer-body td {
  overflow-wrap: break-word;
  word-break: normal;
}

.answer-body td:not(.num),
.answer-body th:not(.num) {
  min-width: 6em;
  max-width: 28em;
}

/* Number headers may wrap at spaces ("Total / Analyses"); the numbers do not. */
.answer-body th.num {
  white-space: normal;
}

/* One-word labels and headers ("cis-1,2-DCE", "Non-detects") stay whole. */
.answer-body th.nowrap,
.answer-body td.nowrap {
  white-space: nowrap;
}

/* Wide tables: the first column (the row label) stays in view while the
   rest scrolls, and a soft shadow on the right edge says there is more.
   The shadow is the scroller's background, so body cells stay transparent;
   --table-bg is the surface the table sits on. */
.answer-body {
  --table-bg: var(--raised);
}

.report-detail .answer-body {
  --table-bg: var(--canvas);
}

.answer-body .table-scroll {
  background:
    linear-gradient(to left, var(--table-bg) 30%, transparent) right / 40px 100%
      no-repeat local,
    radial-gradient(farthest-side at 100% 50%, #252b2626, transparent) right /
      14px 100% no-repeat scroll,
    var(--table-bg);
}

.answer-body td:first-child,
.answer-body th:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  box-shadow: inset -1px 0 0 var(--separator);
}

.answer-body td:first-child {
  background: var(--table-bg);
}

/* Evidence */

.evidence {
  margin-top: var(--s4);
  padding-top: var(--s3);
  border-top: 1px solid var(--separator);
}

.citations {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--s1);
}

.citation {
  font-size: 14px;
  line-height: 20px;
}

.citation-row,
.citation > details > summary {
  display: flex;
  align-items: center;
  gap: var(--s2);
  min-height: 32px;
}

.citation > details > summary {
  list-style: none;
  cursor: pointer;
}

.citation > details > summary::-webkit-details-marker {
  display: none;
}

.citation-id {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-secondary);
}

.citation .icon {
  width: 16px;
  height: 16px;
  color: var(--text-secondary);
}

.citation-label {
  overflow-wrap: anywhere;
}

.inspect {
  margin-left: auto;
  font-size: 12px;
  line-height: 18px;
  color: var(--action);
  font-weight: 500;
  white-space: nowrap;
}

details[open] > summary .inspect-open {
  display: none;
}

details:not([open]) > summary .inspect-close {
  display: none;
}

.citation pre {
  margin: var(--s1) 0 var(--s2) var(--s6);
  padding: var(--s3);
  background: var(--subtle);
  border-radius: var(--radius-control);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 18px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.usage-line {
  margin-top: var(--s3);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 18px;
  color: var(--text-secondary);
}

/* Working, failed, stopped */

.state-card {
  display: flex;
  flex-direction: column;
  gap: var(--s3);
  padding: var(--s4) var(--s5);
  background: var(--raised);
  border: 1px solid var(--separator);
  border-radius: var(--radius-card);
}

.state-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--s3);
}

.state-text {
  font-size: 14px;
  line-height: 20px;
}

.elapsed {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-secondary);
}

.state-actions {
  display: flex;
  gap: var(--s2);
}

/* Follow-ups */

.follow-ups {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s2);
  margin-top: calc(-1 * var(--s3));
  margin-bottom: var(--s5);
}

.follow-ups .eyebrow {
  margin: 0 var(--s1) 0 0;
}

.follow-ups .btn {
  white-space: normal;
  text-align: left;
  min-height: 36px;
  padding: var(--s1) var(--s3);
}

/* Composer */

.composer {
  flex-shrink: 0;
  margin: 0 var(--s8) var(--s5);
  max-width: 800px;
  width: calc(100% - 2 * var(--s8));
  align-self: center;
  background: var(--raised);
  border: 1px solid var(--boundary);
  border-radius: var(--radius-card);
}

.composer:focus-within {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.composer textarea {
  display: block;
  width: 100%;
  min-height: 88px;
  max-height: 200px;
  padding: var(--s4) var(--s4) var(--s2);
  border: none;
  background: transparent;
  resize: none;
  font-size: 16px;
  line-height: 24px;
}

.composer textarea:focus-visible {
  outline: none;
}

.composer-bar {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: var(--s2);
  padding: var(--s2) var(--s2) var(--s2) var(--s4);
}

/* One line: the picker is as wide as a model name (a native select is
   otherwise as wide as its longest option); when the bar is crowded the
   hint and the model name give way first, never the buttons. */
.composer-bar .model-select {
  flex: 0 1 15rem;
  width: 15rem;
  min-width: 0;
  text-overflow: ellipsis;
}

.composer-bar > .btn,
.composer-bar > .quick-start {
  flex-shrink: 0;
}

/* One height for everything on the bar (the model picker's 36 px):
   Quick start, Build a chart and Ask, which stands out by colour. */
.composer-bar > .btn,
.composer-bar > .quick-start > summary {
  min-height: 36px;
  padding: 0 12px;
  font-size: 13px;
  line-height: 18px;
}

/* A narrow composer drops the keyboard hint rather than cut it short. */
.composer {
  container-type: inline-size;
}

@container (max-width: 620px) {
  .composer-hint {
    display: none;
  }

  .composer-bar #sendButton {
    margin-left: auto;
  }
}

/* Idle (empty, not focused, no menu open): one short row, so the chat
   above it can be read. Clicking in, or any text, opens it full size. */
.composer:not(:focus-within):not(:has(details[open])):has(
    textarea:placeholder-shown
  ) {
  display: flex;
  align-items: center;
}

.composer:not(:focus-within):not(:has(details[open])):has(
    textarea:placeholder-shown
  )
  textarea {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  height: 48px !important; /* over autosizeComposer's inline height */
  padding: 12px var(--s4);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.composer:not(:focus-within):not(:has(details[open])):has(
    textarea:placeholder-shown
  )
  .composer-bar {
  flex: 0 0 auto;
  padding-left: 0;
}

.composer:not(:focus-within):not(:has(details[open])):has(
    textarea:placeholder-shown
  )
  :is(.model-select, .composer-hint) {
  display: none;
}

@container (max-width: 620px) {
  .composer:not(:focus-within):not(:has(details[open])):has(
      textarea:placeholder-shown
    )
    :is(.quick-start, #buildChartButton) {
    display: none;
  }
}

/* The model picker sits in the composer, where the question is asked:
   compact, borderless until hovered, still a full native select. */
.model-select {
  appearance: none;
  min-height: 36px;
  max-width: 100%;
  padding: 0 28px 0 8px;
  border: 1px solid transparent;
  border-radius: var(--radius-control);
  background-color: var(--subtle);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2360675E' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 18px;
  font-weight: 500;
  cursor: pointer;
}

.model-select:hover {
  border-color: var(--boundary);
  color: var(--text);
}

.composer-hint {
  flex: 0 0 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
}

/* ------------------------------------------------------------ responsive */

@media (max-width: 1199px) {
  :root {
    --sidebar-width: 248px;
  }

  .messages {
    padding-left: var(--s6);
    padding-right: var(--s6);
  }

  .composer {
    margin-left: var(--s6);
    margin-right: var(--s6);
    width: calc(100% - 2 * var(--s6));
  }
}

/* Phones and small tablets: the sidebar becomes a drawer behind a menu
   button, so the conversation keeps the whole screen. */
@media (max-width: 767px) {
  .topbar {
    padding: 0 var(--s2) 0 var(--s1);
    gap: var(--s1);
  }

  .menu-button {
    display: inline-flex;
  }

  .account-usage {
    display: none;
  }

  /* Room for the two text buttons: the mark alone identifies the app. */
  .topbar .brand-name {
    display: none;
  }

  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 20;
    width: min(320px, 88vw);
    box-shadow: var(--shadow-popover);
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    visibility: hidden;
  }

  .sidebar.open {
    transform: none;
    visibility: visible;
  }

  .scrim {
    position: fixed;
    inset: 0;
    z-index: 10;
    background: #252b2640;
  }

  .messages {
    padding: var(--s4) 20px;
  }

  .display-title {
    font-size: 28px;
    line-height: 34px;
  }

  .answer {
    padding: var(--s4);
  }

  .composer {
    margin: 0 var(--s3) var(--s3);
    width: calc(100% - 2 * var(--s3));
  }

  .composer textarea {
    min-height: 64px;
  }

  .composer-hint {
    display: none;
  }

  .composer-bar {
    flex-wrap: wrap;
  }

  .composer-bar .btn {
    margin-left: auto;
  }
}

/* Short windows (a laptop with the browser's toolbars, a split screen): the
   composer starts small and still grows as you type. */
@media (max-height: 760px) {
  .composer textarea {
    min-height: 48px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .spin {
    animation: none;
  }

  .sidebar {
    transition: none;
  }
}

/* ------------------------------------------------------------ charts */

:root {
  --chart-1: #425c46;
  --chart-2: #35677d;
  --chart-3: #9b5f45;
  --chart-4: #805b18;
  --chart-5: #6b5b8c;
  --chart-6: #899080;
}

.chart {
  margin: var(--s4) 0;
  padding: var(--s4);
  border: 1px solid var(--separator);
  border-radius: var(--radius-card);
  background: var(--raised);
}

.chart-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s3);
  margin-bottom: var(--s3);
}

.chart-title {
  font-size: 14px;
  line-height: 20px;
  font-weight: 600;
  color: var(--text);
}

.chart-export {
  flex-shrink: 0;
}

.chart-canvas {
  position: relative;
  height: 280px;
}

/* A map drawn on the server: the PNG at the answer's width. */
.chart-image {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--radius-control);
}

.chart-edited {
  margin-left: var(--s1);
  font-size: 12px;
  font-weight: 400;
  color: var(--text-secondary);
}

.form-dialog-extra {
  margin-right: auto;
}

.figure-style-facts {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: var(--s1) var(--s4);
  margin: var(--s3) 0;
}

.figure-style-facts dt {
  color: var(--text-secondary);
}

.figure-style-logo {
  display: flex;
  align-items: center;
  gap: var(--s3);
  margin-bottom: var(--s3);
}

.figure-style-logo img {
  max-height: 48px;
  max-width: 160px;
}

.answer-actions {
  margin-top: var(--s3);
  display: flex;
  gap: var(--s2);
}

/* ------------------------------------------------------------ workspace: Ask | Reports */

.workspace {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.workspace > .chat {
  min-height: 0;
}

/* ------------------------------------------------------------ chat list */

.chat-list {
  display: flex;
  flex-direction: column;
  max-height: 288px; /* about 8 chats; the rest scroll */
  overflow-y: auto;
}

.chat-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  border-radius: var(--radius-control);
}

.chat-item.is-active {
  background: var(--subtle);
}

.chat-item:hover .file-delete,
.chat-item:focus-within .file-delete {
  opacity: 1;
}

.chat-open {
  display: flex;
  justify-content: space-between;
  gap: var(--s2);
  min-height: 36px;
  padding: 0 var(--s2);
  border: 0;
  background: none;
  text-align: left;
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
  min-width: 0;
}

.chat-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-date {
  flex-shrink: 0;
  font-size: 12px;
  color: var(--text-secondary);
}

/* ------------------------------------------------------------ reports */

.reports-view {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
}

.reports-list {
  overflow-y: auto;
  padding: var(--s4);
  border-right: 1px solid var(--separator);
  display: flex;
  flex-direction: column;
  gap: var(--s1);
}

.report-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: var(--s2) var(--s3);
  border: 0;
  border-radius: var(--radius-control);
  background: none;
  text-align: left;
  cursor: pointer;
}

.report-item:hover,
.report-item.is-active {
  background: var(--selected);
}

.report-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
}

.report-meta {
  font-size: 12px;
  color: var(--text-secondary);
}

.report-detail {
  position: relative;
  overflow-y: auto;
  padding: var(--s6) var(--s8);
  max-width: 880px;
}

.report-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--s2) var(--s4);
  margin-bottom: var(--s4);
}

.report-heading {
  flex-basis: 100%;
  font-size: 28px;
  line-height: 34px;
  font-weight: 600;
  letter-spacing: -0.025em;
}

.report-question {
  padding: var(--s3) var(--s4);
  margin-bottom: var(--s4);
  border-radius: var(--radius-card);
  background: var(--subtle);
}

.report-question p {
  margin: var(--s1) 0 0;
}

/* ------------------------------------------------------------ notes */

.comments {
  margin-top: var(--s6);
  padding-top: var(--s4);
  border-top: 1px solid var(--separator);
}

.note-list {
  list-style: none;
  margin: var(--s2) 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--s3);
}

.note-meta {
  display: flex;
  align-items: center;
  gap: var(--s2);
  font-size: 12px;
  color: var(--text-secondary);
}

.note-body {
  margin: var(--s1) 0 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* Positioned, so its visually hidden label stays inside it rather than
   stretching the page from wherever the scrolled panel puts it. */
.note-form {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--s2);
  margin-top: var(--s3);
}

.note-form textarea {
  width: 100%;
  padding: var(--s2);
  border: 1px solid var(--boundary);
  border-radius: var(--radius-control);
  font: inherit;
  background: var(--raised);
}

.file-notes {
  position: relative;
}

.file-notes:not(.has-notes) {
  opacity: 0;
}

.file-row:hover .file-notes,
.file-row:focus-within .file-notes {
  opacity: 1;
}

.note-count {
  font-size: 11px;
  margin-left: 2px;
}

.notes-dialog {
  /* The reset zeroes margins; a modal dialog centers itself with auto. */
  margin: auto;
  width: min(520px, calc(100vw - 32px));
  border: 1px solid var(--separator);
  border-radius: var(--radius-card);
  padding: var(--s5);
  background: var(--raised);
  box-shadow: var(--shadow-popover);
}

.notes-dialog::backdrop {
  background: #252b2633;
}

.notes-dialog-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--s3);
}

.notes-dialog-title {
  font-size: 16px;
  font-weight: 600;
  overflow-wrap: anywhere;
}

@media (max-width: 768px) {
  .reports-view {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }

  .reports-list {
    max-height: 40vh;
    border-right: 0;
    border-bottom: 1px solid var(--separator);
  }

  .report-detail {
    padding: var(--s5) var(--s4);
  }
}

@media (hover: none) {
  .file-notes:not(.has-notes) {
    opacity: 1;
  }
}

.ask-dialog-message {
  margin: var(--s2) 0 var(--s3);
  color: var(--text-secondary);
}

.ask-dialog-message:empty {
  display: none;
}

.ask-dialog-label {
  display: block;
  margin-bottom: var(--s1);
  font-size: 13px;
}

.ask-dialog-input {
  width: 100%;
  padding: var(--s2);
  border: 1px solid var(--boundary);
  border-radius: var(--radius-control);
  font: inherit;
  background: var(--raised);
}

.ask-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--s2);
  margin-top: var(--s4);
}

/* ------------------------------------------------------------ navigation */
/* The sidebar is the app's map: the project, then the three pages, with the
   user's chats nested under Ask. */

.project-pill {
  display: flex;
  align-items: center;
  gap: var(--s2);
  min-height: 44px;
  padding: 0 var(--s3);
  border-radius: var(--radius-card);
  background: var(--subtle);
  font-size: 15px;
  font-weight: 500;
}

.project-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-list {
  list-style: none;
  margin: var(--s2) 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--s1);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--s3);
  width: 100%;
  min-height: 44px;
  padding: 0 var(--s3);
  border: 0;
  border-radius: var(--radius-card);
  background: none;
  font-size: 15px;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.nav-item .icon {
  color: var(--text-secondary);
}

.nav-item:hover {
  background: var(--subtle);
}

.nav-item[aria-current='page'] {
  background: var(--selected);
  color: var(--action);
  font-weight: 600;
}

.nav-item[aria-current='page'] .icon {
  color: var(--action);
}

.nav-label {
  flex: 1;
}

.nav-count {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 400;
  color: var(--text-secondary);
}

/* Chats under Ask: indented to the Ask label, with a guide line, so they
   read as Ask's contents. */
.nav-sub {
  margin: var(--s1) 0 0 22px;
  padding-left: var(--s3);
  border-left: 1px solid var(--separator);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-sub-item {
  display: flex;
  align-items: center;
  gap: var(--s2);
  min-height: 36px;
  padding: 0 var(--s2);
  border: 0;
  border-radius: var(--radius-control);
  background: none;
  font-size: 14px;
  color: var(--text-secondary);
  text-align: left;
  cursor: pointer;
}

.nav-sub-item:hover {
  background: var(--subtle);
  color: var(--text);
}

.nav-sub .chat-list .muted {
  padding: var(--s1) var(--s2);
  font-size: 13px;
}

/* ------------------------------------------------------------ Data & files page */

.data-view {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.page {
  max-width: 880px;
  margin: 0 auto;
  padding: var(--s6) var(--s8) var(--s7);
  /* Positioned, so the hidden labels inside stay inside the scrolling page. */
  position: relative;
}

.page-title {
  font-size: 34px;
  line-height: 40px;
  font-weight: 600;
  letter-spacing: -0.03em;
}

.page-lead {
  margin: var(--s2) 0 var(--s5);
  font-size: 16px;
  color: var(--text-secondary);
}

.page-section + .page-section {
  margin-top: var(--s7);
}

.upload-zone-wide {
  padding: var(--s6) var(--s4);
}

.section-label {
  display: flex;
  align-items: baseline;
  gap: var(--s2);
  margin: var(--s5) 0 var(--s2);
}

.section-label .count {
  margin: 0;
}

.section-hint {
  margin: 0 0 var(--s2);
  font-size: 13px;
  color: var(--text-secondary);
}

/* ------------------------------------------------------------ quick start menu */

.quick-start {
  position: relative;
}

.quick-start > summary {
  list-style: none;
}

.quick-start > summary::-webkit-details-marker {
  display: none;
}

.quick-start-menu {
  position: absolute;
  bottom: calc(100% + var(--s2));
  left: 0;
  z-index: 20;
  width: 300px;
  padding: var(--s2);
  display: flex;
  flex-direction: column;
  gap: var(--s2);
  background: var(--raised);
  border: 1px solid var(--separator);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-popover);
}

@media (max-width: 768px) {
  .page {
    padding: var(--s5) var(--s4) var(--s6);
  }

  .page-title {
    font-size: 28px;
    line-height: 34px;
  }

  .quick-start-menu {
    width: min(300px, calc(100vw - 48px));
  }
}

/* ------------------------------------------------------------ exports */

.chart-actions,
.report-actions {
  display: flex;
  gap: var(--s2);
  flex-wrap: wrap;
}

.answer-actions {
  flex-wrap: wrap;
}

.file-card {
  display: flex;
  align-items: center;
  gap: var(--s3);
  margin: var(--s3) 0;
  padding: var(--s3) var(--s4);
  border: 1px solid var(--separator);
  border-radius: var(--radius-card);
  background: var(--raised);
  color: var(--text);
  text-decoration: none;
}

.file-card:hover {
  border-color: var(--action);
}

.file-card-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.file-card-name {
  font-weight: 600;
  overflow-wrap: anywhere;
}

.file-card-meta {
  font-size: 12px;
  color: var(--text-secondary);
}

.citation details > .btn {
  margin: var(--s2) 0 0;
}

/* ------------------------------------------------------------ reports (AI drafts) */

.list-action {
  align-self: flex-start;
  margin-bottom: var(--s3);
}

.report-items {
  display: flex;
  flex-direction: column;
  gap: var(--s1);
}

.report-dialog {
  width: min(640px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  overflow-y: auto;
}

.report-dialog .ask-dialog-label {
  margin-top: var(--s3);
}

.report-fieldset {
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
}

.report-notes {
  max-height: 200px;
  overflow-y: auto;
  border: 1px solid var(--boundary);
  border-radius: var(--radius-control);
  padding: var(--s1) var(--s2);
}

.report-note,
.report-section {
  display: flex;
  align-items: baseline;
  gap: var(--s2);
  padding: var(--s1) 0;
  cursor: pointer;
}

.report-note-order {
  flex: 0 0 1.2em;
  font-size: 12px;
  font-weight: 600;
  color: var(--action);
  text-align: center;
}

.report-sections {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  column-gap: var(--s4);
}

.report-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0 var(--s3);
}

.report-row .ask-dialog-input {
  margin-top: var(--s1);
}

.report-estimate {
  margin: var(--s4) 0 0;
  font-size: 13px;
  color: var(--text-secondary);
}

.report-estimate.is-error,
.report-error {
  color: var(--error);
}

.report-ai-note {
  margin: 0 0 var(--s4);
  padding: var(--s2) var(--s3);
  border-radius: var(--radius-control);
  background: var(--warning-bg);
  font-size: 13px;
}

.report-drafting {
  display: flex;
  align-items: center;
  gap: var(--s2);
  margin: var(--s4) 0 var(--s2);
}

.report-editor-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s3);
  margin: var(--s4) 0 var(--s2);
}

.report-editor-text {
  width: 100%;
  padding: var(--s3);
  border: 1px solid var(--boundary);
  border-radius: var(--radius-control);
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.5;
  background: var(--raised);
  resize: vertical;
}

.report-preview {
  padding: var(--s3) 0;
  border-top: 1px solid var(--separator);
  border-bottom: 1px solid var(--separator);
}

/* ------------------------------------------------------------ projects and tasks */

.view-only {
  margin: var(--s3) var(--s4);
  padding: var(--s3) var(--s4);
  border-radius: var(--radius-card);
  background: var(--info-bg);
  font-size: 14px;
}

.page-actions {
  margin-bottom: var(--s4);
}

.table-scroll {
  overflow-x: auto;
}

.task-table,
.people-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.task-table th,
.task-table td,
.people-table th,
.people-table td {
  padding: var(--s2) var(--s3);
  border-bottom: 1px solid var(--separator);
  text-align: left;
  vertical-align: top;
}

.task-table th,
.people-table th {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
}

.task-table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.task-table tr.is-current td {
  background: var(--subtle);
}

/* The Standards tab for managers: the four kinds on the left, the chosen
   one beside them; stacked on a narrow screen. */
.standards-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: var(--s6);
  align-items: start;
  margin-top: var(--s3);
}

.standards-nav {
  position: sticky;
  top: var(--s4);
  display: grid;
  gap: 2px;
}

.standards-nav a {
  display: grid;
  gap: 1px;
  padding: var(--s2) var(--s3);
  border-radius: var(--radius-control);
  color: var(--text);
  text-decoration: none;
}

.standards-nav a:hover {
  background: var(--subtle);
}

.standards-nav a[aria-current='page'] {
  background: var(--selected);
  color: var(--action);
}

.standards-nav-label {
  font-size: 14px;
  font-weight: 500;
}

.standards-nav-hint {
  color: var(--text-secondary);
  font-size: 12px;
}

.standards-body > .page-section:first-child {
  margin-top: 0;
}

/* The section's heading on the same line as the chosen item's name in
   the nav (the nav item is padded; the heading's line is taller). */
.standards-body {
  padding-top: 4px;
}

/* In the chosen section: its name as a real heading, a short secondary
   description, then the settings as a list of label and value rows, and
   the Edit button under them. */
.standards-body .section-label {
  margin: 0 0 var(--s1);
  font-family: var(--font-sans);
  font-size: 20px;
  line-height: 28px;
  font-weight: 500;
  letter-spacing: -0.01em;
  text-transform: none;
  color: var(--text);
}

.standards-body .section-hint {
  max-width: none;
  margin: 0 0 var(--s4);
  font-size: 13px;
  line-height: 20px;
  color: var(--text-secondary);
}

.standards-body .figure-style-facts {
  grid-template-columns: minmax(160px, max-content) minmax(0, 1fr);
  gap: 0;
  max-width: 640px;
  margin: 0 0 var(--s4);
  border-top: 1px solid var(--separator);
  font-size: 14px;
}

.standards-body .figure-style-facts dt,
.standards-body .figure-style-facts dd {
  margin: 0;
  padding: 9px var(--s4) 9px 0;
  border-bottom: 1px solid var(--separator);
}

.standards-body .figure-style-facts dt {
  font-size: 13px;
  color: var(--text-secondary);
}

.standards-body .figure-style-facts dd {
  color: var(--text);
}

@media (max-width: 760px) {
  .standards-layout {
    grid-template-columns: 1fr;
    gap: var(--s3);
  }

  .standards-nav {
    position: static;
    grid-auto-flow: column;
    overflow-x: auto;
  }

  .standards-nav-hint {
    display: none;
  }
}

/* The project page's tasks: the row shows where the pointer is; the
   task's name is the link. */
.task-table.is-rows tbody tr:hover td {
  background: var(--subtle);
}

.task-row-link {
  color: var(--text);
  text-decoration: none;
}

.task-row-link:hover {
  color: var(--action);
  text-decoration: underline;
}

/* A task's ⋯ menu would be cut off by the table's scroll box: let it out
   while one is open. */
.table-scroll:has(.topbar-menu:not([hidden])),
.table-scroll:has(.picker-list:not([hidden])) {
  overflow: visible;
}

/* The row's ⋯ menu: quiet until the row is hovered or the menu has focus. */
.task-table .row-menu {
  width: 1%;
  padding-top: 4px;
  padding-bottom: 4px;
  vertical-align: middle;
}

.task-table .row-menu .more-button {
  opacity: 0;
}

.task-table tr:hover .row-menu .more-button,
.task-table .row-menu .more-button:focus-visible,
.task-table .row-menu .more-button[aria-expanded='true'] {
  opacity: 1;
}

@media (hover: none) {
  .task-table .row-menu .more-button {
    opacity: 1;
  }
}

/* A column heading with an explanation on hover or focus. */
.th-help {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: help;
}

.th-help .icon {
  opacity: 0.6;
}

.th-help::after {
  content: attr(data-tip);
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 20;
  width: 240px;
  padding: var(--s2) var(--s3);
  border-radius: var(--radius-control);
  background: var(--text);
  color: var(--text-inverse);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.4;
  text-align: left;
  white-space: normal;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s;
}

.th-help:hover::after,
.th-help:focus-visible::after {
  opacity: 1;
}

/* A ⋯ button (the project's actions, a task row's actions). */
.more-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--radius-control);
  background: none;
  color: var(--text-secondary);
  cursor: pointer;
}

.more-button:hover,
.more-button[aria-expanded='true'] {
  border-color: var(--separator);
  background: var(--raised);
  color: var(--text);
}

/* The project's name with its ⋯ menu beside it. */
.page-title-row {
  display: flex;
  align-items: center;
  gap: var(--s2);
}

.topbar-menu.is-left {
  right: auto;
  left: 0;
}

a.topbar-menu-item {
  display: block;
  text-decoration: none;
}

.task-code {
  font-family: var(--font-mono);
  font-size: 13px;
  white-space: nowrap;
}

.row-actions {
  white-space: nowrap;
}

.row-actions .btn + .btn {
  margin-left: var(--s1);
}

.flag {
  font-size: 12px;
  color: var(--warning);
}

.access-select {
  padding: 2px var(--s1);
  border: 1px solid var(--boundary);
  border-radius: var(--radius-control);
  background: var(--raised);
  font: inherit;
  font-size: 13px;
}

.lead-delete {
  display: flex;
  align-items: center;
  gap: var(--s1);
  margin-top: var(--s1);
  font-weight: 400;
  white-space: nowrap;
}

.people-table .add-row td {
  border-bottom: 0;
  padding-top: var(--s3);
}

.people-table .add-row .ask-dialog-input {
  min-width: 200px;
}

.invite-result {
  margin-top: var(--s4);
  padding: var(--s3) var(--s4);
  border-radius: var(--radius-card);
  background: var(--subtle);
}

.invite-result p {
  margin: 0 0 var(--s2);
}

.invite-link {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s2);
  overflow-wrap: anywhere;
}

.form-dialog {
  width: min(560px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  overflow-y: auto;
}

.form-dialog .ask-dialog-label {
  margin-top: var(--s3);
}

.form-heading {
  margin: var(--s5) 0 0;
  padding-top: var(--s3);
  border-top: 1px solid var(--separator);
  font-size: 14px;
  font-weight: 600;
}

.form-hint {
  margin: var(--s1) 0 0;
  font-size: 12px;
  color: var(--text-secondary);
}

.form-check {
  margin-top: var(--s3);
}

.people-table .pending-row td {
  color: var(--text-secondary);
}

/* ------------------------------------------------------------ directory and navigation */

a.brand {
  color: inherit;
  text-decoration: none;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--s2);
  min-width: 0;
  margin-left: var(--s4);
  font-size: 13px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
}

.breadcrumb a {
  color: var(--text-secondary);
}

.breadcrumb [aria-current] {
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
}

.crumb-sep {
  color: var(--boundary);
}

.layout.is-home .sidebar,
.layout.is-home .scrim {
  display: none;
}

/* Plain links take the brand's action color, never the browser's blue. */
a:not([class]) {
  color: var(--action);
  text-underline-offset: 2px;
}

a:not([class]):hover {
  color: var(--action-hover, var(--action));
}

.link-button {
  padding: 0;
  border: 0;
  background: none;
  color: var(--action);
  font: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}

.level-pill {
  justify-self: end;
  padding: 1px var(--s2);
  border-radius: var(--radius-control);
  background: var(--subtle);
  font-size: 12px;
  color: var(--text-secondary);
}

/* The Directory: each project a card (its site's picture, facts and
   tasks) in a grid, or a compact row in the list view. */
/* The Directory and a project's page use a wider page than the others:
   1440 px, room for four cards and longer list rows. */
.page.is-wide,
.page:has(> .dir-grid) {
  max-width: 1440px;
}

.dir-sub {
  margin: var(--s1) 0 0;
  color: var(--text-secondary);
  font-size: 13px;
}

.dir-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: var(--s2);
  margin: var(--s5) 0 var(--s3);
}

.dir-search {
  flex: 0 1 360px;
  min-width: 200px;
  display: flex;
  align-items: center;
  gap: var(--s2);
  padding: 0 var(--s3);
  border: 1px solid var(--separator);
  border-radius: var(--radius-control);
  background: var(--raised);
  color: var(--text-secondary);
}

.dir-search input {
  flex: 1;
  min-width: 0;
  padding: 7px 0;
  border: 0;
  background: none;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  outline: none;
}

/* The search, the filter and the view toggle share one height, so their
   edges line up. */
.dir-search,
.dir-filter,
.dir-view {
  box-sizing: border-box;
  height: 40px;
}

/* A small menu in the app's look (pickerHtml in script.js): the button
   like the model picker (.model-select), the list like the app's other
   menus. */
.picker {
  position: relative;
  display: inline-flex;
}

.picker-button {
  box-sizing: border-box;
  height: 100%;
  /* The same surface and outline as the search box and the view toggle
     beside it, so only the chosen view is tinted. */
  border-color: var(--separator);
  background-color: var(--raised);
  padding-left: 12px;
  padding-right: 32px;
  background-position: right 12px center;
  color: var(--text);
  font-size: 13px;
  font-weight: 400;
  text-align: left;
}

.picker-button:hover,
.picker-button[aria-expanded='true'] {
  border-color: rgba(48, 47, 37, 0.28);
  background-color: var(--raised);
}

.picker-list {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  z-index: 20;
  min-width: 100%;
  margin: 0;
  padding: 4px;
  list-style: none;
  background: var(--raised);
  border: 1px solid var(--separator);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-popover);
  outline: none;
}

.picker-list [role='option'] {
  position: relative;
  padding: 7px 12px 7px 30px;
  border-radius: var(--radius-control);
  font-size: 13px;
  white-space: nowrap;
  cursor: pointer;
}

.picker-list [role='option'].is-active {
  background: var(--selected);
}

/* The current choice: a check before it. */
.picker-list [role='option'][aria-selected='true']::before {
  content: '';
  position: absolute;
  left: 11px;
  top: 50%;
  width: 9px;
  height: 5px;
  border-left: 1.6px solid var(--action);
  border-bottom: 1.6px solid var(--action);
  transform: translateY(-70%) rotate(-45deg);
}

.dir-filter,
.dir-sort {
  height: 40px;
}

/* The browser's own clear button takes the system's accent color; the
   app draws its own. */
.dir-search input::-webkit-search-cancel-button {
  appearance: none;
}

.dir-search-clear {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  margin-right: -4px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--text-secondary);
  cursor: pointer;
}

.dir-search-clear[hidden] {
  display: none;
}

.dir-search-clear:hover {
  background: var(--subtle);
  color: var(--text);
}

.dir-view {
  display: inline-flex;
  align-items: stretch;
}

/* Sort and view at the right end of the row, however short the search. */
.dir-tools-end {
  display: flex;
  align-items: stretch;
  gap: var(--s2);
  margin-left: auto;
}

/* Both choices the same width. */
.dir-view button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  padding: 0;
}

.dir-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--s5);
  margin-top: var(--s4);
}

.dir-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: var(--radius-card);
  background: #fcfbf7;
  /* Lines inside a card: fainter than the page's dividers. */
  --card-line: rgba(48, 47, 37, 0.07);
  /* A shadow instead of an outline: a tight contact shadow under the
     design's soft one, so a light card lifts off the warm page. */
  box-shadow:
    0 1px 2px 0 rgba(48, 47, 37, 0.08),
    0 6px 20px 0 rgba(48, 47, 37, 0.1);
}

.dir-card[hidden] {
  display: none;
}

/* The cover: an illustration (decorative). */
.dir-card-pic {
  position: relative;
  display: block;
  /* Taller than the text under it, so the picture leads the card. */
  aspect-ratio: 16 / 10;
  background: var(--subtle);
}

/* Film grain over the cover: fine grey noise (an SVG turbulence filter,
   drawn by the browser, no extra file), blended soft-light so it lightens
   and darkens a little evenly, a texture rather than dark specks. */
.dir-card-pic::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 160px 160px;
  opacity: 0.6;
  mix-blend-mode: soft-light;
}

.dir-art {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.dir-card-body {
  flex: 1;
  padding: var(--s4) var(--s5) var(--s3);
}

.dir-card-code {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-secondary);
}

.dir-card-title {
  margin: 4px 0 2px;
  font-size: 17px;
  font-weight: 500;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.dir-card-title a {
  color: var(--text);
  text-decoration: none;
}

.dir-card-title a:hover {
  text-decoration: underline;
}

/* Under the title, one quiet line: the client and the site. */
.dir-card-facts {
  margin: 2px 0 0;
  overflow: hidden;
  font-size: 12px;
  line-height: 18px;
  color: rgba(96, 103, 94, 0.8);
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* The footer's one line: your role, tasks and files. */
.dir-card-stats {
  color: var(--text-secondary);
}

.dir-card-tasks {
  margin-top: var(--s3);
  border-top: 1px solid var(--card-line);
}

.dir-card-task {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: baseline;
  gap: var(--s2);
  padding: 6px 0;
  border-bottom: 1px solid var(--card-line);
  color: var(--text);
  font-size: 13px;
  text-decoration: none;
}

.dir-card-task:last-child {
  border-bottom: 0;
}

/* Cards open the project: the whole card is the title's link, and the
   tasks are left to the list view (their number is in the footer), so a
   project with many tasks never stretches the cards beside it. */
.dir-grid:not(.is-list) .dir-card {
  position: relative;
}

.dir-grid:not(.is-list) .dir-card-title a::after {
  content: '';
  position: absolute;
  inset: 0;
}

.dir-grid:not(.is-list) .dir-card:hover .dir-card-title a,
.dir-grid:not(.is-list) .dir-card:hover .dir-card-foot a {
  color: var(--action);
}

.dir-grid:not(.is-list) .dir-card-tasks {
  display: none;
}

.dir-grid:not(.is-list) .dir-card-title a:hover {
  text-decoration: none;
}

.dir-card-task:hover {
  color: var(--action);
}

.dir-card-task .task-code {
  font-size: 12px;
  color: var(--text-secondary);
}

.dir-card-task-name {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.dir-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s3);
  padding: var(--s2) var(--s5);
  border-top: 1px solid var(--card-line);
  font-size: 13px;
}

.dir-card-foot a {
  color: var(--text);
  text-decoration: none;
}

.dir-card-foot a:hover {
  color: var(--action);
}

/* The list view: one row per project, a small picture at the left. */
.dir-grid.is-list[data-variant='row'] {
  grid-template-columns: 1fr;
  gap: 0;
  /* Fainter than the page's dividers: they separate rows, quietly. */
  border-top: 1px solid rgba(48, 47, 37, 0.08);
}

.dir-grid.is-list[data-variant='row'] .dir-card {
  display: grid;
  grid-template-columns: 80px minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--s4);
  border: 0;
  border-bottom: 1px solid rgba(48, 47, 37, 0.08);
  border-radius: 0;
  box-shadow: none;
  background: none;
  padding: var(--s3) 0;
}

.dir-grid.is-list[data-variant='row'] .dir-card[hidden] {
  display: none;
}

/* In the list, a small upright picture, 80 x 100, taller only when the
   row's text is (a project number above the name). */
.dir-grid.is-list[data-variant='row'] .dir-card-pic {
  align-self: stretch;
  aspect-ratio: auto;
  min-height: 100px;
  overflow: hidden;
}

.dir-grid.is-list[data-variant='row'] .dir-card-title {
  font-size: 16px;
}

.dir-grid.is-list[data-variant='row'] .dir-card-body > :first-child {
  margin-top: 0;
}

.dir-grid.is-list[data-variant='row'] .dir-card-body {
  /* As tall as the picture at least: the name at its top edge, the task
     chips on its bottom edge. */
  display: flex;
  flex-direction: column;
  align-self: stretch;
  min-height: 100%;
  padding: 0;
}

.dir-grid.is-list[data-variant='row'] .dir-card-tasks {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s1) var(--s3);
  border-top: 0;
  margin-top: auto;
  padding-top: var(--s1);
}

/* In the list, each task a small chip: plainly a link to open. */
.dir-grid.is-list[data-variant='row'] .dir-card-task {
  display: inline-flex;
  align-items: baseline;
  gap: var(--s1);
  padding: 3px var(--s2);
  border: 1px solid var(--separator);
  border-radius: var(--radius-control);
  background: var(--raised);
}

.dir-grid.is-list[data-variant='row'] .dir-card-task:last-child {
  border-bottom: 1px solid var(--separator);
}

.dir-grid.is-list[data-variant='row'] .dir-card-task:hover {
  border-color: var(--action);
  background: var(--selected);
}

.dir-grid.is-list[data-variant='row'] .dir-card-task span[aria-hidden] {
  color: var(--text-secondary);
}

.dir-grid.is-list[data-variant='row'] .dir-card-foot {
  flex-direction: column;
  align-items: flex-end;
  gap: var(--s1);
  border: 0;
  padding: 0;
}

@media (max-width: 600px) {
  .dir-grid.is-list[data-variant='row'] .dir-card {
    grid-template-columns: 64px minmax(0, 1fr);
  }

  .dir-grid.is-list[data-variant='row'] .dir-card-foot {
    grid-column: 2;
    flex-direction: row;
  }
}

/* The list view: a compact card per project, in two columns where they fit:
   a small upright picture at the left, and beside it the name, the client
   and site, the task chips, and a last line with your role, the counts and
   Open project. Everything sits in the text column, so no row is left
   with an empty middle. */
.dir-grid.is-list[data-variant='bento'] {
  /* Two columns where they fit, each card as tall as its own content: a
     project with many tasks is a taller card, and the cards under its
     neighbour move up instead of leaving a gap. The order runs down the
     first column, then the second. */
  display: block;
  columns: 2 460px;
  column-gap: var(--s3);
}

.dir-grid.is-list[data-variant='bento'] .dir-card {
  break-inside: avoid;
  margin-bottom: var(--s3);
}

.dir-grid.is-list[data-variant='bento'] .dir-card {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  grid-template-rows: 1fr auto;
  column-gap: var(--s4);
  padding: var(--s3);
  /* Lighter than a cover card's lift: these sit close together. */
  box-shadow:
    0 1px 2px 0 rgba(48, 47, 37, 0.08),
    0 2px 8px 0 rgba(48, 47, 37, 0.06);
}

.dir-grid.is-list[data-variant='bento'] .dir-card[hidden] {
  display: none;
}

/* The picture runs the card's height, 88 px wide, 120 at least. */
.dir-grid.is-list[data-variant='bento'] .dir-card-pic {
  grid-row: 1 / 3;
  align-self: stretch;
  aspect-ratio: auto;
  min-height: 120px;
  overflow: hidden;
  border-radius: calc(var(--radius-card) - 4px);
}

.dir-grid.is-list[data-variant='bento'] .dir-card-title {
  font-size: 16px;
}

.dir-grid.is-list[data-variant='bento'] .dir-card-body > :first-child {
  margin-top: 0;
}

.dir-grid.is-list[data-variant='bento'] .dir-card-body {
  padding: 0;
}

.dir-grid.is-list[data-variant='bento'] .dir-card-tasks {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s1) var(--s2);
  border-top: 0;
  margin-top: var(--s2);
}

/* In the list, each task a small chip: plainly a link to open. */
.dir-grid.is-list[data-variant='bento'] .dir-card-task {
  display: inline-flex;
  align-items: baseline;
  gap: var(--s1);
  max-width: 100%;
  padding: 3px var(--s2);
  border: 1px solid var(--separator);
  border-radius: var(--radius-control);
  background: var(--raised);
}

.dir-grid.is-list[data-variant='bento'] .dir-card-task:last-child {
  border-bottom: 1px solid var(--separator);
}

.dir-grid.is-list[data-variant='bento'] .dir-card-task:hover {
  border-color: var(--action);
  background: var(--selected);
}

.dir-grid.is-list[data-variant='bento'] .dir-card-task span[aria-hidden] {
  color: var(--text-secondary);
}

/* The last line, at the card's bottom: role and counts, Open project. */
.dir-grid.is-list[data-variant='bento'] .dir-card-foot {
  grid-column: 2;
  align-self: end;
  gap: var(--s3);
  margin-top: var(--s2);
  padding: var(--s2) 0 0;
  font-size: 12px;
}

@media (max-width: 600px) {
  .dir-grid.is-list[data-variant='bento'] .dir-card {
    grid-template-columns: 64px minmax(0, 1fr);
  }
}

/* The row/bento switch while the list layouts are compared (localhost and
   staging only). */
.dir-variant[hidden] {
  display: none;
}

.dir-variant button {
  width: auto;
  padding: 0 var(--s2);
  font-size: 12px;
}

/* The Directory's title with its actions (New project, the demos) on the
   same row, wrapping under it when narrow. */
.dir-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--s3) var(--s4);
}

.dir-new {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s2);
}

/* An outlined button beside the filled one reads a little smaller: one
   pixel more makes them look the same height. */
.dir-new .btn-secondary {
  min-height: 45px;
}

.getting-started {
  margin-top: var(--s4);
  padding: var(--s4) var(--s5);
  border-radius: var(--radius-card);
  background: var(--subtle);
}

.getting-started h2 {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: var(--s2);
}

.getting-started ol {
  list-style: none;
  margin: 0 0 var(--s3);
  padding: 0;
}

.getting-started li {
  display: flex;
  align-items: center;
  gap: var(--s2);
  padding: var(--s1) 0;
}

.getting-started li .icon {
  color: var(--text-secondary);
}

.getting-started li.is-done {
  color: var(--text-secondary);
}

.getting-started li.is-done .icon {
  color: var(--success);
}

.empty-state {
  margin-top: var(--s6);
}

.tabs {
  display: flex;
  gap: var(--s5);
  margin: var(--s4) 0 var(--s4);
  border-bottom: 1px solid var(--separator);
}

.tabs a {
  padding-bottom: var(--s2);
  color: var(--text-secondary);
  text-decoration: none;
}

.tabs a[aria-current] {
  color: var(--text);
  border-bottom: 2px solid var(--text);
}

.budget-bar {
  height: 8px;
  max-width: 420px;
  margin: var(--s2) 0;
  border-radius: 4px;
  background: var(--subtle);
  overflow: hidden;
}

.budget-bar span {
  display: block;
  height: 100%;
  background: var(--action);
}

.member-list {
  list-style: none;
  margin: var(--s2) 0;
  padding: 0;
}

.member-list li {
  padding: var(--s1) 0;
}

@media (max-width: 768px) {
  .breadcrumb {
    display: none;
  }

  .dir-task {
    grid-template-columns: 1fr auto;
  }

  .dir-task .report-meta {
    display: none;
  }
}

.budget-cell {
  white-space: nowrap;
}

.budget-cell .link-button {
  margin-left: var(--s2);
  font-size: 13px;
}

.request-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: var(--s4);
}

.request-list li + li {
  padding-top: var(--s4);
  border-top: 1px solid var(--separator);
}

.request-list .report-actions {
  margin-top: var(--s2);
}

.budget-request {
  margin-top: var(--s1);
  font-size: 12px;
  color: var(--warning);
}

.budget-request .link-button {
  margin-left: var(--s2);
  font-size: 12px;
}

/* ------------------------------------------------------------ unfinished answers, waiting */

.unfinished {
  margin-top: var(--s4);
  padding: var(--s3) var(--s4);
  border-radius: var(--radius-card);
  background: var(--warning-bg);
}

.unfinished p {
  margin: 0 0 var(--s2);
}

.unfinished .state-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s2) var(--s3);
}

.state-note {
  margin: var(--s2) 0 0;
  font-size: 13px;
  color: var(--text-secondary);
}

.answer-ready {
  display: inline-flex;
  align-items: center;
  gap: var(--s1);
  padding: var(--s1) var(--s3);
  border-radius: var(--radius-control);
  background: var(--success-bg);
  font-size: 13px;
}

.capture-zone {
  margin-top: var(--s3);
  max-width: 560px;
}

.capture-zone-head {
  display: flex;
  align-items: center;
  gap: var(--s3);
  margin-bottom: var(--s2);
  font-size: 13px;
}

.capture-zone-score {
  flex: 1;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

.capture-zone canvas {
  display: block;
  max-width: 100%;
  border: 1px solid var(--separator);
  border-radius: var(--radius-control);
  touch-action: none;
  cursor: ns-resize;
}

.capture-zone-caption {
  margin: var(--s2) 0 0;
  font-size: 12px;
  color: var(--text-secondary);
}

/* ------------------------------------------------------------ note editor */
/* A saved note opened with edit access: a page you type into (Editor.js),
   under a fixed Word-like toolbar. Editor.js's own look is replaced with the
   app's tokens so it reads as part of the app. */

.note-head {
  position: sticky;
  /* Sticky stops at the scroll area's padding; this puts it flush at the top. */
  top: calc(-1 * var(--s6));
  z-index: 5;
  margin: calc(-1 * var(--s6)) calc(-1 * var(--s8)) var(--s6);
  padding: var(--s3) var(--s8) 0;
  background: var(--canvas);
}

.note-topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s1) var(--s3);
  min-height: 40px;
  margin-bottom: var(--s2);
  color: var(--text-secondary);
  font-size: 13px;
}

.note-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px;
  padding: var(--s1) 0;
  border-top: 1px solid var(--separator);
  border-bottom: 1px solid var(--separator);
}

.note-tool {
  display: inline-flex;
  align-items: center;
  gap: var(--s1);
  min-width: 32px;
  height: 32px;
  justify-content: center;
  padding: 0 var(--s2);
  border: 0;
  border-radius: var(--radius-control);
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

.note-tool:hover {
  background: var(--subtle);
}

.note-tool.is-on {
  background: var(--selected);
  color: var(--action);
}

.note-tool:focus-visible,
.note-style-select:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 1px;
}

.note-tool-sep {
  width: 1px;
  height: 20px;
  margin: 0 var(--s1);
  background: var(--separator);
}

.note-tool-fill {
  flex: 1;
}

.note-style-select {
  height: 32px;
  padding: 0 var(--s2);
  border: 1px solid var(--separator);
  border-radius: var(--radius-control);
  background: var(--raised);
  color: var(--text);
  font: inherit;
  font-size: 13px;
}

.note-page {
  max-width: 720px;
}

.note-title {
  /* The note's own font and heading color, as in its PDF and Word export. */
  font-family: var(--note-font, var(--font-sans));
  font-size: 34px;
  line-height: 1.2;
  font-weight: 600;
  color: var(--note-heading-color, var(--text));
  outline: none;
  border-radius: var(--radius-control);
}

.note-title:focus {
  background: var(--subtle);
}

.note-props {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s1) var(--s4);
  margin: var(--s2) 0 var(--s4);
  color: var(--text-secondary);
  font-size: 13px;
}

.note-version,
.note-status {
  font-family: var(--font-mono);
  font-size: 12px;
}

.note-status.is-error {
  color: var(--error);
}

.note-actions {
  display: flex;
  gap: var(--s2);
  margin-left: auto;
}

.note-conflict {
  margin-bottom: var(--s4);
  padding: var(--s3) var(--s4);
  border: 1px solid var(--warning);
  border-radius: var(--radius-card);
  background: var(--warning-bg);
}

.note-conflict-actions {
  display: flex;
  gap: var(--s2);
  margin: var(--s2) 0;
}

.note-question {
  margin-bottom: var(--s4);
  padding: var(--s2) var(--s3);
  border-radius: var(--radius-card);
  background: var(--subtle);
  color: var(--text-secondary);
  font-size: 14px;
}

.note-question summary {
  cursor: pointer;
  font-weight: 500;
}

/* Editor.js, in the app's look */
.note-editor .codex-editor {
  font-family: var(--note-font, var(--font-sans));
  font-size: var(--note-size, 15px);
  line-height: 1.6;
  color: var(--text);
}

.note-editor .ce-block__content,
.note-editor .ce-toolbar__content {
  max-width: 720px;
}

.note-editor .ce-block--selected .ce-block__content {
  background: var(--selected);
}

.note-editor .ce-header {
  font-family: var(--font-sans);
  font-weight: 600;
  padding: var(--s2) 0 var(--s1);
}

.note-editor h1.ce-header {
  font-size: 1.6em;
}

.note-editor h2.ce-header {
  font-size: 1.35em;
}

.note-editor h3.ce-header,
.note-editor h4.ce-header {
  font-size: 1.15em;
}

.note-editor .ce-toolbar__plus,
.note-editor .ce-toolbar__settings-btn {
  color: var(--text-secondary);
  border-radius: var(--radius-control);
}

.note-editor .ce-toolbar__plus:hover,
.note-editor .ce-toolbar__settings-btn:hover {
  background: var(--subtle);
}

.note-editor .tc-wrap {
  --color-border: var(--separator);
  --color-background: var(--subtle);
}

.note-editor .tc-row--heading {
  font-weight: 600;
}

.note-editor .cdx-quote__text {
  min-height: 0;
  border-left: 3px solid var(--separator);
  padding-left: var(--s4);
  border-radius: 0;
  box-shadow: none;
}

.note-editor .cdx-quote__caption {
  display: none;
}

.note-editor .ce-delimiter::before {
  color: var(--boundary);
}

.note-editor mark,
.note-editor .cdx-marker {
  background: var(--warning-bg);
  color: inherit;
}

.ce-popover,
.ce-inline-toolbar,
.ce-conversion-toolbar,
.ce-settings {
  --color-background: var(--raised);
  --color-text-primary: var(--text);
  --color-text-secondary: var(--text-secondary);
  --color-border: var(--separator);
  --color-background-item-hover: var(--subtle);
  --color-background-item-focus: var(--selected);
  font-family: var(--font-sans);
}

.note-chart-block .chart {
  margin: var(--s2) 0;
}

.note-markdown-block {
  padding: var(--s2) var(--s3);
  border: 1px dashed var(--separator);
  border-radius: var(--radius-control);
}

.note-markdown-text {
  width: 100%;
  font-family: var(--font-mono);
  font-size: 13px;
}

/* History, beside the page */
.note-history {
  /* Drops down from the header's top line, right-aligned like its menus. */
  position: absolute;
  top: 52px;
  right: var(--s8);
  width: 320px;
  max-height: min(70vh, 560px);
  overflow-y: auto;
  padding: var(--s3) var(--s4);
  border: 1px solid var(--separator);
  border-radius: var(--radius-card);
  background: var(--raised);
  box-shadow: var(--shadow-popover);
  z-index: 9;
}

.note-history-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--s2);
}

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

.note-history-item {
  display: flex;
  flex-direction: column;
  width: 100%;
  padding: var(--s2);
  border: 0;
  border-bottom: 1px solid var(--separator);
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}

.note-history-item:hover {
  background: var(--subtle);
}

.note-history-title {
  margin-top: var(--s3);
  font-size: 14px;
}

.note-diff {
  max-height: 320px;
  overflow: auto;
  white-space: pre-wrap;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.5;
  padding: var(--s2);
  background: var(--subtle);
  border-radius: var(--radius-control);
}

.note-diff ins,
.note-history ins {
  background: var(--success-bg);
  color: var(--success);
  text-decoration: none;
}

.note-diff del,
.note-history del {
  background: var(--error-bg);
  color: var(--error);
}

.note-insert-select {
  height: 32px;
  padding: 0 var(--s2);
  border: 1px solid var(--separator);
  border-radius: var(--radius-control);
  background: var(--raised);
  color: var(--text);
  font: inherit;
  font-size: 13px;
}

.note-tool-ai {
  color: var(--action);
  font-weight: 500;
}

.note-ai-placeholder {
  display: flex;
  align-items: center;
  gap: var(--s2);
  padding: var(--s2) var(--s3);
  border: 1px dashed var(--separator);
  border-radius: var(--radius-control);
  color: var(--text-secondary);
  font-size: 14px;
}

.note-ai-card {
  margin: var(--s2) 0 var(--s4);
  padding: var(--s3) var(--s4);
  border: 1px solid var(--action);
  border-radius: var(--radius-card);
  background: var(--raised);
  font-family: var(--font-sans);
}

.note-ai-card .note-diff {
  font-family: var(--note-font, var(--font-sans));
  font-size: 14px;
  line-height: 1.6;
}

.note-ai-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--s3);
  margin-bottom: var(--s2);
}

.note-ai-tag {
  display: inline-flex;
  align-items: center;
  gap: var(--s1);
  padding: 2px var(--s2);
  border-radius: var(--radius-control);
  background: var(--selected);
  color: var(--action);
  font-size: 12px;
}

.note-ai-working {
  display: flex;
  align-items: center;
  gap: var(--s2);
  color: var(--text-secondary);
}

.note-ai-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2);
  margin-top: var(--s3);
}

.note-font-select,
.note-size-select {
  height: 32px;
  padding: 0 var(--s2);
  border: 1px solid var(--separator);
  border-radius: var(--radius-control);
  background: var(--raised);
  color: var(--text);
  font: inherit;
  font-size: 13px;
}

.note-font-select {
  max-width: 150px;
}

.note-style-button {
  font-size: 13px;
}

/* Text colors for selected words (report_style.TEXT_CLASSES), wherever a
   note is shown. */
.tc-red {
  color: #9b3f36;
}
.tc-ochre {
  color: #805b18;
}
.tc-green {
  color: #2f7d45;
}
.tc-blue {
  color: #2b6cb0;
}
.tc-purple {
  color: #7b5bc0;
}
.tc-grey {
  color: #60675e;
}

.note-editor .codex-editor {
  color: var(--note-text-color, var(--text));
}

.note-editor .ce-header {
  color: var(--note-heading-color, var(--text));
}

.note-color-wrap {
  position: relative;
  display: inline-flex;
}

.note-color-palette {
  position: absolute;
  top: 36px;
  left: 0;
  z-index: 8;
  display: grid;
  grid-template-columns: repeat(6, 28px);
  gap: var(--s1);
  padding: var(--s2);
  border: 1px solid var(--separator);
  border-radius: var(--radius-card);
  background: var(--raised);
  box-shadow: var(--shadow-popover);
}

.note-color-palette.hidden {
  display: none;
}

.note-swatch {
  width: 28px;
  height: 28px;
  padding: 4px;
  border: 0;
  border-radius: var(--radius-control);
  background: transparent;
  cursor: pointer;
}

.note-swatch span {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 50%;
}

.note-swatch:hover,
.note-swatch-clear:hover {
  background: var(--subtle);
}

.note-swatch-clear {
  grid-column: 1 / -1;
  padding: var(--s1) var(--s2);
  border: 0;
  border-radius: var(--radius-control);
  background: transparent;
  color: var(--text-secondary);
  font: inherit;
  font-size: 12px;
  text-align: left;
  cursor: pointer;
}

/* The selection toolbar's color palette, placed at the selected words. */
.note-color-palette.note-color-float {
  position: fixed;
  z-index: 50;
}

/* The table plugin makes the header row sticky (z-index 2) but leaves its
   own row/column menus at 1, so the header covered them. */
.note-editor .tc-toolbox {
  z-index: 3;
}

/* Minimal header controls: borderless, quiet until hovered. */
.note-style-select {
  border-color: transparent;
  background: transparent;
  padding: 0 var(--s2);
  cursor: pointer;
}

.note-style-select:hover {
  background: var(--subtle);
}

.note-top-button,
.note-menu-toggle {
  display: inline-flex;
  align-items: center;
  gap: var(--s1);
  height: 32px;
  padding: 0 var(--s2);
  border: 0;
  border-radius: var(--radius-control);
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

.note-topbar .note-top-button,
.note-topbar .note-menu-toggle {
  color: var(--text-secondary);
}

.note-top-button:hover,
.note-menu-toggle:hover,
.note-menu-toggle[aria-expanded='true'] {
  background: var(--subtle);
  color: var(--text);
}

.note-ai-button {
  display: inline-flex;
  align-items: center;
  gap: var(--s1);
  height: 32px;
  padding: 0 var(--s3);
  border: 0;
  border-radius: var(--radius-control);
  background: var(--selected);
  color: var(--action);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}

.note-ai-button:hover {
  background: var(--success-bg);
  color: var(--action-hover);
}

.note-top-button:focus-visible,
.note-menu-toggle:focus-visible,
.note-ai-button:focus-visible,
.note-menu-item:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 1px;
}

.note-menu {
  position: relative;
  display: inline-flex;
}

.note-menu-list {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 9;
  display: flex;
  flex-direction: column;
  min-width: 200px;
  padding: var(--s1);
  border: 1px solid var(--separator);
  border-radius: var(--radius-card);
  background: var(--raised);
  box-shadow: var(--shadow-popover);
}

.note-topbar .note-menu-list {
  left: auto;
  right: 0;
}

.note-menu-list.hidden {
  display: none;
}

.note-menu-item {
  display: flex;
  align-items: center;
  gap: var(--s2);
  padding: var(--s2);
  border: 0;
  border-radius: var(--radius-control);
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}

.note-menu-item:hover {
  background: var(--subtle);
}

.note-menu-sep {
  height: 1px;
  margin: var(--s1) 0;
  background: var(--separator);
}

.note-eyebrow {
  margin-bottom: var(--s2);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.note-byline {
  margin: var(--s2) 0 var(--s5);
  color: var(--text-secondary);
  font-size: 13px;
}

.note-status::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: var(--s1);
  border-radius: 50%;
  background: var(--success);
  vertical-align: middle;
}

.note-status.is-error::before {
  background: var(--error);
}

/* Editor.js's "narrow" layout puts the block controls (+, drag) and their
   menus at the far right. The note page has room on the left, so keep the
   controls in the left gutter and open the "/" and block menus from there,
   beside the line being typed. */
.note-editor .codex-editor--narrow .ce-toolbar__actions {
  right: 100%;
  left: auto;
  padding-right: var(--s1);
}

.note-editor .codex-editor--narrow .ce-toolbox .ce-popover,
.note-editor .codex-editor--narrow .ce-settings .ce-popover {
  right: auto;
  left: 0;
}

.note-editor .codex-editor--narrow .codex-editor__redactor {
  margin-right: 0;
}

/* Font and size in the toolbar: borderless like "Normal text". */
.note-head .note-font-select,
.note-head .note-size-select {
  border-color: transparent;
  background: transparent;
  cursor: pointer;
}

.note-head .note-font-select:hover,
.note-head .note-size-select:hover {
  background: var(--subtle);
}

/* Insert and the more menu wrap together, never apart. */
.note-tool-group {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

/* ---------------------------------------------------------------- figures */
/* A figure from the validated monitoring data (figure-builder.js): the
   chart, its statistics table and method, and the builder that makes it. */

.figure-canvas {
  height: 320px;
}

.figure-block .chart-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2);
}

.figure-stale {
  margin-bottom: var(--s3);
  padding: var(--s2) var(--s3);
  border-radius: var(--radius-control);
  background: var(--warning-bg);
  color: var(--warning);
  font-size: 13px;
}

.figure-warnings {
  margin: var(--s3) 0 0;
  padding-left: var(--s4);
  color: var(--text-secondary);
  font-size: 13px;
}

.figure-stats {
  margin-top: var(--s3);
}

.figure-stats summary {
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
}

.figure-stats .table-scroll {
  overflow-x: auto;
  margin-top: var(--s2);
}

.figure-stats table {
  border-collapse: collapse;
  font-size: 12px;
  width: 100%;
}

.figure-stats th,
.figure-stats td {
  padding: var(--s1) var(--s2);
  border-bottom: 1px solid var(--separator);
  text-align: left;
  white-space: nowrap;
}

.figure-stats td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.figure-method {
  margin: var(--s2) 0 0;
  color: var(--text-secondary);
  font-size: 12px;
}

.figure-chat-host {
  margin: var(--s4) 0;
}

.figure-builder {
  padding: var(--s4);
  border: 1px solid var(--separator);
  border-radius: var(--radius-card);
  background: var(--raised);
}

.fb-head {
  margin-bottom: var(--s3);
}

.fb-title {
  margin: 0;
  font-size: 16px;
  line-height: 24px;
}

.fb-section {
  margin: 0 0 var(--s4);
  padding: 0;
  border: 0;
}

.fb-section legend {
  margin-bottom: var(--s2);
  font-size: 13px;
  font-weight: 600;
}

.fb-radio {
  display: flex;
  gap: var(--s2);
  align-items: flex-start;
  margin-bottom: var(--s2);
  font-size: 14px;
}

.fb-about {
  display: block;
  color: var(--text-secondary);
  font-size: 12px;
}

.fb-field {
  display: flex;
  flex-direction: column;
  gap: var(--s1);
  margin-bottom: var(--s3);
  font-size: 13px;
}

.fb-field select,
.fb-field input[type='text'],
.fb-field input[type='date'] {
  max-width: 100%;
}

.fb-label {
  font-size: 13px;
}

.fb-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s4);
}

.fb-choices {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s1) var(--s4);
}

.fb-wells {
  max-height: 140px;
  overflow-y: auto;
}

.fb-check {
  display: inline-flex;
  gap: var(--s1);
  align-items: center;
  font-size: 13px;
}

.fb-meta,
.fb-hint {
  color: var(--text-secondary);
  font-size: 12px;
}

.fb-hint {
  margin: 0;
}

.fb-ask {
  padding: var(--s2);
  border-left: 3px solid var(--warning);
  background: var(--warning-bg);
  border-radius: var(--radius-control);
}

.fb-questions {
  margin-bottom: var(--s4);
  padding: var(--s3);
  border-radius: var(--radius-control);
  background: var(--warning-bg);
  color: var(--text);
  font-size: 13px;
}

.fb-questions p,
.fb-questions ul {
  margin: 0;
}

.fb-questions ul {
  padding-left: var(--s4);
}

.fb-mapgrid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0 var(--s4);
}

.fb-analytes,
.fb-issues {
  margin: 0 0 var(--s3);
  padding-left: var(--s4);
  font-size: 13px;
}

.fb-issue-warning,
.fb-issue-question {
  color: var(--warning);
}

.fb-summary {
  font-size: 13px;
}

.fb-error {
  margin: 0 0 var(--s2);
  color: var(--error);
  font-size: 13px;
}

.fb-error:empty {
  display: none;
}

.fb-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s2);
}

.fb-mapping {
  margin-left: auto;
}

.fb-preview:not(:empty) {
  margin-bottom: var(--s3);
}

/* An analysis that could not run on the data: said plainly, the data still drawn. */
.figure-unavailable {
  margin: 0 0 var(--s3);
  padding: var(--s2) var(--s3) var(--s2) var(--s5);
  border-radius: var(--radius-control);
  background: var(--info-bg);
  color: var(--text);
  font-size: 13px;
}

.figure-click {
  margin: var(--s1) 0 0;
}

.figure-panel {
  margin-top: var(--s4);
}

.figure-panel-title {
  margin: 0 0 var(--s2);
  font-size: 13px;
  font-weight: 600;
}

.figure-canvas-small {
  height: 200px;
}

.figure-sources {
  margin-top: var(--s3);
  padding: var(--s3);
  border: 1px solid var(--separator);
  border-radius: var(--radius-control);
  font-size: 12px;
}

.figure-sources-head {
  display: flex;
  gap: var(--s2);
  align-items: baseline;
  margin-bottom: var(--s2);
}

.figure-sources-head .link-button {
  margin-left: auto;
}

.figure-sources table,
.fb-table {
  border-collapse: collapse;
  font-size: 12px;
}

.figure-sources th,
.figure-sources td,
.fb-table th,
.fb-table td {
  padding: var(--s1) var(--s2);
  border-bottom: 1px solid var(--separator);
  text-align: left;
  white-space: nowrap;
}

.fb-table input[type='text'],
.fb-table input[type='number'],
.fb-table input[type='date'] {
  width: 100%;
  min-width: 90px;
}

.figure-audit ul {
  margin: var(--s2) 0 0;
  padding-left: var(--s4);
  font-size: 12px;
}

.fb-disabled {
  opacity: 0.6;
}

.fb-disabled .fb-meta {
  display: block;
}

.fb-inline {
  flex-direction: row;
  align-items: center;
}

.fb-inline input {
  width: 80px;
}

.fb-months {
  margin-top: var(--s2);
}

/* ---------------------------------------------------------------- figure builder dialog */
/* Options on the left, the live preview on the right; one column on a
   narrow screen (preview under the options). */

.fb-dialog {
  width: min(1180px, calc(100vw - 32px));
  height: min(860px, calc(100vh - 32px));
  max-width: none;
  max-height: none;
  /* The page resets margins; a modal dialog centers itself with auto. */
  margin: auto;
  padding: 0;
  border: 1px solid var(--separator);
  border-radius: var(--radius-card);
  background: var(--canvas);
  color: var(--text);
}

.fb-dialog[open] {
  display: flex;
  flex-direction: column;
}

.fb-dialog::backdrop {
  background: rgb(37 43 38 / 35%);
}

.fb-dialog-head,
.fb-dialog-foot {
  display: flex;
  align-items: center;
  gap: var(--s2);
  padding: var(--s3) var(--s4);
  background: var(--raised);
}

.fb-dialog-head {
  justify-content: space-between;
  border-bottom: 1px solid var(--separator);
}

.fb-dialog-title {
  margin: 0;
  font-size: 16px;
  line-height: 24px;
}

.fb-dialog-foot {
  border-top: 1px solid var(--separator);
}

.fb-dialog-foot .fb-error {
  flex: 1;
  margin: 0;
  text-align: right;
}

.fb-dialog-foot .fb-error:empty {
  display: block;
}

.fb-dialog-foot .fb-mapping {
  margin-left: 0;
}

.fb-dialog-body {
  display: grid;
  grid-template-columns: minmax(340px, 420px) minmax(0, 1fr);
  flex: 1;
  min-height: 0;
}

.fb-dialog-form,
.fb-dialog-preview {
  min-height: 0;
  overflow-y: auto;
  padding: var(--s4);
}

.fb-dialog-form {
  border-right: 1px solid var(--separator);
}

.fb-dialog-preview {
  background: var(--raised);
  transition: opacity 120ms;
}

.fb-dialog-preview.is-loading {
  opacity: 0.55;
}

.fb-preview-title {
  margin: 0 0 var(--s3);
  font-size: 14px;
  font-weight: 600;
}

/* Before any data: Build a chart only shows what it can make. */
.fb-dialog.is-browse .fb-dialog-foot {
  justify-content: flex-end;
}

.fb-browse-cats {
  display: flex;
  flex-direction: column;
  gap: var(--s1);
  margin-top: var(--s4);
}

.fb-browse-cat {
  padding: var(--s2) var(--s3);
  border: 1px solid transparent;
  border-radius: var(--radius-control);
  background: none;
  text-align: left;
  cursor: pointer;
}

.fb-browse-cat:hover {
  background: var(--subtle);
}

.fb-browse-cat.is-current {
  border-color: var(--boundary);
  background: var(--raised);
  font-weight: 600;
}

.fb-browse-example {
  margin: 0 0 var(--s4);
}

.fb-browse-example img {
  display: block;
  width: 100%;
  border: 1px solid var(--separator);
  border-radius: var(--radius-control);
  background: var(--raised);
}

.fb-browse-example figcaption {
  margin-top: var(--s2);
}

.fb-browse-types {
  display: grid;
  gap: var(--s3);
  margin: 0;
  padding: 0;
  list-style: none;
}

.fb-browse-type {
  display: grid;
  gap: 2px;
}

.fb-browse-type > span:last-child {
  color: var(--text-secondary);
}

.fb-browse-type.is-soon {
  opacity: 0.6;
}

/* The mapping card uses the whole width. */
.fb-dialog.is-mapping .fb-dialog-body {
  grid-template-columns: minmax(0, 1fr);
}

.fb-dialog.is-mapping .fb-dialog-preview,
.fb-dialog.is-mapping .fb-dialog-foot {
  display: none;
}

.fb-preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s2);
  margin-bottom: var(--s3);
}

.fb-preview-head .fb-preview-title {
  margin: 0;
}

/* The edit view takes the dialog body in place of the settings. */
.fb-dialog.is-editing .fb-dialog-body {
  grid-template-columns: minmax(0, 1fr);
}

.fb-dialog.is-editing .fb-dialog-form,
.fb-dialog.is-editing .fb-dialog-preview {
  display: none;
}

.fb-dialog.is-editing .fb-dialog-foot .fb-hint {
  flex: 1;
  margin: 0;
}

.fb-edit-host,
.cs-dialog .cs-host {
  min-height: 0;
  flex: 1;
}

/* ------------------------------------------------------------ chart editor */

.cs-editor {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  height: 100%;
  min-height: 0;
}

.cs-stage-wrap {
  min-height: 0;
  overflow: auto;
  padding: var(--s4);
  background: var(--raised);
}

.cs-stage {
  position: relative;
  border-radius: var(--radius-control);
  outline: none;
}

.cs-stage:focus-visible {
  box-shadow: 0 0 0 2px var(--focus);
}

.cs-title {
  display: inline-block;
  margin: 0 0 var(--s2);
  padding: 0 2px;
  font-size: 15px;
  font-weight: 600;
  cursor: text;
}

.cs-title[contenteditable='true'] {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.cs-canvas {
  height: 360px;
}

.cs-hint {
  margin: var(--s2) 0 0;
  color: var(--text-secondary);
  font-size: 12px;
}

/* "+ Note": the next click on the chart pins the note there. */
.cs-stage.is-placing {
  cursor: crosshair;
}

.cs-hint.is-active {
  color: var(--focus);
  font-weight: 600;
}

.cs-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.cs-outline {
  position: absolute;
  border-radius: 4px;
}

.cs-outline.is-hover {
  border: 1.5px dashed var(--focus);
}

.cs-outline.is-selected {
  border: 2px solid var(--focus);
  background: rgb(40 106 166 / 6%);
}

.cs-trace {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.cs-trace polyline {
  fill: none;
  stroke: var(--focus);
  stroke-linecap: round;
  stroke-linejoin: round;
}

.cs-trace.is-hover polyline {
  stroke-width: 6;
  stroke-opacity: 0.25;
}

.cs-trace.is-selected polyline {
  stroke-width: 8;
  stroke-opacity: 0.3;
}

.cs-outline-label {
  position: absolute;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--focus);
  color: var(--text-inverse);
  font-size: 11px;
  white-space: nowrap;
}

.cs-zone {
  position: absolute;
  display: grid;
  place-items: center;
  border: 1.5px dashed var(--boundary);
  border-radius: 6px;
  background: rgb(255 254 250 / 70%);
  color: var(--text-secondary);
  font-size: 11px;
}

.cs-zone.is-active {
  border-color: var(--focus);
  background: rgb(40 106 166 / 10%);
  color: var(--focus);
}

.cs-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-left: 1px solid var(--separator);
  background: var(--raised);
}

.cs-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s2);
  padding: var(--s3);
  border-bottom: 1px solid var(--separator);
  color: var(--text-secondary);
  font-size: 12px;
}

.cs-crumb {
  min-width: 0;
}

.cs-urs {
  display: inline-flex;
  gap: 4px;
}

.cs-ur {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 24px;
  padding: 0;
  border: 1px solid var(--separator);
  border-radius: var(--radius-control);
  background: var(--raised);
  color: var(--text);
  cursor: pointer;
}

.cs-ur svg {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.cs-ur:disabled {
  opacity: 0.4;
  cursor: default;
}

.cs-panel-body {
  display: grid;
  flex: 1;
  align-content: start;
  gap: var(--s3);
  padding: var(--s3);
  overflow-y: auto;
}

.cs-panel-foot {
  display: flex;
  justify-content: flex-end;
  padding: var(--s2) var(--s3);
  border-top: 1px solid var(--separator);
}

.cs-row {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  align-items: center;
  gap: var(--s2);
}

.cs-row-label {
  color: var(--text-secondary);
  font-size: 12px;
}

.cs-seg {
  display: inline-flex;
  flex-wrap: wrap;
  overflow: hidden;
  border: 1px solid var(--separator);
  border-radius: var(--radius-control);
}

.cs-seg button {
  flex: none;
  padding: 4px 7px;
  white-space: nowrap;
  border: 0;
  border-right: 1px solid var(--separator);
  background: var(--raised);
  color: var(--text);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

.cs-seg button:last-child {
  border-right: 0;
}

/* Choices that would wrap (a map's corners) as an even grid of two
   columns, lines between the cells. */
.cs-seg[data-grid='2'] {
  display: inline-grid;
  grid-template-columns: 1fr 1fr;
}

.cs-seg[data-grid='2'] button {
  border-right: 1px solid var(--separator);
  border-bottom: 1px solid var(--separator);
  text-align: left;
}

.cs-seg[data-grid='2'] button:nth-child(2n) {
  border-right: 0;
}

.cs-seg[data-grid='2'] button:nth-last-child(-n + 2) {
  border-bottom: 0;
}

.cs-seg button[aria-pressed='true'] {
  background: var(--selected);
  color: var(--action);
  font-weight: 600;
}

.cs-seg button:disabled {
  color: var(--text-secondary);
  cursor: not-allowed;
}

.cs-input {
  width: 100%;
  padding: 5px 8px;
  border: 1px solid var(--separator);
  border-radius: var(--radius-control);
  background: var(--raised);
  color: var(--text);
  font: inherit;
  font-size: 13px;
}

.cs-size {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  /* Units and separators beside the inputs, at the panel's small size. */
  color: var(--text-secondary);
  font-size: 12px;
}

.cs-size .cs-input {
  width: 84px;
}

.cs-swatches {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.cs-swatch {
  width: 20px;
  height: 20px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgb(37 43 38 / 8%);
  cursor: pointer;
}

.cs-swatch[aria-pressed='true'] {
  box-shadow:
    0 0 0 2px var(--raised),
    0 0 0 3.5px var(--focus);
}

.cs-custom-row {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}

.cs-custom-row input[type='color'] {
  width: 36px;
  height: 30px;
  padding: 0;
  border: 1px solid var(--separator);
  border-radius: var(--radius-control);
  background: var(--raised);
}

.cs-check {
  margin-top: 6px;
  padding: 6px 8px;
  border-radius: var(--radius-control);
  background: var(--warning-bg);
  color: var(--warning);
  font-size: 12px;
}

.cs-note,
.cs-locked {
  margin: 0;
  color: var(--text-secondary);
  font-size: 12px;
}

/* The map edit view: the drawn map with clickable regions over it. */
.cs-map-stage {
  display: block;
}

.cs-map-image {
  display: block;
  width: 100%;
  height: auto;
  user-select: none;
}

.cs-crop {
  position: absolute;
  border: 2px dashed var(--focus);
  background: rgb(40 106 166 / 8%);
}

.cs-redraw {
  margin: var(--s1) 0 0;
  color: var(--text-secondary);
  font-size: 12px;
}

.cs-ramps {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s1);
}

.cs-ramp {
  display: flex;
  flex-direction: column;
  gap: 3px;
  width: 76px;
  padding: 4px;
  border: 1px solid var(--separator);
  border-radius: var(--radius-control);
  background: var(--raised);
  color: var(--text);
  font: inherit;
  font-size: 12px;
  text-align: left;
  cursor: pointer;
}

.cs-ramp:hover {
  border-color: var(--text-secondary);
}

.cs-ramp[aria-pressed='true'] {
  border-color: var(--action);
  box-shadow: 0 0 0 1px var(--action);
  background: var(--selected);
  color: var(--action);
  font-weight: 600;
}

.cs-ramp-strip {
  display: block;
  height: 14px;
  border-radius: 3px;
  box-shadow: inset 0 0 0 1px rgb(0 0 0 / 8%);
}

.cs-hint-inline {
  display: block;
  margin-top: 4px;
  color: var(--text-secondary);
  font-size: 12px;
}

.cs-redraw.is-error {
  color: var(--error);
}

.cs-slider {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  width: 100%;
}

.cs-slider input[type='range'] {
  flex: 1;
  accent-color: var(--action);
}

.cs-slider output {
  min-width: 3.5em;
  white-space: nowrap;
  color: var(--text-secondary);
  font-size: 12px;
  text-align: right;
}

/* Caption text in the edit views, and the disclosures always drawn
   after it (listed, not editable). */
.cs-caption {
  width: 100%;
  resize: vertical;
  line-height: 1.4;
}

/* Back to a layer's automatic opacity: a small icon after its value (a
   blank of the same width keeps the sliders lined up). */
.cs-reset-one {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-control);
  background: none;
  color: var(--text-secondary);
  cursor: pointer;
}

.cs-reset-one:hover {
  background: var(--raised);
  color: var(--text);
}

.cs-reset-one svg {
  width: 13px;
  height: 13px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.cs-subhead {
  margin: var(--s2) 0 0;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
}

.cs-locked-list {
  margin: 0;
  padding-left: 1.1em;
  color: var(--text-secondary);
  font-size: 12px;
}

.cs-locked-list li + li {
  margin-top: 2px;
}

.cs-checks {
  display: grid;
  gap: 4px;
}

.cs-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
}

/* Every saved look of a chart. */
.cs-history {
  width: min(640px, calc(100vw - 32px));
  height: fit-content;
  max-height: calc(100vh - 32px);
}

.cs-history-body {
  display: grid;
  gap: var(--s3);
  min-height: 0;
  padding: var(--s4);
  overflow-y: auto;
  background: var(--raised);
}

.cs-history-body .fb-hint {
  margin: 0;
}

.cs-history-list {
  display: grid;
  gap: var(--s2);
  margin: 0;
  padding: 0;
  list-style: none;
}

.cs-history-list li {
  padding: var(--s2) var(--s3);
  border: 1px solid var(--separator);
  border-radius: var(--radius-control);
}

.cs-history-list li.is-shown {
  border-color: var(--action);
  background: var(--selected);
}

.cs-history-meta {
  color: var(--text-secondary);
  font-size: 12px;
}

.cs-history-meta strong {
  color: var(--text);
}

.cs-history-tag {
  margin-left: 4px;
  color: var(--action);
  font-weight: 600;
}

.cs-history-what {
  margin-top: 2px;
  font-size: 13px;
  overflow-wrap: anywhere;
}

.cs-history .fb-dialog-foot .fb-hint {
  flex: 1;
  margin: 0;
}

.chart-style-line {
  margin: var(--s2) 0 0;
}

/* Compare a saved copy with its newer version. */
.cs-compare {
  /* A modal dialog with an auto height fills the window; this one fits. */
  height: fit-content;
  max-height: calc(100vh - 32px);
}

.cs-compare-body {
  display: grid;
  /* Sized to the two charts; scrolls only when the window is shorter. */
  flex: 0 1 auto;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--s5);
  min-height: 0;
  padding: var(--s4);
  overflow: auto;
  background: var(--raised);
}

.cs-compare-label {
  margin: 0 0 var(--s2);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.cs-compare .is-newer .cs-compare-label {
  color: var(--action);
}

.cs-compare .is-newer .cs-compare-chart {
  border-radius: var(--radius-control);
  outline: 2px solid var(--action);
  outline-offset: 6px;
}

.cs-compare-changes {
  margin: 0;
  padding: var(--s2) var(--s4) var(--s3) calc(var(--s4) + 18px);
  background: var(--raised);
  color: var(--text-secondary);
  font-size: 13px;
}

.cs-compare-foot .fb-hint {
  flex: 1;
  margin: 0;
}

@media (max-width: 760px) {
  .cs-editor {
    grid-template-columns: minmax(0, 1fr);
  }

  .cs-panel {
    border-top: 1px solid var(--separator);
    border-left: 0;
  }

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

.fb-in-dialog {
  padding: 0;
  border: 0;
  background: none;
}

.fb-category {
  margin-bottom: var(--s2);
}

/* The category picker (figure-builder.js categoryMenu): looks like the
   other selects; the list opens below it. */
.fb-menu {
  position: relative;
}

.fb-menu-button {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: var(--s2);
  padding: 6px 10px;
  border: 1px solid var(--boundary);
  border-radius: var(--radius-control);
  background: var(--raised);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.fb-menu-button:focus-visible,
.fb-menu-list:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 1px;
}

.fb-menu-caret {
  flex: none;
  width: 0;
  height: 0;
  border: 5px solid transparent;
  border-top-color: var(--text);
  border-bottom: 0;
}

.fb-menu-list {
  position: absolute;
  z-index: 5;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  max-height: 320px;
  overflow-y: auto;
  margin: 0;
  padding: var(--s1);
  list-style: none;
  border: 1px solid var(--separator);
  border-radius: var(--radius-card);
  background: var(--raised);
  box-shadow: var(--shadow-popover);
}

.fb-menu-list [role='option'] {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--s2);
  padding: 7px var(--s2);
  border-radius: var(--radius-control);
  cursor: pointer;
}

.fb-menu-list [role='option'].is-active {
  background: var(--subtle);
}

.fb-menu-list [role='option'][aria-selected='true'] {
  background: var(--selected);
}

.fb-menu-list [role='option'].is-soon,
.fb-type.is-soon {
  color: var(--text-secondary);
  cursor: default;
}

.fb-menu-list [role='option'].is-soon > span:first-child,
.fb-type.is-soon {
  opacity: 0.75;
}

.fb-soon {
  flex: none;
  padding: 1px 7px;
  border-radius: 99px;
  background: var(--subtle);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 11px;
  white-space: nowrap;
}

.fb-type.is-soon {
  justify-content: space-between;
  background: var(--canvas);
  border-style: dashed;
}

.fb-type.is-soon:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 1px;
}

/* A shortcut to a figure type made in another category. */
.fb-type.fb-link {
  justify-content: space-between;
  color: var(--action);
  font: inherit;
  font-size: 13px;
  text-align: left;
}

.fb-type.fb-link:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 1px;
}

.fb-tip {
  position: fixed;
  z-index: 50;
  padding: 7px 10px;
  border: 1px solid var(--separator);
  border-radius: var(--radius-control);
  background: var(--raised);
  box-shadow: var(--shadow-popover);
  color: var(--text);
  font-size: 12px;
  line-height: 1.4;
  pointer-events: none;
}

/* Figure types as a compact grid; the chosen one's description below. */
.fb-types {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: var(--s1);
}

.fb-type {
  display: flex;
  gap: var(--s1);
  align-items: center;
  padding: var(--s1) var(--s2);
  border: 1px solid var(--separator);
  border-radius: var(--radius-control);
  background: var(--raised);
  font-size: 13px;
  cursor: pointer;
}

.fb-type.is-selected {
  border-color: var(--action);
  background: var(--selected);
}

.fb-type input {
  margin: 0;
}

.fb-in-dialog > .fb-about {
  margin: var(--s2) 0 var(--s3);
  font-size: 12px;
  color: var(--text-secondary);
}

/* Collapsible sections: title and a one-line summary of the choices. */
details.fb-section {
  margin: 0 0 var(--s2);
  border: 1px solid var(--separator);
  border-radius: var(--radius-control);
  background: var(--raised);
}

details.fb-section > summary {
  display: flex;
  gap: var(--s2);
  align-items: baseline;
  padding: var(--s2) var(--s3);
  cursor: pointer;
  list-style: none;
}

details.fb-section > summary::-webkit-details-marker {
  display: none;
}

details.fb-section > summary::before {
  content: '▸';
  color: var(--text-secondary);
}

details.fb-section[open] > summary::before {
  content: '▾';
}

.fb-sec-title {
  font-size: 13px;
  font-weight: 600;
}

.fb-sec-summary {
  overflow: hidden;
  min-width: 0;
  color: var(--text-secondary);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fb-sec-body {
  padding: 0 var(--s3) var(--s3);
}

/* The AI's questions in its answer. */
.fb-clarify {
  padding: var(--s3) var(--s4);
  border: 1px solid var(--warning);
  border-radius: var(--radius-card);
  background: var(--warning-bg);
}

.fb-clarify-title {
  margin: 0 0 var(--s2);
  font-size: 14px;
}

.fb-clarify .fb-field {
  max-width: 420px;
}

.fb-clarify-rest {
  margin: 0 0 var(--s2);
  padding-left: var(--s4);
  font-size: 13px;
}

@media (max-width: 800px) {
  /* One column that scrolls as a whole: options, then the preview. */
  .fb-dialog-body {
    display: block;
    overflow-y: auto;
  }

  .fb-dialog-form,
  .fb-dialog-preview {
    overflow: visible;
  }

  .fb-dialog-form {
    border-right: 0;
    border-bottom: 1px solid var(--separator);
  }
}

/* The mapping card's table list: ticked tables first, with their counts. */
.fb-tables .fb-table-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s1) var(--s3);
  align-items: baseline;
  padding: var(--s1) 0;
}

.fb-tables .fb-table-row.is-on .fb-check {
  font-weight: 600;
}

.fb-order {
  display: inline-flex;
  gap: var(--s1);
}

/* Per-well datum and units, and measuring points: a label, the rows
   entered (none until one is added) and an add link, as one block. */
.fb-subsection {
  margin-top: var(--s4);
}

.fb-subsection > .fb-label {
  margin: 0;
  line-height: 1.4;
}

.fb-exceptions {
  margin: var(--s1) 0 var(--s2);
}

.fb-exceptions[hidden] {
  display: none;
}

/* The add links match the label text above them. */
.fb-subsection > .link-button {
  margin-top: 2px;
  font-size: 13px;
  line-height: 1.4;
}

.fb-subsection:last-child {
  margin-bottom: var(--s5);
}

.fb-conventions {
  margin: var(--s2) 0;
  font-size: 13px;
}

.fb-conventions > summary {
  cursor: pointer;
  color: var(--text-secondary);
}

.fb-notice {
  margin-bottom: var(--s3);
  padding: var(--s2) var(--s3);
  border-radius: var(--radius-control);
  background: var(--info-bg);
  font-size: 13px;
}

.fb-flag {
  color: var(--warning);
  font-size: 12px;
}

/* Project mappings: a project file's table, the mapping's scope, review. */
.fb-badge {
  display: inline-block;
  margin-left: var(--s1);
  padding: 0 var(--s2);
  border-radius: var(--radius-control);
  background: var(--info-bg);
  font-size: 12px;
}

.fb-badge-warn {
  margin-left: 0;
  color: var(--warning);
  background: var(--warning-bg);
}

.fb-scope p {
  margin: 0 0 var(--s2);
}

.fb-review {
  display: flex;
  gap: var(--s2);
  align-items: center;
  font-size: 13px;
}

/* An "i" with its explanation on hover or focus. */
/* Raised like a footnote mark, right after the word it explains. */
.fb-info {
  position: relative;
  display: inline-flex;
  margin-left: 2px;
  vertical-align: 0.45em;
  line-height: 0;
  cursor: help;
  outline: none;
}

.fb-info-mark {
  display: inline-grid;
  place-items: center;
  width: 12px;
  height: 12px;
  border: 1px solid var(--text-secondary);
  border-radius: 50%;
  color: var(--text-secondary);
  /* The label's own font, a size down. */
  font-family: inherit;
  font-size: 9px;
  font-weight: 600;
  line-height: 1;
}

.fb-info:focus-visible .fb-info-mark {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.fb-info-tip {
  position: absolute;
  top: calc(100% + 6px);
  left: -8px;
  z-index: 5;
  display: none;
  width: min(320px, 70vw);
  padding: var(--s2) var(--s3);
  border: 1px solid var(--separator);
  border-radius: var(--radius-control);
  background: var(--raised);
  box-shadow: 0 4px 16px rgb(37 43 38 / 14%);
  color: var(--text);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.45;
}

.fb-info:hover .fb-info-tip,
.fb-info:focus .fb-info-tip {
  display: block;
}

/* Composite figures: panels side by side on one value axis. */
.fb-composite-legend {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s1) var(--s3);
  margin-bottom: var(--s1);
  font-size: 12px;
}

.fb-legend-item {
  display: inline-flex;
  gap: var(--s1);
  align-items: center;
}

.fb-swatch {
  width: 10px;
  height: 10px;
  border-radius: 2px;
}

.fb-swatch-line {
  height: 0;
  border-top: 2px dashed var(--text);
  border-radius: 0;
}

.fb-swatch-hollow {
  border: 1.5px solid var(--text-secondary);
  border-radius: 50%;
}

.fb-composite-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2);
  align-items: stretch;
}

.fb-composite-row > .fb-cpanel:not(.fb-cpanel-statistics) {
  min-width: 140px;
}

.fb-cpanel-statistics.fb-cpanel-wide {
  flex: 1 0 100%;
}

.fb-cpanel {
  min-width: 0;
}

.fb-cpanel-statistics {
  flex: 0 0 240px;
}

.fb-cpanel-title {
  margin: 0 0 var(--s1);
  font-size: 12px;
  font-weight: 600;
}

.fb-cpanel-canvas {
  height: 320px;
}

.fb-stats-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px var(--s3);
  margin: 0;
  padding: var(--s2) var(--s3);
  border: 1px solid var(--separator);
  border-radius: var(--radius-control);
  font-size: 12px;
}

.fb-stats-card dt {
  color: var(--text-secondary);
}

.fb-stats-card dd {
  margin: 0;
  font-weight: 600;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.fb-stats-table {
  font-size: 11px;
  border-collapse: collapse;
}

.fb-stats-table th,
.fb-stats-table td {
  padding: 2px var(--s1);
  border-bottom: 1px solid var(--separator);
  text-align: left;
  white-space: nowrap;
}

/* Set by compositeView from the figure's own width, which also decides
   whether every panel shows its ticks. */
.fb-composite-row.is-stacked {
  flex-direction: column;
  /* Wrapped column lines size to their widest content (the statistics
     table), which would push the panels past the card. */
  flex-wrap: nowrap;
}

.fb-composite-row.is-stacked > .fb-cpanel {
  flex: 0 0 auto !important;
}

/* Groundwater maps: the image opens a full-screen viewer to zoom and pan. */
.figure-map {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  cursor: zoom-in;
}

.figure-map:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.fb-zoom {
  width: calc(100vw - 16px);
  height: calc(100vh - 16px);
  max-width: none;
  max-height: none;
  margin: auto;
  padding: 0;
  border: 1px solid var(--separator);
  border-radius: var(--radius-card);
  background: var(--canvas);
  color: var(--text);
}

.fb-zoom[open] {
  display: flex;
  flex-direction: column;
}

.fb-zoom::backdrop {
  background: rgb(37 43 38 / 55%);
}

.fb-zoom-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s2);
  padding: var(--s2) var(--s3);
  border-bottom: 1px solid var(--separator);
  background: var(--raised);
}

.fb-zoom-title {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fb-zoom-stage {
  position: relative;
  flex: 1 1 auto;
  overflow: hidden;
  cursor: grab;
  touch-action: none;
  background: var(--subtle);
}

.fb-zoom-stage:active {
  cursor: grabbing;
}

.fb-zoom-stage img {
  position: absolute;
  top: 0;
  left: 0;
  max-width: none;
  transform-origin: 0 0;
  user-select: none;
}

.fb-map-edit {
  display: grid;
  gap: var(--s2);
  margin-top: var(--s2);
  padding: var(--s3);
  border: 1px solid var(--separator);
  border-radius: var(--radius-control);
  background: var(--raised);
}

.fb-frames {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s2);
  margin-top: var(--s2);
}

.fb-frames input[type='range'] {
  flex: 1 1 160px;
  min-width: 0;
}

/* Site layers: a raster's settings stay inside the card on narrow widths. */
[data-site-layers] .fb-inline select,
[data-site-layers] .fb-inline input {
  max-width: 10rem;
}

/* ------------------------------------------------------------ project chart style */

/* Screening levels, ready to edit: fields fill their cells, the units
   pick stays narrow; Save and Discard appear once something changed. */
.levels-table {
  max-width: 760px;
}

.levels-table td {
  vertical-align: middle;
}

.levels-table input[type='text'],
.levels-table input[type='number'] {
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  height: 30px;
  padding: 0 var(--s2);
  border: 1px solid var(--separator);
  border-radius: var(--radius-control);
  background: var(--raised);
  font: inherit;
  font-size: 13px;
}

/* The units menu, the same height and frame as the fields beside it. */
.levels-table .level-units .picker-button {
  box-sizing: border-box;
  min-height: 0;
  height: 30px;
  min-width: 84px;
  border: 1px solid var(--separator);
  background-color: var(--raised);
  color: var(--text);
  font-size: 13px;
  font-weight: 400;
}

.levels-table input:focus {
  border-color: var(--action);
  outline: none;
}

.levels-actions {
  display: flex;
  align-items: center;
  gap: var(--s3);
  margin-top: var(--s2);
}

.levels-actions .link-button,
.levels-table .link-button {
  font-size: 13px;
}

.levels-save {
  display: inline-flex;
  gap: var(--s2);
}

.levels-save[hidden] {
  display: none;
}

/* Standards: settings edited in place, a row each: the label (with an
   optional hint under it) and its control. */
.setting-group {
  margin: var(--s5) 0 var(--s1);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
}

.setting-rows {
  max-width: 760px;
  border-top: 1px solid var(--separator);
}

.setting-row {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  gap: var(--s4);
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--separator);
}

.setting-row-label {
  display: grid;
  font-size: 14px;
  color: var(--text);
}

.setting-row-hint {
  font-size: 12px;
  line-height: 16px;
  color: var(--text-secondary);
}

.style-choices.is-compact {
  gap: 6px;
}

.style-choices.is-compact .style-choice {
  flex-direction: row;
  gap: 5px;
  min-width: 0;
  min-height: 28px;
  padding: 2px 10px;
}

.style-choices.is-compact .style-choice-name {
  font-size: 12px;
  font-weight: 400;
}

/* A text setting: reads as text, shows it is a field on hover and focus. */
.inline-text {
  width: 100%;
  max-width: 420px;
  padding: 5px var(--s2);
  margin-left: calc(-1 * var(--s2));
  border: 1px solid transparent;
  border-radius: var(--radius-control);
  background: none;
  color: var(--text);
  font: inherit;
  font-size: 14px;
}

.inline-text:hover {
  border-color: var(--separator);
  background: var(--raised);
}

.inline-text:focus {
  border-color: var(--action);
  background: var(--raised);
  outline: none;
}

.inline-text::placeholder {
  color: var(--text-secondary);
}

/* An on/off setting. */
.switch {
  position: relative;
  width: 34px;
  height: 20px;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: rgba(48, 47, 37, 0.25);
  vertical-align: middle;
  cursor: pointer;
  transition: background 0.15s;
}

.switch[aria-checked='true'] {
  background: var(--action);
}

.switch-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.15s;
}

.switch[aria-checked='true'] .switch-knob {
  transform: translateX(14px);
}

.switch-label {
  margin-left: var(--s2);
  font-size: 13px;
  color: var(--text-secondary);
}

/* A color ramp as a bar, inside its choice. */
.ramp-bar {
  width: 44px;
  height: 10px;
  border-radius: 3px;
  box-shadow: inset 0 0 0 1px rgb(37 43 38 / 10%);
}

.font-sample {
  font-size: 14px;
  line-height: 16px;
}

/* Page size: the sheet's proportions. */
.page-shape {
  display: inline-block;
  border: 1px solid rgba(48, 47, 37, 0.45);
  border-radius: 1px;
  background: var(--surface, #fff);
}

.page-shape.is-letter {
  width: 10px;
  height: 13px;
}

.page-shape.is-a4 {
  width: 9px;
  height: 13px;
}

.style-choices.is-compact .color-choice.style-choice {
  justify-content: center;
  width: 26px;
  min-height: 26px;
  height: 26px;
  padding: 0;
  border-radius: 50%;
}

.color-dot {
  display: block;
  width: 16px;
  height: 16px;
  border-radius: 50%;
}

.logo-empty {
  color: var(--text-secondary);
  font-size: 14px;
}

/* Lines between rows only in Figure style; Report template is grouped
   by spacing, with a faint line under each group heading (Text, Page). */
/* Figure style's lines between rows: faint, just enough to pair each
   label with its control; none above the first. */
.standards-body .setting-rows {
  border-top: 0;
}

.setting-row {
  border-bottom-color: rgba(48, 47, 37, 0.06);
}

#reportTemplate .setting-rows {
  border-top: 0;
}

#reportTemplate .setting-row {
  padding: var(--s2) 0;
  border-bottom: 0;
}

#reportTemplate .setting-group {
  padding-bottom: var(--s1);
  border-bottom: 1px solid rgba(48, 47, 37, 0.07);
}

@media (max-width: 760px) {
  .setting-row {
    grid-template-columns: 1fr;
    gap: var(--s1);
  }
}

/* Standards: a setting as pictures of its choices, saved when clicked. */
.style-setting {
  padding: var(--s2) 0 var(--s4);
}

.style-setting-label {
  margin: 0 0 var(--s2);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
}

.style-choices {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2);
}

.style-choice {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 84px;
  padding: var(--s2) var(--s3);
  border: 1px solid var(--separator);
  border-radius: var(--radius-control);
  background: var(--raised);
  color: var(--text);
  font: inherit;
  cursor: pointer;
}

.style-choice:hover:not(:disabled) {
  border-color: rgba(48, 47, 37, 0.3);
}

.style-choice[aria-pressed='true'] {
  border-color: var(--action);
  box-shadow: 0 0 0 1px var(--action);
  background: var(--selected);
}

.style-choice:disabled {
  cursor: default;
}

.style-choice:disabled:not([aria-pressed='true']) {
  opacity: 0.55;
}

.style-choices.is-cards .style-choice {
  align-items: flex-start;
  width: 196px;
  padding: var(--s2);
  text-align: left;
}

.style-choice-name {
  font-size: 13px;
  font-weight: 500;
}

.style-choice-hint {
  font-size: 12px;
  line-height: 16px;
  color: var(--text-secondary);
}

/* The theme's little chart. */
.theme-preview {
  width: 100%;
  height: auto;
  border-radius: 4px;
  background: var(--surface, #fff);
}

.theme-preview .tp-grid {
  stroke: rgba(48, 47, 37, 0.12);
  stroke-width: 0.6;
}

.theme-preview .tp-axis {
  stroke: rgba(48, 47, 37, 0.45);
  stroke-width: 0.8;
}

.theme-preview polyline {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.theme-preview .tp-a {
  stroke: #2f7d45;
}

.theme-preview .tp-b {
  stroke: #c26a2e;
}

/* Text size: the same letters at each size. */
.size-sample {
  line-height: 28px;
  font-weight: 500;
}

.size-sample.is-s {
  font-size: 14px;
}

.size-sample.is-m {
  font-size: 18px;
}

.size-sample.is-l {
  font-size: 23px;
}

/* The legend's place: a frame, the plot, and the legend as a bar. */
.legend-preview {
  position: relative;
  display: grid;
  gap: 3px;
  width: 44px;
  height: 30px;
  padding: 3px;
  border: 1px solid rgba(48, 47, 37, 0.3);
  border-radius: 3px;
  background: var(--surface, #fff);
}

.legend-preview .lp-plot {
  border-radius: 2px;
  background: rgba(47, 125, 69, 0.25);
}

.legend-preview .lp-key {
  border-radius: 2px;
  background: rgba(48, 47, 37, 0.55);
}

.legend-preview.is-right {
  grid-template-columns: 1fr 9px;
}

.legend-preview.is-left {
  grid-template-columns: 9px 1fr;
}

.legend-preview.is-left .lp-key {
  grid-row: 1;
  grid-column: 1;
}

.legend-preview.is-top {
  grid-template-rows: 5px 1fr;
}

.legend-preview.is-top .lp-key {
  grid-row: 1;
}

.legend-preview.is-bottom {
  grid-template-rows: 1fr 5px;
}

.legend-preview.is-inside .lp-key {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 12px;
  height: 7px;
}

.brand-row-view {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s3);
}

.brand-swatches.is-large .brand-swatch {
  width: 22px;
  height: 22px;
}

.brand-swatches {
  display: inline-flex;
  gap: 4px;
  vertical-align: middle;
}

.brand-swatch {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgb(37 43 38 / 10%);
}

.brand-dialog {
  height: fit-content;
  width: min(560px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
}

.brand-body {
  display: grid;
  gap: var(--s3);
  padding: var(--s4);
  overflow-y: auto;
  background: var(--raised);
}

.brand-body .section-hint {
  margin: 0;
}

.brand-colors {
  display: grid;
  gap: var(--s2);
  margin: 0;
  padding-left: 20px;
}

.brand-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s2);
}

.brand-row input[type='color'] {
  width: 36px;
  height: 30px;
  padding: 0;
  border: 1px solid var(--separator);
  border-radius: var(--radius-control);
  background: var(--raised);
}

.brand-row .ask-dialog-input {
  width: 120px;
}

.brand-check {
  flex-basis: 100%;
  margin: 0;
  padding: 4px 8px;
  border-radius: var(--radius-control);
  background: var(--warning-bg);
  color: var(--warning);
  font-size: 12px;
}

/* Main monitoring rounds (chemistry mapping): one line per round. */
.fb-round-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 4px var(--s3);
  max-height: 220px;
  overflow-y: auto;
  margin-top: var(--s2);
}

.fb-round .fb-hint {
  font-size: 12px;
}

.fb-round-few {
  font-size: 11px;
  color: var(--warning);
  background: var(--warning-bg);
  border-radius: 999px;
  padding: 0 6px;
}

/* A new chat's "Try asking": questions written from the task's own data. */
.first-questions {
  margin-top: 0;
}

/* Data & files: tables that look like monitoring data, not mapped yet. */
.data-guess {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--s2) var(--s3);
  margin-bottom: var(--s3);
  padding: var(--s3);
  border-radius: var(--radius-control);
  background: var(--warning-bg);
  font-size: 13px;
}

.data-guess p {
  display: flex;
  gap: var(--s2);
  margin: 0;
  flex: 1 1 320px;
  min-width: 0;
}

/* Project setup (as in the onboarding plan's mock-up): a rail of steps,
   each with what it covers, beside the current step. */
/* The setup: a landscape modal over the page it was started from. */
.setup-dialog {
  position: fixed;
  inset: 0;
  margin: auto;
  height: fit-content;
  width: min(1180px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  padding: 0;
  border: 0;
  border-radius: var(--radius-card);
  background: var(--raised);
  box-shadow: 0 30px 80px #161b1740;
  overflow: auto;
}

.setup-dialog:focus,
.setup-dialog:focus-visible {
  outline: none;
}

.setup-dialog::backdrop {
  background: #161b1766;
}

.setup {
  display: grid;
  grid-template-columns: minmax(240px, 320px) minmax(0, 1fr);
  min-height: min(620px, calc(100vh - 48px));
  background: var(--raised);
}

.setup-side {
  display: grid;
  align-content: start;
  gap: var(--s4);
  padding: var(--s5);
  background: var(--canvas);
  border-right: 1px solid var(--separator);
}

.setup-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--s2);
}

.setup-step {
  display: flex;
  gap: var(--s3);
  align-items: flex-start;
  width: 100%;
  padding: var(--s2) 0;
  border: 0;
  background: none;
  font: inherit;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.setup-num {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1.5px solid var(--boundary);
  font-size: 12px;
  color: var(--text-secondary);
}

.setup-step.is-done .setup-num {
  background: var(--action);
  border-color: var(--action);
  color: var(--text-inverse);
}

.setup-step.is-current .setup-num {
  border-color: var(--text);
  color: var(--text);
  box-shadow: 0 0 0 3px var(--selected);
}

.setup-step-text {
  display: grid;
  gap: 2px;
  padding-top: 2px;
}

.setup-step-name {
  font-size: 15px;
}

.setup-step.is-current .setup-step-name {
  font-weight: 600;
}

.setup-step-hint {
  font-size: 13px;
  color: var(--text-secondary);
}

.setup-main {
  display: grid;
  align-content: start;
  gap: var(--s4);
  padding: var(--s6) var(--s7);
  min-width: 0;
}

.setup-title {
  margin: 0;
  font-size: 24px;
  line-height: 1.25;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

.setup-main > .section-hint {
  margin: 0;
}

.setup-form {
  display: grid;
  gap: var(--s3);
  max-width: 520px;
}

.setup-invite {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(130px, 170px) auto;
  gap: var(--s2);
  align-items: center;
}

.setup-invite.has-task {
  grid-template-columns:
    minmax(0, 1fr) minmax(110px, 150px) minmax(130px, 170px)
    auto;
}

.setup-queue {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: var(--s2);
}

.setup-queue:empty {
  display: none;
}

.setup-queue li {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2) var(--s3);
  align-items: center;
  font-size: 14px;
}

.setup-queue code {
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 12px;
}

.setup-roles {
  display: grid;
  gap: var(--s2);
}

.setup-role {
  display: grid;
  gap: var(--s1);
  padding: var(--s3) var(--s4);
  border: 1px solid var(--separator);
  border-radius: var(--radius-card);
  font-size: 14px;
}

.setup-role > span {
  color: var(--text-secondary);
}

.setup-role-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--s3);
}

.setup-tag {
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--selected);
  color: var(--action);
  white-space: nowrap;
}

.setup-choices {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s3);
}

.setup-foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: var(--s3);
  margin-top: var(--s2);
}

.setup-foot-hint {
  font-size: 13px;
  color: var(--text-secondary);
}

.setup-foot-hint.is-error {
  color: var(--error);
}

.setup-foot-actions {
  display: flex;
  gap: var(--s2);
  margin-left: auto;
}

/* The project page's Getting started card. */
/* Getting started on the project page: one compact card, only as wide as
   its steps, with the progress and an x to dismiss on top, and the steps
   beside Continue setup. */
.setup-card {
  display: grid;
  gap: var(--s2);
  width: fit-content;
  max-width: 100%;
  margin-bottom: var(--s5);
  padding: var(--s3) var(--s3) var(--s3) var(--s4);
  background: var(--raised);
  border: 1px solid var(--separator);
  border-radius: var(--radius-card);
}

.setup-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s3);
}

.setup-dismiss {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  margin: -4px 0;
  padding: 0;
  border: 0;
  border-radius: var(--radius-control);
  background: none;
  color: var(--text-secondary);
  cursor: pointer;
}

.setup-dismiss:hover {
  background: var(--selected);
  color: var(--text);
}

.setup-card-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s2) var(--s5);
}

.setup-mini {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2) var(--s4);
  font-size: 13px;
}

.setup-mini li {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  color: var(--text-secondary);
}

.setup-mini li.is-done,
.setup-mini li.is-skipped {
  color: var(--text);
}

/* People tab: invite a project manager. */
.add-manager {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: var(--s3);
  margin-top: var(--s4);
}

.add-manager .section-hint {
  flex-basis: 100%;
  margin: 0;
}

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

  .setup-side {
    border-right: 0;
    border-bottom: 1px solid var(--separator);
  }

  .setup-main {
    padding: var(--s5);
  }

  .setup-invite,
  .setup-invite.has-task {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .setup-invite input[type='email'] {
    grid-column: 1 / -1;
  }
}

/* Close, in the modal's top-right corner (Finish later / Cancel). */
.setup {
  position: relative;
}

.setup-exit {
  position: absolute;
  top: var(--s3);
  right: var(--s3);
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  color: var(--text-secondary);
}

.setup-exit:hover,
.setup-exit:focus-visible {
  background: var(--subtle);
  color: var(--text);
}

.nowrap {
  white-space: nowrap;
}

/* Steps that open once the project exists. */
.setup-step:disabled {
  cursor: default;
  opacity: 0.55;
}

/* An export that failed, beside its buttons (whileDownloading). */
.export-error {
  display: block;
  flex-basis: 100%;
  font-size: 12px;
  line-height: 18px;
  color: var(--error);
}

/* Your own upload that saved figures now use: the delete button stays, dimmed,
   and says why on hover. */
.file-action-blocked {
  display: inline-flex;
  cursor: help;
}
.file-action-blocked .file-action:disabled {
  opacity: 0.35;
  pointer-events: none;
}

/* Project files, then this task's own. */
.file-group + .file-group {
  margin-top: var(--s4);
}

.file-group-title {
  margin: 0 0 var(--s1);
  font-size: 13px;
  font-weight: 600;
}

/* The project page's Files tab: project files and the project mappings. */
.pf-section {
  margin-top: var(--s5);
}

.pf-head {
  display: flex;
  gap: var(--s3);
  align-items: center;
  justify-content: space-between;
}

.pf-upload {
  margin: var(--s3) 0;
}

.pf-task {
  margin-top: 1.25rem;
}

.pf-task-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
}

.pf-task-name {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 0.25rem;
}

.pf-task-name .muted {
  font-weight: 400;
}

.pf-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.pf-table th {
  padding: var(--s2) var(--s2) var(--s2) 0;
  color: var(--text-secondary);
  font-weight: 500;
  text-align: left;
}

.pf-table td {
  padding: var(--s2) var(--s2) var(--s2) 0;
  border-top: 1px solid var(--separator);
  vertical-align: middle;
}

.pf-name {
  overflow-wrap: anywhere;
}

/* A file that failed: a red mark beside its name and a tinted row, with
   the reason, Details and Upload again under the name. */
.pf-table tr.is-failed td {
  background: var(--error-bg);
}

.pf-table tr.is-failed .pf-name > .icon {
  color: var(--error);
}

.pf-failure {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--s1) var(--s3);
  margin-top: var(--s1);
  font-size: 13px;
}

.pf-failure-text {
  flex-basis: 100%;
  color: var(--error);
}

.pf-retry {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  margin-left: 2px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-control);
  background: none;
  color: var(--text-secondary);
  vertical-align: middle;
  cursor: pointer;
}

.pf-retry:hover {
  background: rgba(48, 47, 37, 0.08);
  color: var(--text);
}

.pf-failure .file-details {
  margin: 0;
}

.pf-message {
  font-size: 14px;
}

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

.pf-map {
  padding: var(--s3) 0;
  border-top: 1px solid var(--separator);
  font-size: 14px;
}

.pf-map-head {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2);
  align-items: center;
  justify-content: space-between;
}

.pf-map-name {
  font-weight: 500;
}

.pf-reason {
  margin: var(--s1) 0 0;
}

.pf-history {
  margin-top: var(--s1);
  font-size: 13px;
}

@media (max-width: 640px) {
  .pf-table th:nth-child(4),
  .pf-table td:nth-child(4) {
    display: none;
  }
}

.pf-review {
  display: inline-flex;
  flex-wrap: wrap;
  gap: var(--s2);
  align-items: center;
}

/* ------------------------------------------------------------ project map */
/* project-map.js: the map, its layer list and the side panel. */

.pmap-host {
  margin-top: var(--s3);
}

/* The project map before anything has a place: one compact line of what
   is missing and a link to Files, where uploads happen. In the page's text
   column, not the map's wide frame. */
.pmap-host:has(> .pmap-start) {
  width: auto;
  margin-left: 0;
}

.pmap-start {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--s2) var(--s4);
  max-width: 880px;
  padding: var(--s3) var(--s4);
  border: 1px solid var(--separator);
  border-radius: var(--radius-card);
  background: var(--subtle);
}

.pmap-start-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
  flex: 1 1 320px;
}

.pmap-start-title {
  margin: 0;
  font-size: 14px;
  font-weight: 500;
}

.pmap-start-text {
  margin: 0;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.45;
}

.pmap-start-actions {
  display: flex;
  gap: var(--s2);
}

.pmap-start .pmap-problems {
  flex-basis: 100%;
  margin: 0;
}

/* On a project's own page the map keeps to the page's margins (the page is
   already wide) and a calmer height. */
.page.is-wide .pmap-host {
  width: auto;
  margin-left: 0;
}

/* (A task's map keeps its taller height: the model controls use it.) */
#homeBody.is-wide .pmap-workspace {
  height: min(65vh, 600px);
}

/* A map with no layers yet (only the approximate site): no controls
   column, the basemap switch floats in the map's corner. */
.pmap-workspace.is-bare {
  position: relative;
  grid-template-columns: minmax(0, 1fr);
}

.pmap-workspace.is-bare .pmap-side {
  position: absolute;
  top: var(--s3);
  left: var(--s3);
  z-index: 3;
  padding: 0;
  border: 0;
  overflow: visible;
}

.pmap-workspace.is-bare .pmap-layers-title {
  display: none;
}

.pmap-workspace.is-bare .pmap-layer-list {
  display: block !important;
}

/* A project's approximate site, placed on a small map under its location
   (project setup, Edit project). */
.site-field {
  margin-bottom: var(--s3);
}

.site-picker-map {
  position: relative;
  height: 220px;
  overflow: hidden;
  border: 1px solid var(--separator);
  border-radius: var(--radius-control);
  background: var(--subtle);
}

.site-picker-map .pmap-note {
  margin: 0;
  border-radius: 0;
}

.site-picker-basemap {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 2;
  padding: 3px 8px;
  border: 1px solid var(--separator);
  border-radius: var(--radius-control);
  background: var(--raised);
  color: var(--text);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

.site-picker-foot {
  display: flex;
  justify-content: space-between;
  gap: var(--s3);
  margin-top: var(--s1);
  font-size: 12px;
  color: var(--text-secondary);
}

.pmap-note,
.pmap-empty {
  padding: var(--s4);
  color: var(--text-secondary);
  background: var(--subtle);
  border-radius: var(--radius-card);
}

.pmap-stage {
  position: relative;
  height: min(70vh, 640px);
  min-height: 360px;
  border: 1px solid var(--boundary);
  border-radius: var(--radius-card);
  overflow: hidden;
  background: var(--subtle);
}

.pmap-canvas {
  /* MapLibre makes its container position: relative; it fills the stage. */
  width: 100%;
  height: 100%;
}

.pmap-empty {
  position: absolute;
  left: var(--s4);
  bottom: var(--s6);
  max-width: 360px;
  box-shadow: var(--shadow-popover);
}

.pmap-controls {
  position: absolute;
  top: var(--s3);
  left: var(--s3);
  display: flex;
  flex-direction: column;
  gap: var(--s2);
  max-width: 260px;
  max-height: calc(100% - 2 * var(--s3));
  overflow-y: auto;
  z-index: 2;
}

.pmap-basemaps {
  /* Only as wide as its buttons (the column would stretch it). */
  align-self: flex-start;
  display: inline-flex;
  background: var(--raised);
  border: 1px solid var(--boundary);
  border-radius: var(--radius-control);
  box-shadow: var(--shadow-popover);
  overflow: hidden;
}

.pmap-basemap {
  border: 0;
  padding: var(--s1) var(--s3);
  background: transparent;
  color: var(--text);
  font: inherit;
  cursor: pointer;
}

.pmap-basemap[aria-checked='true'] {
  background: var(--action);
  color: #fff;
}

.pmap-basemap:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: -2px;
}

.pmap-layers {
  padding: var(--s2) var(--s3);
  background: var(--raised);
  border: 1px solid var(--boundary);
  border-radius: var(--radius-control);
  box-shadow: var(--shadow-popover);
  font-size: 0.875rem;
}

.pmap-layers-title {
  display: flex;
  justify-content: space-between;
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.pmap-layer-list {
  margin-top: var(--s1);
}

.pmap-layer {
  display: flex;
  align-items: center;
  gap: var(--s2);
  padding: 2px 0;
  cursor: pointer;
}

.pmap-layer.is-unplaced {
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  cursor: default;
}

.pmap-layer-row {
  display: flex;
  align-items: center;
  gap: var(--s2);
  color: var(--text-secondary);
}

.pmap-layer-why {
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.pmap-count {
  margin-left: auto;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

.pmap-scope {
  font-size: 0.75rem;
  padding: 0 var(--s1);
  border-radius: var(--radius-control);
  background: var(--info-bg);
  color: var(--info);
}

.pmap-swatch {
  flex: none;
  width: 14px;
  height: 14px;
  display: inline-block;
  background: var(--swatch);
}

.pmap-swatch-circle {
  border-radius: 50%;
  border: 1.5px solid #fff;
  box-shadow: 0 0 0 1px var(--swatch);
}

.pmap-swatch-triangle {
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
}

.pmap-swatch-marker {
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg) scale(0.85);
}

.pmap-swatch-outline {
  background: transparent;
  border: 2px dashed var(--swatch);
}

.pmap-swatch-fill {
  opacity: 0.6;
  border: 1px solid var(--swatch);
}

.pmap-swatch-line {
  height: 3px;
  border-radius: 2px;
}

.pmap-swatch-dash {
  height: 0;
  background: transparent;
  border-top: 2px dashed var(--swatch);
}

.pmap-swatch-ring {
  background: transparent;
  border: 2.5px solid var(--swatch);
  border-radius: 50%;
}

/* Overlays drawn by other code (the screening models), after the layers. */
.pmap-overlay {
  margin-top: var(--s2);
  padding-top: var(--s2);
  border-top: 1px solid var(--separator);
}

.pmap-overlay-key {
  padding-left: 22px;
  font-size: 12px;
  color: var(--text-secondary);
}

.pmap-crs {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--s2);
  margin-top: var(--s1);
}

.pmap-crs label {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.pmap-crs input {
  width: 9rem;
}

.pmap-panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(420px, 100%);
  padding: var(--s4);
  overflow-y: auto;
  background: var(--raised);
  border-left: 1px solid var(--boundary);
  box-shadow: var(--shadow-popover);
  z-index: 3;
}

.pmap-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s2);
}

.pmap-panel-head h3 {
  margin: 0;
  font-size: 1.125rem;
}

.pmap-tabs {
  margin: var(--s3) 0;
}

.pmap-tabs button {
  border: 0;
  background: transparent;
  font: inherit;
  padding: var(--s1) var(--s2);
  color: var(--text-secondary);
  cursor: pointer;
  border-bottom: 2px solid transparent;
}

.pmap-tabs button[aria-selected='true'] {
  color: var(--text);
  border-bottom-color: var(--action);
}

.pmap-facts {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: var(--s1) var(--s3);
  margin: 0 0 var(--s3);
}

.pmap-facts dt {
  color: var(--text-secondary);
}

.pmap-facts dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.pmap-data {
  margin: 0;
  padding-left: var(--s4);
}

.pmap-choose {
  display: flex;
  align-items: center;
  gap: var(--s2);
  margin-bottom: var(--s3);
}

.pmap-chart {
  min-height: 220px;
}

.pmap-unavailable {
  padding: var(--s3);
  background: var(--subtle);
  border-radius: var(--radius-control);
}

.pmap-readings {
  margin-top: var(--s3);
  font-size: 0.8125rem;
}

.pmap-problems {
  margin: var(--s2) 0 0;
  padding-left: var(--s4);
  color: var(--warning);
  font-size: 0.875rem;
}

@media (max-width: 720px) {
  .pmap-controls {
    max-width: 60%;
  }

  .pmap-panel {
    top: auto;
    width: 100%;
    max-height: 70%;
    border-left: 0;
    border-top: 1px solid var(--boundary);
  }
}

/* ------------------------------------------------------------------ screening models
   models.js: the Models section under the task map. */

.model-beta {
  margin-left: var(--s2);
  padding: 1px var(--s2);
  font-size: 0.75rem;
  letter-spacing: 0;
  text-transform: none;
  color: var(--warning);
  background: var(--warning-bg);
  border-radius: var(--radius-control);
}

.model-list {
  margin: var(--s2) 0;
  padding: 0;
  list-style: none;
}

.model-list li {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2);
  align-items: baseline;
  padding: var(--s1) 0;
}

.model-list li.is-open button {
  font-weight: 600;
}

.model-form,
.model-panel {
  margin-top: var(--s3);
  padding: var(--s4);
  background: var(--raised);
  border: 1px solid var(--separator);
  border-radius: var(--radius-card);
}

.model-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--s3);
}

.model-grid label,
.model-form label {
  display: flex;
  flex-direction: column;
  gap: var(--s1);
}

.model-form fieldset {
  margin: 0 0 var(--s3);
  border: 1px solid var(--separator);
  border-radius: var(--radius-control);
}

.model-param-row {
  display: grid;
  grid-template-columns: minmax(160px, 1.4fr) 1fr 0.8fr 0.9fr 1.6fr;
  gap: var(--s2);
  align-items: center;
  padding: var(--s1) 0;
}

.model-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s3);
  align-items: center;
  margin-top: var(--s3);
}

/* The same look as the chart editor's sliders (.cs-slider): the action
   colour, the value small and secondary beside its label. */
.model-sliders {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--s3) var(--s5);
  margin: var(--s3) 0;
  padding: var(--s3) var(--s4);
  background: var(--canvas);
  border: 1px solid var(--separator);
  border-radius: var(--radius-control);
}

.model-slider {
  display: flex;
  flex-direction: column;
  gap: var(--s1);
}

.model-slider.is-off {
  opacity: 0.45;
}

.model-slider.is-off input[type='range'] {
  cursor: not-allowed;
}

.model-slider-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--s2);
}

.model-slider output {
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 12px;
}

.model-slider input[type='range'] {
  width: 100%;
  margin: 0;
  accent-color: var(--action);
}

.model-label {
  margin: var(--s2) 0;
}

.model-pin-card {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--s3);
}

.model-pin-card.is-loading {
  opacity: 0.6;
}

.model-pin-side {
  padding: var(--s3);
  background: var(--subtle);
  border-left: 4px solid var(--boundary);
  border-radius: var(--radius-control);
}

.model-pin-side p {
  margin: var(--s1) 0 0;
  font-size: 0.875rem;
  line-height: 1.45;
}

.model-state-future,
.model-state-already_above {
  border-left-color: var(--error);
}

.model-state-not_exceeded {
  border-left-color: var(--success);
}

.model-badge {
  display: inline-block;
  padding: 0 var(--s2);
  font-size: 0.75rem;
  border-radius: var(--radius-control);
  background: var(--subtle);
}

.model-badge-assumed {
  color: var(--warning);
  background: var(--warning-bg);
}

.model-badge-computed {
  color: var(--info);
}

.model-group th {
  text-align: left;
  color: var(--text-secondary);
}

.model-warnings {
  margin: var(--s2) 0;
  padding-left: var(--s4);
  color: var(--warning);
  font-size: 14px;
}

.model-error,
.model-error-box {
  color: var(--error);
}

.model-error-box {
  padding: var(--s3);
  background: var(--error-bg);
  border-radius: var(--radius-control);
}

.model-ring {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin: 0 var(--s1) 0 var(--s2);
  border: 2px solid var(--boundary);
  border-radius: 50%;
  vertical-align: middle;
}

.model-ring-agrees {
  border-color: #425c46;
}

.model-ring-model_higher {
  border-color: #9b3f36;
}

.model-ring-model_lower {
  border-color: #35677d;
}

@media (max-width: 720px) {
  .model-param-row {
    grid-template-columns: 1fr 1fr;
  }
}

/* ------------------------------------------------------------------ map workspace
   project-map.js: the controls beside the map (basemap, layers and the
   screening models), the map, and the panel for what was clicked, like a
   design tool's. The map section widens past the page's text column. */

.workspace {
  container: workspace / inline-size;
}

.pmap-host {
  --pmap-width: min(1440px, calc(100cqw - 2 * var(--s5)));
  width: var(--pmap-width);
  margin-left: calc((100% - var(--pmap-width)) / 2);
}

.pmap-workspace {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  height: min(80vh, 780px);
  min-height: 460px;
  border: 1px solid var(--boundary);
  border-radius: var(--radius-card);
  overflow: hidden;
  background: var(--raised);
}

.pmap-workspace.has-panel {
  grid-template-columns: 260px minmax(0, 1fr) minmax(300px, 340px);
}

.pmap-side {
  display: flex;
  flex-direction: column;
  gap: var(--s3);
  min-height: 0;
  padding: var(--s3);
  overflow-y: auto;
  /* Scrolls by wheel, trackpad or touch without a visible bar. */
  scrollbar-width: none;
  border-right: 1px solid var(--separator);
  font-size: 0.875rem;
}

.pmap-side::-webkit-scrollbar {
  display: none;
}

/* Each block keeps its own height; the column scrolls instead. */
.pmap-side > * {
  flex: none;
}

.pmap-side .pmap-basemaps {
  margin: var(--s1) 0 var(--s2);
  box-shadow: none;
}

.pmap-side-body {
  margin-top: var(--s2);
}

.pmap-side .pmap-layers {
  padding: 0;
  border: 0;
  box-shadow: none;
  background: transparent;
}

.pmap-side-extra {
  display: flex;
  flex-direction: column;
  gap: var(--s3);
}

.pmap-side-extra:empty {
  display: none;
}

/* Sections other code adds (the model) sit under Map layers, where they
   have room to grow. */
.pmap-side-extra .pmap-side-section {
  padding-top: var(--s3);
  border-top: 1px solid var(--separator);
}

.pmap-side-title {
  margin: 0 0 var(--s2);
  font-size: 0.875rem;
  font-weight: 600;
}

.pmap-workspace .pmap-stage {
  height: 100%;
  min-height: 0;
  border: 0;
  border-radius: 0;
}

.pmap-workspace .pmap-panel {
  position: static;
  width: auto;
  min-height: 0;
  border-left: 1px solid var(--separator);
  box-shadow: none;
}

@container workspace (max-width: 760px) {
  .pmap-workspace,
  .pmap-workspace.has-panel {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto 60vh auto;
    height: auto;
  }

  .pmap-side {
    max-height: 45vh;
    border-right: 0;
    border-bottom: 1px solid var(--separator);
  }

  .pmap-workspace .pmap-panel {
    max-height: 70vh;
    border-left: 0;
    border-top: 1px solid var(--separator);
  }
}

/* The model's controls in the map's controls column. */
.pmap-side .model-sliders {
  grid-template-columns: minmax(0, 1fr);
  gap: var(--s3);
  padding: var(--s3);
  margin: var(--s2) 0;
}

.pmap-side .model-label {
  margin: var(--s2) 0 0;
  font-size: 0.875rem;
}

.pmap-side .model-actions {
  margin-top: var(--s2);
  gap: var(--s2);
}

.model-choose select,
.model-baseline select {
  width: 100%;
  margin-top: var(--s2);
  font: inherit;
}

.model-baseline {
  display: flex;
  flex-direction: column;
  width: 100%;
}

.pmap-panel .model-pin-card {
  grid-template-columns: minmax(0, 1fr);
  margin-top: var(--s3);
}

/* The model, arranged around the map (models.js). */
/* Find parameters with AI: marked as AI (the sparkles), run in place. */
.model-ai {
  display: flex;
  align-items: flex-start;
  gap: var(--s2);
  width: 100%;
  margin-top: var(--s3);
  padding: var(--s2) var(--s3);
  border: 1px solid var(--separator);
  border-radius: var(--radius-control);
  background: var(--raised);
  color: var(--text);
  font: inherit;
  text-align: left;
}

button.model-ai {
  cursor: pointer;
}

button.model-ai:hover {
  border-color: var(--action);
  background: var(--selected);
}

button.model-ai:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.model-ai.is-running {
  align-items: center;
  background: var(--info-bg);
}

.model-ai-mark {
  flex: none;
  color: var(--info);
  line-height: 1.2;
}

.model-ai-text {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.model-ai-text /* One plain line under a model section's title: what kind of model it is. */
.model-sub {
  margin: 0;
  font-size: 13px;
  color: var(--text);
}

/* A parameter's allowed range under its field; red when broken. */
.model-range {
  font-size: 12px;
  color: var(--text-secondary);
}

.model-range:empty {
  display: none;
}

.model-range.is-invalid {
  color: var(--error);
}

.model-param-edit input[aria-invalid='true'] {
  border-color: var(--error);
}

/* A setup step the scenario needs (project parameters not entered yet):
   neutral, not an alarm. */
.model-setup {
  display: grid;
  gap: var(--s2);
  padding: var(--s3);
  background: var(--raised);
  border: 1px solid var(--separator);
  border-left: 3px solid var(--warning);
  border-radius: var(--radius-control);
  font-size: 13px;
}

.model-setup p {
  margin: 0;
}

/* A choice the data needs, asked in the scenario's message box. */
.model-question {
  display: grid;
  gap: var(--s2);
}

.model-question p {
  margin: 0;
}

/* The model results viewer (model-results.js). */
.mr-label {
  margin: 0;
  color: var(--text-secondary);
  font-size: 12px;
}

.mr-controls {
  display: grid;
  gap: var(--s3);
}

.mr-group {
  display: grid;
  gap: var(--s1);
}

.mr-group-label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--s2);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
}

/* One outlined control per group, as wide as its choices; each choice fills
   its share (the whole share is clickable) and the chosen one is tinted to
   the edges, in a heavier weight. No inner boxes. */
.model-seg.mr-seg {
  display: inline-flex;
  align-self: flex-start;
  justify-self: start;
  padding: 0;
  gap: 0;
  background: var(--raised);
  border: 1px solid var(--separator);
  border-radius: var(--radius-control);
  overflow: hidden;
}

.model-seg.mr-seg button {
  padding: 5px var(--s2);
  white-space: nowrap;
  background: transparent;
  color: var(--text-secondary);
  border-radius: 0;
}

.model-seg.mr-seg button + button {
  border-left: 1px solid var(--separator);
}

.model-seg.mr-seg button:hover {
  color: var(--text);
  background: var(--surface);
}

.model-seg.mr-seg button[aria-checked='true'] {
  background: var(--selected);
  color: var(--action);
  font-weight: 600;
}

/* The layer numbers are short: keep their hit area comfortable. */
.model-seg.mr-seg[data-short] button {
  min-width: 40px;
}

.mr-time {
  display: flex;
  align-items: center;
  gap: var(--s2);
}

.mr-time input[type='range'] {
  flex: 1;
  accent-color: var(--text-secondary);
}

.mr-play {
  flex: none;
  width: 28px;
  height: 28px;
  border: 1px solid var(--boundary);
  border-radius: 50%;
  background: var(--raised);
  color: var(--text);
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
}

.mr-play:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.mr-time-label {
  font-weight: normal;
  font-variant-numeric: tabular-nums;
}

.model-hint {
  margin: 0;
}

.model-ai.is-running .model-ai-mark {
  animation: model-ai-pulse 1.4s ease-in-out infinite;
}

@keyframes model-ai-pulse {
  50% {
    opacity: 0.35;
  }
}

@media (prefers-reduced-motion: reduce) {
  .model-ai.is-running .model-ai-mark {
    animation: none;
  }
}

.model-ai-line {
  margin: var(--s3) 0 0;
  color: var(--text-secondary);
  font-size: 13px;
}

.model-ai-line .icon-sm {
  color: var(--info);
  vertical-align: -2px;
}

.model-ai-why {
  color: var(--text);
  font-size: 13px;
}

.model-ai-result {
  margin: var(--s2) 0 0;
  font-size: 0.85rem;
}

.model-ai-result .icon-sm,
.model-hint .icon-sm {
  color: var(--info);
  vertical-align: -2px;
}

.model-link {
  display: block;
  margin-top: var(--s2);
}

.model-baseline-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--s2);
  margin-top: var(--s2);
}

.model-baseline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2);
}

.model-form-stack {
  display: flex;
  flex-direction: column;
  gap: var(--s2);
}

.model-form-stack label {
  display: flex;
  flex-direction: column;
  gap: var(--s1);
}

.model-group-title {
  margin: var(--s3) 0 var(--s1);
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.model-param {
  padding: var(--s1) 0;
  border-bottom: 1px solid var(--separator);
}

.model-param-main {
  display: flex;
  justify-content: space-between;
  gap: var(--s2);
}

.model-param-source {
  margin-top: 2px;
}

.model-param-edit {
  display: flex;
  flex-direction: column;
  gap: var(--s1);
  padding: var(--s1) 0;
}

.model-param-inputs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s1);
}

.model-param-inputs [name='kind'] {
  grid-column: 1 / -1;
}

/* The model's inputs, shown under its controls in the left column. */
.model-inputs {
  margin-top: var(--s3);
  padding-top: var(--s3);
  border-top: 1px solid var(--separator);
}

.model-inputs .model-param-main strong {
  white-space: nowrap;
}

.model-param-inputs input,
.model-param-inputs select {
  min-width: 0;
}

.model-runs {
  margin: 0;
  padding-left: var(--s4);
}

/* Make a figure from a saved run: one field per row, labels above. */
.model-figure-form {
  display: grid;
  gap: var(--s2);
  margin: var(--s2) 0 var(--s3);
  padding: var(--s3);
  background: var(--raised);
  border: 1px solid var(--separator);
  border-radius: var(--radius-card);
}

.model-figure-form label {
  display: grid;
  gap: var(--s1);
  font-size: 13px;
  color: var(--text-secondary);
}

.model-figure-form p {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2);
  align-items: center;
  margin: 0;
}

.model-new-data {
  margin: 0 0 var(--s2);
  padding: var(--s1) var(--s2);
  border-radius: var(--radius-control);
  background: var(--warning-bg);
  color: var(--warning);
  font-size: 13px;
}

.model-fallback {
  margin-top: var(--s3);
  padding: var(--s4);
  background: var(--raised);
  border: 1px solid var(--separator);
  border-radius: var(--radius-card);
}

/* The scenario picker (models.js), in the chart builder's menu style. */
.model-menu {
  margin-top: var(--s2);
}

.model-menu .fb-menu-button {
  font-size: 0.875rem;
}

.model-menu-current {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.model-menu .fb-menu-list [role='option'] {
  flex-direction: column;
  align-items: flex-start;
  gap: 0;
  font-size: 0.875rem;
}

.model-menu-meta {
  color: var(--text-secondary);
  font-size: 12px;
}

.model-menu .fb-menu-list .model-menu-action {
  color: var(--action);
}

.model-menu-divider {
  height: 1px;
  margin: var(--s1) var(--s2);
  background: var(--separator);
}

/* Form fields in the left column: the app's .input and .select, compact. */
.model-input {
  min-height: 32px;
  height: 32px;
  padding: 0 var(--s2);
  font-size: 13px;
  font-weight: 400;
}

.model-input.select {
  padding-right: 28px;
  background-position: right 8px center;
}

.model-form-stack .field-label {
  font-size: 13px;
}

.model-param-edit + .model-param-edit {
  border-top: 1px solid var(--separator);
}

.model-param-edit {
  padding: var(--s2) 0;
}

/* Measured / Assumed: a two-way switch like Streets / Aerial. */
.model-seg {
  display: inline-flex;
  align-self: flex-start;
  border: 1px solid var(--boundary);
  border-radius: var(--radius-control);
  overflow: hidden;
}

.model-seg button {
  border: 0;
  padding: 3px var(--s3);
  background: var(--raised);
  color: var(--text);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

.model-seg button + button {
  border-left: 1px solid var(--boundary);
}

.model-seg button[aria-checked='true'] {
  background: var(--action);
  color: #fff;
}

.model-seg button:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: -2px;
}

.model-hint {
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.4;
}

.model-error-fix {
  margin: var(--s2) 0 0;
  color: var(--text);
}

/* Everything in the model's column starts at its left edge. */
.pmap-side .link-button,
.model-fallback .link-button {
  text-align: left;
}

.pmap-side .model-warnings,
.model-fallback .model-warnings {
  padding-left: 0;
  list-style: none;
}

.pmap-side .model-warnings li + li {
  margin-top: var(--s1);
}

/* A side section's header (project-map.js sideSection): the title folds the
   section; an optional "i" button sits right after the title, over it. */
.pmap-side-head {
  display: grid;
  grid-template-columns: max-content max-content 1fr;
  align-items: center;
}

.pmap-side-head .pmap-layers-title {
  display: grid;
  grid-template-columns: subgrid;
  grid-column: 1 / -1;
  grid-row: 1;
}

.pmap-side-head .pmap-layers-title > :last-child {
  justify-self: end;
}

/* The ⓘ and a badge after a section's title, over the title button. */
.pmap-side-tools {
  display: inline-flex;
  align-items: center;
  gap: var(--s2);
  grid-column: 2;
  grid-row: 1;
  z-index: 1;
  margin-left: var(--s1);
}

.pmap-side-badge {
  padding: 1px var(--s2);
  font-size: 0.75rem;
  color: var(--warning);
  background: var(--warning-bg);
  border-radius: var(--radius-control);
}

.pmap-side-info {
  display: inline-flex;
  padding: 2px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
}

.pmap-side-info:hover {
  color: var(--action);
  background: var(--selected);
}

.pmap-side-info:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 1px;
}

/* The domain expert's review (models.js): assumptions, the edge warning,
   the no-decay switch and the wells table. */
.model-assumptions {
  margin-top: var(--s2);
  font-size: 13px;
}

.model-assumptions summary {
  cursor: pointer;
  color: var(--text-secondary);
}

.model-assumptions dl {
  display: grid;
  gap: 4px;
  margin: var(--s2) 0 0;
}

.model-assumptions dl > div {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: var(--s2);
}

.model-assumptions dt {
  color: var(--text-secondary);
}

.model-assumptions dd {
  margin: 0;
}

.model-edge-warning {
  margin: var(--s2) 0 0;
  padding: var(--s1) var(--s2);
  border-radius: var(--radius-control);
  background: var(--warning-bg);
  color: var(--warning);
  font-size: 13px;
}

.model-check {
  display: flex;
  align-items: center;
  gap: var(--s2);
  font-size: 13px;
}

.pmap-well-extra {
  margin-bottom: var(--s3);
  padding-bottom: var(--s3);
  border-bottom: 1px solid var(--separator);
}

.pmap-well-extra .eyebrow {
  margin: 0 0 var(--s1);
}

.pmap-well-extra p {
  margin: var(--s1) 0;
}

/* About this model (models.js). */
.model-beta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s2);
  margin: 0;
}

/* In its own row the badge lines up with the text above it. */
.model-beta-row .model-beta {
  margin-left: 0;
}

.model-beta-row .link-button {
  font-size: 13px;
}

.model-about {
  width: min(620px, calc(100vw - 32px));
  max-height: calc(100vh - 64px);
  overflow-y: auto;
}

/* One size and one color throughout; headings differ by weight only. */
.model-about .ask-dialog-message,
.model-about .model-group-title,
.model-about-list {
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
}

.model-about .ask-dialog-message {
  margin: 0 0 var(--s3);
}

.model-about .model-group-title {
  margin: var(--s4) 0 var(--s1);
  font-weight: 600;
}

.model-about-list {
  margin: 0;
  padding-left: var(--s4);
}

.model-about-list strong {
  font-weight: 600;
}

.model-about-list li + li {
  margin-top: var(--s1);
}

/* Values the AI found in documents (models.js), waiting for a person. */
.model-review {
  width: min(760px, calc(100vw - 32px));
  max-height: calc(100vh - 64px);
  overflow-y: auto;
}

.model-review .notes-dialog-title .icon-sm,
.model-suggest-line .icon-sm {
  color: var(--info);
  vertical-align: -2px;
}

.model-review-head,
.model-review-line {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: var(--s2);
  align-items: center;
}

.model-review-head {
  grid-template-columns:
    24px minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 1.3fr)
    48px 16px;
  margin-top: var(--s3);
  padding: 0 0 var(--s1);
  border-bottom: 1px solid var(--separator);
  color: var(--text-secondary);
  font-size: 12px;
}

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

.model-review-row {
  border-bottom: 1px solid var(--separator);
}

.model-review-line {
  padding: var(--s2) 0;
}

.model-review-name {
  display: grid;
  grid-template-columns:
    minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 1.3fr)
    48px 16px;
  gap: var(--s2);
  align-items: baseline;
  width: 100%;
  padding: 0;
  border: 0;
  background: none;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
}

.model-review-name:hover .model-review-label {
  text-decoration: underline;
}

.model-review-name:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.model-review-now {
  color: var(--text-secondary);
  font-size: 13px;
}

.model-review-chevron {
  color: var(--text-secondary);
  font-size: 11px;
}

.model-review-more {
  padding: 0 0 var(--s2) calc(24px + var(--s2));
}

.model-review-more .link-button {
  margin-top: var(--s1);
  font-size: 13px;
}

.model-review-yours {
  display: block;
  font-size: 12px;
}

.model-review-choices {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--s1) var(--s3);
  margin-top: var(--s1);
}

.model-review-choices .link-button,
.model-review-more .model-review-choices .link-button {
  margin-top: 0;
}

.model-review-choices .report-meta {
  margin-left: calc(-1 * var(--s2));
  font-size: 12px;
}

.model-review-edit {
  margin-top: var(--s2);
}

.model-review-edit-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s2);
  margin-top: var(--s1);
}

.model-review-edit-row .input {
  width: 9em;
}

.model-review-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--s3);
  margin-top: var(--s4);
}

.model-review-actions {
  display: flex;
  align-items: center;
  gap: var(--s3);
  margin-left: auto;
}

@media (max-width: 600px) {
  .model-review-head {
    display: none;
  }

  .model-review-name {
    grid-template-columns: minmax(0, 1fr) 16px;
    row-gap: 2px;
  }

  .model-review-chevron {
    grid-row: 1;
    grid-column: 2;
  }

  .model-review-found,
  .model-review-now {
    grid-column: 1;
  }

  .model-review-page {
    display: none;
  }
}

.model-suggest-line {
  margin: var(--s2) 0 0;
  padding: var(--s1) var(--s2);
  background: var(--warning-bg);
  border-radius: var(--radius-control);
}

.model-suggestion {
  padding: var(--s2) 0;
  border-bottom: 1px solid var(--separator);
}

.model-quote {
  margin: var(--s1) 0 0;
  font-size: 13px;
  font-style: italic;
  color: var(--text);
}

.model-suggestion .model-actions {
  margin-top: var(--s1);
}

/* ------------------------------------------------------------------
   Report figures (report-figures.js): the Figures dialog, All figures
   and the chat gallery share one grid. */

.files-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s3);
}

.figures-dialog {
  width: min(980px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
}

/* Only while open: a closed dialog must stay display: none. */
.figures-dialog[open] {
  display: flex;
  flex-direction: column;
}

#allFiguresButton[hidden] {
  display: none;
}

.figures-dialog-body {
  overflow-y: auto;
  min-height: 0;
  flex: 1;
}

.figures-dialog-foot {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s2);
  justify-content: flex-end;
  padding-top: var(--s3);
  border-top: 1px solid var(--separator);
  margin-top: var(--s3);
}

.figures-dialog-foot:empty {
  display: none;
}

.rf-intro {
  margin-bottom: var(--s3);
}

.rf-message {
  margin-bottom: var(--s3);
}

.rf-group + .rf-group {
  margin-top: var(--s4);
}

.rf-group-note {
  margin: 0 0 var(--s2);
  font-size: 12px;
}

.rf-group-title {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: var(--s2);
}

details.rf-group > summary.rf-group-title {
  cursor: pointer;
  width: fit-content;
}

.rf-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: var(--s2);
}

.rf-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0;
  padding: 6px;
  border: 1px solid var(--separator);
  border-radius: var(--radius-card);
  background: var(--raised);
  min-width: 0;
}

.rf-card.is-read {
  border-color: var(--success);
}

.rf-thumb {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 4 / 3;
  max-width: 100%;
  padding: 0;
  border: 0;
  border-radius: calc(var(--radius-card) - 2px);
  background: var(--subtle);
  overflow: hidden;
  cursor: pointer;
}

.rf-thumb:hover img,
.rf-thumb:focus-visible img {
  transform: scale(1.03);
}

.rf-thumb img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  transition: transform 0.12s ease;
}

.rf-gone {
  cursor: default;
  padding: var(--s3);
  font-size: 12px;
  text-align: center;
  color: var(--text-secondary);
}

/* The tick box sits on the thumbnail's corner, so the card stays small. */
.rf-pick {
  position: absolute;
  top: 10px;
  left: 10px;
  display: flex;
  padding: 4px;
  border-radius: 6px;
  background: var(--raised);
  box-shadow: 0 0 0 1px var(--separator);
  cursor: pointer;
}

.rf-card figcaption {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 12px;
  line-height: 16px;
  min-width: 0;
}

.rf-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
}

.rf-where {
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rf-state {
  flex: none;
  font-size: 11px;
  padding: 0 6px;
  border-radius: 999px;
  line-height: 17px;
}

.rf-state.rf-unread {
  color: var(--text-secondary);
  border: 1px solid var(--separator);
}

.rf-state.rf-read {
  color: var(--success);
  background: var(--success-bg);
}

.rf-caption {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}

.rf-mentions {
  color: var(--text-secondary);
  font-size: 11px;
}

.rf-summary {
  color: var(--text-secondary);
  font-style: italic;
}

.rf-choose {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}

.rf-transcribe {
  margin: 0 0 var(--s3);
  padding: var(--s3);
  border-radius: var(--radius-card);
  background: var(--subtle);
  font-size: 13px;
  line-height: 19px;
}

.rf-transcribe p {
  margin: 0 0 var(--s2);
}

.rf-transcribe-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s2);
}

/* The viewer: one figure at a time, arrows to step. */
.rf-viewer {
  margin: auto;
  width: min(1100px, calc(100vw - 32px));
  height: min(860px, calc(100vh - 32px));
  padding: 0;
  border: 1px solid var(--separator);
  border-radius: var(--radius-card);
  background: var(--raised);
  box-shadow: var(--shadow-popover);
  overflow: hidden;
}

.rf-viewer[open] {
  display: flex;
  flex-direction: column;
}

.rf-viewer::backdrop {
  background: #252b2699;
}

.rf-viewer-head {
  display: flex;
  align-items: center;
  gap: var(--s3);
  padding: var(--s2) var(--s3);
  border-bottom: 1px solid var(--separator);
  font-size: 13px;
}

.rf-viewer-count {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.rf-viewer-where {
  color: var(--text-secondary);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rf-viewer-stage {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 48px 1fr 48px;
  align-items: center;
  background: var(--subtle);
}

.rf-viewer-picture {
  position: relative;
  height: 100%;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--s3) 0;
  overflow: hidden;
}

.rf-viewer-picture img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  background: white;
  box-shadow: 0 1px 3px #0002;
  transform-origin: center;
  /* A click does nothing until zoomed in (then the picture drags). */
  cursor: default;
  touch-action: none;
  user-select: none;
}

.rf-viewer-picture.is-zoomed img {
  cursor: grab;
}

.rf-viewer-picture.is-zoomed img:active {
  cursor: grabbing;
}

/* + − (and Fit once zoomed) over the picture's top right corner. */
.rf-zoom {
  position: absolute;
  top: var(--s3);
  right: var(--s2);
  display: flex;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--boundary);
  border-radius: var(--radius-control);
  background: var(--raised);
  box-shadow: 0 1px 3px #0002;
}

/* + − and Fit in one color; a direction at its limit is greyed out. */
.rf-zoom .btn {
  color: var(--text);
}

.rf-zoom .btn:disabled {
  color: var(--text-secondary);
  opacity: 0.4;
  cursor: default;
}

/* Fit shows only while zoomed in (a .btn's display beats [hidden]). */
.rf-zoom .rf-zoom-fit[hidden] {
  display: none;
}

.rf-zoom .rf-zoom-fit {
  min-height: 32px;
  font-size: 13px;
}

.rf-zoom .btn-icon {
  min-width: 32px;
  min-height: 32px;
  font-size: 18px;
  line-height: 1;
}

.rf-viewer-step {
  height: 100%;
  border: 0;
  background: transparent;
  font-size: 36px;
  color: var(--text-secondary);
  cursor: pointer;
}

.rf-viewer-step:hover:not(:disabled) {
  color: var(--text);
  background: var(--selected);
}

.rf-viewer-step:disabled {
  opacity: 0.25;
  cursor: default;
}

.rf-viewer-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--s3);
  padding: var(--s2) var(--s3);
  border-top: 1px solid var(--separator);
}

.rf-viewer-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 13px;
  min-width: 0;
  flex: 1;
}

.rf-viewer-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--s2);
}

.rf-gallery .rf-grid {
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
}

.pf-actions {
  white-space: nowrap;
}

.pf-actions .btn + * {
  margin-left: var(--s2);
}
