/* Environmental Data Analyst — field-guide design system.
   Values follow the design plates: warm light only, Inter for the product,
   Instrument Serif for display headlines, 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-serif: 'Instrument Serif', Georgia, 'Times New Roman', 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-family: var(--font-serif);
  font-weight: 400;
  font-size: 40px;
  line-height: 44px;
  letter-spacing: -0.01em;
  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);
}

.btn-secondary {
  background: var(--raised);
  border-color: var(--boundary);
  color: var(--text);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--selected);
}

.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;
}

.brand-mark .icon {
  width: 24px;
  height: 24px;
  color: var(--action);
}

.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(--s3);
  min-width: 0;
}

.account-usage {
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 18px;
  color: var(--text-secondary);
  white-space: nowrap;
}

.account-short {
  display: none;
}

.account-button {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  cursor: pointer;
  text-decoration: underline dotted;
  text-underline-offset: 3px;
}

.account-email {
  font-size: 14px;
  line-height: 20px;
  color: var(--text-secondary);
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.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;
}

.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);
}

.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);
}

.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;
}

/* 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;
  }
}

/* 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));
  }

  /* The email gives way to a short "Account" (account-short), which still
     opens the account dialog. */
  .account-full {
    display: none;
  }

  .account-short {
    display: inline;
  }
}

/* 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: 32px;
    line-height: 36px;
  }

  .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-family: var(--font-serif);
  font-size: 32px;
  line-height: 38px;
  font-weight: 400;
}

.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-family: var(--font-serif);
  font-size: 40px;
  line-height: 46px;
  font-weight: 400;
}

.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: 32px;
    line-height: 38px;
  }

  .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);
}

.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;
}

.back-link {
  display: block;
  margin: 0 0 var(--s4);
  font-size: 13px;
  color: var(--text-secondary);
}

/* 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;
}

.dir-project {
  margin: var(--s6) 0 0;
}

.dir-project-title {
  font-size: 17px;
  font-weight: 500;
}

.dir-project-title a {
  color: var(--text);
}

.dir-project-title .flag {
  margin-left: var(--s2);
}

.dir-tasks {
  margin: var(--s2) 0 0 var(--s5);
  border-top: 1px solid var(--separator);
}

.dir-task {
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr) auto auto 72px;
  align-items: baseline;
  gap: var(--s3);
  padding: var(--s3) var(--s2);
  border-bottom: 1px solid var(--separator);
  color: var(--text);
  text-decoration: none;
}

.dir-task:hover {
  background: var(--selected);
}

.dir-task .num {
  font-variant-numeric: tabular-nums;
}

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

.dir-add {
  margin: var(--s2) 0 0 var(--s5);
  display: inline-flex;
  align-items: center;
  gap: var(--s1);
  font-size: 13px;
}

.dir-new {
  margin-top: var(--s7);
}

.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 {
  padding: 4px 7px;
  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;
}

.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;
}

.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;
  color: var(--text-secondary);
  font-size: 12px;
  text-align: right;
}

.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 */

.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. */
.setup-card {
  display: grid;
  gap: var(--s3);
  margin-bottom: var(--s5);
  padding: var(--s4);
  background: var(--raised);
  border: 1px solid var(--separator);
  border-radius: var(--radius-card);
  justify-items: start;
}

.setup-card-head {
  display: flex;
  justify-content: space-between;
  width: 100%;
  gap: var(--s3);
}

.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;
}

.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);
}

.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-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);
  }
}
