:root {
  color-scheme: light;
  --bg: #f6f7f5;
  --panel: #ffffff;
  --ink: #17201b;
  --muted: #647068;
  --line: #d8ded8;
  --brand: #245f46;
  --brand-dark: #174531;
  --accent: #d18837;
  --warn: #fff1d8;
  --warn-line: #e0a54e;
}

* {
  box-sizing: border-box;
}

html,
body {
  max-width: 100%;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--ink);
}

body.modal-open {
  overflow: hidden;
  touch-action: none;
}

a {
  color: inherit;
}

[hidden] {
  display: none !important;
}

button {
  max-width: 100%;
}

.visually-hidden {
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  height: 1px;
  overflow: hidden;
  position: absolute;
  white-space: nowrap;
  width: 1px;
}

.topbar {
  align-items: center;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 16px;
  justify-content: space-between;
  min-height: 64px;
  padding: 12px clamp(16px, 4vw, 40px);
  position: sticky;
  top: 0;
  z-index: 5;
}

.workflow-step {
  scroll-margin-top: 84px;
}

.brand {
  align-items: center;
  display: flex;
  gap: 12px;
  font-weight: 800;
  min-width: 0;
  text-decoration: none;
}

.brand-logo-wide {
  display: block;
  height: 28px;
  object-fit: contain;
  width: auto;
}

.brand-logo-mark {
  display: none;
  height: 34px;
  object-fit: contain;
  width: auto;
}

.brand span {
  border-left: 1px solid var(--line);
  min-width: 0;
  overflow: hidden;
  padding-left: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: flex-end;
}

.nav a {
  color: var(--muted);
  font-weight: 650;
  text-decoration: none;
}

.page {
  margin: 0 auto;
  max-width: 1080px;
  min-width: 0;
  padding: 24px clamp(16px, 4vw, 40px) 64px;
  width: 100%;
}

.messages {
  margin: 16px auto 0;
  max-width: 1080px;
  padding: 0 clamp(16px, 4vw, 40px);
}

.workspace-banner {
  align-items: center;
  background: #eef5f0;
  border-bottom: 1px solid #b7c7bc;
  color: var(--brand-dark);
  display: flex;
  font-weight: 800;
  gap: 12px;
  justify-content: center;
  min-height: 42px;
  padding: 9px clamp(16px, 4vw, 40px);
  text-align: center;
}

.workspace-banner.is-on-behalf {
  background: #fff6e8;
  border-bottom-color: var(--warn-line);
  color: #704018;
}

.workspace-banner a {
  color: inherit;
  font-size: .92rem;
  font-weight: 750;
}

.message,
.warning-box,
.form-errors {
  background: var(--warn);
  border: 1px solid var(--warn-line);
  border-radius: 8px;
  padding: 12px 14px;
}

.tip-box {
  background: #eef5f0;
  border: 1px solid #b7c7bc;
  border-radius: 8px;
  color: var(--muted);
  font-size: .95rem;
  line-height: 1.4;
  margin: 0;
  overflow-wrap: anywhere;
  padding: 12px 14px;
}

.inline-error {
  background: var(--warn);
  border: 1px solid var(--warn-line);
  border-radius: 8px;
  color: var(--ink);
  margin: 0;
  overflow-wrap: anywhere;
  padding: 10px 12px;
}

.inline-error[hidden] {
  display: none;
}

.errorlist {
  background: #fff1d8;
  border: 2px solid #b94a25;
  border-radius: 8px;
  color: #7a2e17;
  font-weight: 850;
  line-height: 1.35;
  list-style: none;
  margin: 8px 0 0;
  padding: 10px 12px;
}

.errorlist li + li {
  margin-top: 6px;
}

.field-row.has-errors {
  background: #fff8ed;
  border: 2px solid #b94a25;
  border-radius: 8px;
  margin: 0;
  padding: 12px;
}

.field-row.has-errors label {
  color: #7a2e17;
}

.field-row.has-errors input,
.field-row.has-errors select,
.field-row.has-errors textarea {
  border-color: #b94a25;
  box-shadow: 0 0 0 3px rgba(185, 74, 37, .14);
}

.existing-user-confirmation {
  display: grid;
  gap: 6px;
}

.existing-user-confirmation p {
  margin: 0;
}

h1,
h2 {
  line-height: 1.1;
  margin: 0;
}

h1 {
  font-size: clamp(2rem, 4vw, 3rem);
}

h2 {
  font-size: 1.15rem;
}

.muted {
  color: var(--muted);
}

.eyebrow {
  color: var(--accent);
  font-size: .8rem;
  font-weight: 800;
  letter-spacing: .08em;
  margin: 0 0 6px;
  text-transform: uppercase;
}

.narrow-panel,
.form-section,
.table-panel,
.success-panel,
.workspace-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  max-width: 100%;
  min-width: 0;
  padding: clamp(18px, 4vw, 28px);
}

.workflow-step {
  padding: 0;
}

.workflow-step summary {
  align-items: center;
  cursor: pointer;
  display: flex;
  font-size: 1.15rem;
  font-weight: 850;
  gap: 8px;
  justify-content: space-between;
  list-style: none;
  min-height: 60px;
  padding: 0 clamp(18px, 4vw, 28px);
}

.workflow-step[hidden] {
  display: none;
}

.step-heading {
  color: var(--ink);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.step-summary {
  color: var(--muted);
  font-size: .95rem;
  font-weight: 700;
  margin-left: auto;
  max-width: 48%;
  overflow: hidden;
  padding: 0 14px;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workflow-step summary::-webkit-details-marker {
  display: none;
}

.workflow-step summary::after {
  color: var(--muted);
  content: "+";
  flex: 0 0 auto;
  font-size: 1.45rem;
  font-weight: 700;
}

.workflow-step[open] summary {
  border-bottom: 1px solid var(--line);
}

.workflow-step[open] summary::after {
  content: "-";
}

.workflow-step-body {
  display: grid;
  gap: 18px;
  min-width: 0;
  padding: clamp(18px, 4vw, 28px);
}

.narrow-panel {
  margin: 24px auto;
  max-width: 560px;
}

.dashboard-header,
.workflow-header {
  align-items: center;
  display: flex;
  gap: 20px;
  justify-content: space-between;
  margin-bottom: 24px;
  min-width: 0;
}

.workspace-panel {
  display: grid;
  gap: 16px;
  margin-bottom: 24px;
}

.workspace-form {
  align-items: end;
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(0, 1fr) auto;
}

.dashboard-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
  min-width: 0;
}

.filter-context-note {
  color: var(--muted);
  font-size: .98rem;
  margin: -12px 0 14px;
}

.filter-context-note span {
  display: inline-block;
  margin-left: 14px;
}

.filter-context-note strong {
  color: var(--ink);
}

.sticky-filter {
  align-items: center;
  background: rgba(255, 255, 255, .96);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 6px 18px rgba(23, 32, 27, .06);
  display: flex;
  gap: 12px;
  margin: -8px 0 18px;
  padding: 10px 12px;
  position: sticky;
  top: 78px;
  z-index: 4;
}

.sticky-filter .filter-field {
  color: var(--muted);
  display: grid;
  flex: 1 1 240px;
  font-size: .9rem;
  font-weight: 850;
  gap: 6px;
}

.sticky-filter .filter-field span {
  display: block;
}

.sticky-filter select {
  background: var(--panel);
  color: var(--brand-dark);
  font-weight: 800;
  min-width: 0;
  min-height: 40px;
  padding-block: 7px;
}

.workflow-header-actions,
.image-card-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
  min-width: 0;
}

.clear-entries-action {
  border-color: #c9b8ad;
  color: #7a3d26;
}

.clear-entries-action:hover,
.clear-entries-action:focus {
  background: #f7eee8;
  outline: 3px solid rgba(122, 61, 38, .14);
  outline-offset: 2px;
}

.stack,
.collector-form {
  display: grid;
  gap: 18px;
  min-width: 0;
}

.collector-form *,
.workflow-step,
.workflow-step summary,
.workflow-step-body {
  min-width: 0;
}

.choice-button,
.primary-action,
.secondary-action,
.action-list a {
  align-items: center;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  font-weight: 800;
  justify-content: center;
  min-height: 48px;
  min-width: 0;
  padding: 12px 16px;
  text-decoration: none;
  white-space: normal;
  overflow-wrap: anywhere;
}

.choice-button {
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--ink);
  flex-direction: column;
  width: 100%;
}

.choice-button small {
  color: var(--muted);
}

.inactive-login-panel {
  margin-top: 18px;
}

.inactive-choice-button {
  background: #f7f3ef;
  border-color: #cbbba9;
}

.primary-action {
  background: var(--brand);
  border: 1px solid var(--brand);
  color: white;
}

.primary-action:hover {
  background: var(--brand-dark);
}

.primary-action:disabled {
  background: #9eaaa2;
  border-color: #9eaaa2;
  cursor: not-allowed;
}

.final-submit-action:not(:disabled) {
  box-shadow: 0 0 0 4px rgba(36, 95, 70, .16);
  font-size: 1.05rem;
  min-height: 56px;
}

.secondary-action {
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--brand-dark);
}

.workflow-next-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
  min-width: 0;
}

.workflow-next-action {
  background: #e7f2ec;
  border: 1px solid var(--brand);
  border-radius: 8px;
  color: var(--brand-dark);
  cursor: pointer;
  font: inherit;
  font-weight: 850;
  min-height: 44px;
  min-width: 112px;
  padding: 10px 18px;
  white-space: normal;
  overflow-wrap: anywhere;
}

.workflow-next-action:hover,
.workflow-next-action:focus {
  background: #d7eadf;
  outline: 3px solid rgba(36, 95, 70, .18);
  outline-offset: 2px;
}

.workflow-next-action:disabled {
  background: #eef2ee;
  border-color: var(--line);
  color: var(--muted);
  cursor: not-allowed;
  outline: 0;
}

.optional-skip-row {
  margin-bottom: -4px;
}

.diagnosis-done-row {
  justify-content: flex-start;
}

.diagnosis-tag-panel .diagnosis-done-row {
  align-items: flex-start;
}

.diagnosis-add-row {
  justify-content: flex-end;
}

.diagnosis-custom-add-action {
  align-items: flex-start;
  display: inline-flex;
  flex-direction: column;
  gap: 3px;
  min-height: 58px;
  min-width: min(100%, 260px);
  max-width: 100%;
  text-align: left;
}

.diagnosis-custom-add-action small {
  color: var(--muted);
  font-weight: 650;
}

.image-action-row {
  justify-content: space-between;
}

.image-action-row .workflow-next-action {
  flex: 1 1 180px;
}

.submit-help {
  background: #eef5f0;
  border: 1px solid #b7c7bc;
  border-radius: 8px;
  display: grid;
  gap: 10px;
  padding: 12px;
}

.submit-help[hidden] {
  display: none;
}

.submit-help p {
  color: var(--muted);
  font-weight: 800;
  margin: 0;
}

.submit-help-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.submit-help-button {
  background: var(--panel);
  border: 1px solid var(--brand);
  border-radius: 8px;
  color: var(--brand-dark);
  cursor: pointer;
  font: inherit;
  font-weight: 800;
  min-height: 40px;
  padding: 8px 12px;
  white-space: normal;
}

.gps-action {
  margin-top: 8px;
}

.full-width {
  width: 100%;
}

.segmented-control {
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 0;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  min-width: 0;
  overflow: hidden;
}

.segment-button {
  background: var(--panel);
  border: 0;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-weight: 800;
  min-height: 46px;
  padding: 10px 12px;
}

.segment-button + .segment-button {
  border-left: 1px solid var(--line);
}

.segment-button.is-selected {
  background: #e7f2ec;
  color: var(--brand-dark);
}

.quality-score-control {
  display: grid;
  gap: 10px;
}

.quality-score-buttons {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.score-button {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  font-size: 1.15rem;
  font-weight: 850;
  min-height: 52px;
}

.score-button.is-selected {
  background: #e7f2ec;
  border-color: var(--brand);
  box-shadow: inset 0 0 0 1px var(--brand);
  color: var(--brand-dark);
}

input[readonly] {
  background: #eef2ee;
  color: var(--muted);
}

.file-input-hidden {
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  height: 1px;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
  position: fixed;
  white-space: nowrap;
  width: 1px;
}

.metric-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  margin-bottom: 24px;
}

.metric {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
}

.metric span {
  display: block;
  font-size: 2.25rem;
  font-weight: 850;
}

.metric p {
  color: var(--muted);
  margin: 4px 0 0;
}

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

.panel-title-row {
  align-items: center;
  display: flex;
  gap: 10px;
  justify-content: space-between;
  margin-bottom: 12px;
}

.panel-title-row h2 + p {
  margin-top: 5px;
}

.panel-title-row span {
  background: #eef5f0;
  border: 1px solid #b7c7bc;
  border-radius: 999px;
  color: var(--muted);
  flex: 0 0 auto;
  font-size: .85rem;
  font-weight: 800;
  max-width: 50%;
  overflow: hidden;
  padding: 5px 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.panel-actions {
  align-items: center;
  display: flex;
  flex: 0 0 auto;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  max-width: 58%;
}

.panel-actions span {
  max-width: none;
}

.compact-export-action {
  font-size: .9rem;
  min-height: 36px;
  padding: 7px 10px;
}

.admin-action-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.admin-action-card {
  align-items: flex-start;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 120px;
  padding: 18px;
  position: relative;
  text-decoration: none;
}

.admin-action-card::after {
  color: var(--brand);
  content: ">";
  font-size: 1.25rem;
  font-weight: 900;
  position: absolute;
  right: 16px;
  top: 16px;
}

.admin-action-card span {
  color: var(--brand-dark);
  font-size: 1.05rem;
  font-weight: 850;
  padding-right: 26px;
}

.admin-action-card small {
  color: var(--muted);
  font-size: .95rem;
  font-weight: 650;
  line-height: 1.35;
}

.admin-action-card:hover,
.admin-action-card:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(36, 95, 70, .12);
  outline: 0;
}

.primary-admin-action {
  background: #e7f2ec;
  border-color: var(--brand);
}

.table-action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.table-action-row a {
  color: var(--brand-dark);
  font-weight: 800;
}

.admin-users-table-panel {
  isolation: isolate;
  overflow: visible;
  position: relative;
}

.admin-users-table-scroll {
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  overscroll-behavior-x: contain;
  -webkit-overflow-scrolling: touch;
}

.admin-users-scrollbar {
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  height: 18px;
  margin: -4px 0 10px;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  position: sticky;
  top: 0;
  z-index: 20;
  -webkit-overflow-scrolling: touch;
}

.admin-users-scrollbar [data-scroll-sync-spacer] {
  height: 1px;
}

.admin-users-table {
  border-collapse: separate;
  border-spacing: 0;
  min-width: 920px;
}

.admin-users-table .sticky-table-column {
  background: var(--panel);
  border-right: 1px solid var(--line);
  box-shadow: 6px 0 10px -9px rgba(23, 32, 27, .65);
  left: 0;
  max-width: 220px;
  min-width: 180px;
  overflow: hidden;
  position: sticky;
  text-overflow: ellipsis;
  white-space: nowrap;
  z-index: 5;
}

.admin-users-table th.sticky-table-column {
  z-index: 6;
}

.inline-filter-form {
  margin: 0;
}

.inline-checkbox {
  align-items: center;
  background: #fbfcfb;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  display: inline-flex;
  flex-direction: row;
  font-size: .9rem;
  font-weight: 800;
  gap: 8px;
  min-height: 36px;
  padding: 7px 10px;
}

.inline-checkbox input {
  flex: 0 0 auto;
  height: 18px;
  min-height: 18px;
  padding: 0;
  width: 18px;
}

.form-helper-details {
  background: #f3f7f4;
  border: 1px solid #b7c7bc;
  border-radius: 8px;
  color: var(--muted);
  margin: 14px 0 0;
}

.form-helper-details summary {
  color: var(--brand-dark);
  cursor: pointer;
  font-weight: 850;
  padding: 12px 14px;
}

.form-helper-details dl {
  border-top: 1px solid #b7c7bc;
  display: grid;
  gap: 0;
  margin: 0;
  padding: 4px 14px 12px;
}

.form-helper-details div {
  display: grid;
  gap: 4px;
  padding: 10px 0;
}

.form-helper-details div + div {
  border-top: 1px solid #dbe6de;
}

.form-helper-details dt {
  color: var(--ink);
  font-weight: 850;
}

.form-helper-details dd {
  line-height: 1.35;
  margin: 0;
}

.organization-form-panel {
  max-width: 680px;
}

.form-preview-panel {
  background: #f3f7f4;
  border: 1px solid #b7c7bc;
  border-radius: 8px;
  display: grid;
  gap: 10px;
  padding: 12px;
}

.form-preview-panel img {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  max-height: 320px;
  object-fit: contain;
  width: 100%;
}

.organization-config-form {
  display: grid;
  gap: 18px;
}

.organization-config-summary {
  overflow: visible;
}

.enabled-config-list {
  display: grid;
  gap: 10px;
}

.enabled-config-row {
  align-items: start;
  background: #f3f7f4;
  border: 1px solid #b7c7bc;
  border-radius: 8px;
  display: grid;
  gap: 4px;
  padding: 12px;
}

.enabled-config-row strong {
  color: var(--brand-dark);
}

.enabled-config-row span {
  color: var(--muted);
  font-weight: 700;
  line-height: 1.35;
}

.configuration-intro-panel {
  position: sticky;
  top: 84px;
  z-index: 20;
  overflow: visible;
}

.organization-task-picker {
  margin-top: 14px;
  max-width: 520px;
}

.organization-task-config {
  display: grid;
  gap: 18px;
}

.organization-task-config[hidden] {
  display: none;
}

.organization-task-header {
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 6px;
  margin-inline: calc(clamp(18px, 4vw, 28px) * -1);
  margin-top: calc(clamp(18px, 4vw, 28px) * -1);
  padding: clamp(18px, 4vw, 28px);
}

.task-enable-label {
  align-items: center;
  color: var(--ink);
  display: flex;
  flex-direction: row;
  font-size: 1.12rem;
  font-weight: 850;
  gap: 10px;
}

.task-enable-label input,
.config-check-option input {
  flex: 0 0 auto;
  height: 20px;
  min-height: 20px;
  width: 20px;
}

.organization-config-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: minmax(0, 1fr);
}

.configuration-block {
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 12px;
  padding: 14px;
}

.configuration-block h3 {
  color: var(--brand-dark);
  font-size: 1rem;
  margin: 0;
}

.config-crop-grid,
.config-toggle-grid,
.config-field-grid {
  display: grid;
  gap: 10px;
}

.config-crop-grid {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.config-check-option {
  align-items: center;
  background: #fbfcfb;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  display: flex;
  flex-direction: row;
  font-weight: 800;
  gap: 9px;
  min-height: 44px;
  padding: 9px 10px;
}

.config-check-option:has(input:checked) {
  background: #e7f2ec;
  border-color: var(--brand);
}

.inline-config-check {
  margin-top: 2px;
}

.custom-config-block {
  gap: 14px;
}

.custom-config-group-list,
.custom-config-group-body,
.custom-config-field-list,
.custom-input-grid {
  display: grid;
  gap: 12px;
}

.custom-config-group {
  background: #fbfcfb;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.custom-config-group summary {
  cursor: pointer;
  font-weight: 850;
  padding: 12px;
}

.custom-config-group[open] summary {
  border-bottom: 1px solid var(--line);
}

.custom-config-group-body {
  padding: 12px;
}

.custom-config-field {
  border: 1px solid #dbe6de;
  border-radius: 8px;
  display: grid;
  gap: 10px;
  padding: 12px;
}

.custom-config-field-heading {
  align-items: baseline;
  display: flex;
  gap: 8px;
  justify-content: space-between;
}

.custom-config-field-heading span {
  color: var(--muted);
  font-size: .92rem;
  font-weight: 750;
}

.custom-config-field-grid {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.custom-input-group {
  display: grid;
  gap: 12px;
}

.custom-input-group h3 {
  color: var(--brand-dark);
  font-size: 1rem;
  margin: 0;
}

.custom-input-grid {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.custom-input-field {
  background: #fbfcfb;
  border: 1px solid var(--line);
  border-radius: 8px;
  gap: 10px;
  padding: 12px;
}

.required-badge {
  color: #7a3d26;
  display: inline-block;
  font-size: 1rem;
  font-weight: 850;
  line-height: 1;
  margin-left: 3px;
  vertical-align: text-top;
  white-space: nowrap;
}

.custom-input-grid textarea {
  min-height: 104px;
}

.button-choice-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
}

.button-choice-grid-boolean {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.button-choice-option {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  font-weight: 850;
  min-height: 48px;
  padding: 10px 12px;
  text-align: center;
}

.button-choice-option:hover,
.button-choice-option:focus {
  border-color: var(--brand);
  outline: 3px solid rgba(36, 95, 70, .14);
  outline-offset: 2px;
}

.button-choice-option.is-selected {
  background: #e7f2ec;
  border-color: var(--brand);
  box-shadow: inset 0 0 0 1px var(--brand);
  color: var(--brand-dark);
}

.organization-config-actions {
  margin-top: 4px;
}

.action-list {
  display: grid;
  gap: 10px;
}

.action-list a {
  background: var(--panel);
  border: 1px solid var(--line);
  justify-content: flex-start;
}

.success-actions {
  margin-top: 18px;
}

.record-details-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-top: 12px;
}

.record-details-panel summary {
  color: var(--muted);
  cursor: pointer;
  font-weight: 800;
  padding: 12px 14px;
}

.record-details-list {
  border-top: 1px solid var(--line);
  display: grid;
  gap: 0;
  margin: 0;
  padding: 4px 14px 12px;
}

.record-details-list div {
  display: grid;
  gap: 4px;
  padding: 10px 0;
}

.record-details-list div + div {
  border-top: 1px solid #edf1ee;
}

.record-details-list dt {
  color: var(--muted);
  font-size: .85rem;
  font-weight: 800;
}

.record-details-list dd {
  margin: 0;
}

.success-actions h2 {
  margin: 0 0 10px;
}

.action-list a.quick-action {
  background: var(--brand);
  border-color: var(--brand);
  color: white;
  align-items: flex-start;
  flex-direction: column;
  gap: 4px;
  position: relative;
  padding-right: 44px;
}

.action-list a.quick-action::after {
  content: ">";
  font-size: 1.35rem;
  font-weight: 900;
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
}

.action-list a.quick-action:hover,
.action-list a.quick-action:focus {
  background: var(--brand-dark);
  border-color: var(--brand-dark);
}

.quick-action small {
  color: rgba(255, 255, 255, .78);
  font-weight: 600;
  line-height: 1.3;
}

label {
  color: var(--muted);
  display: grid;
  font-weight: 700;
  gap: 7px;
}

.field-label {
  color: var(--muted);
  display: block;
  font-weight: 700;
  margin-bottom: 7px;
}

input,
select,
textarea {
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  font: inherit;
  min-height: 48px;
  padding: 10px 12px;
  width: 100%;
}

textarea {
  resize: vertical;
}

.suggestion-control {
  display: grid;
  gap: 8px;
  position: relative;
}

.suggestion-list {
  display: grid;
  gap: 8px;
}

.suggestion-list[hidden] {
  display: none;
}

.suggestion-button {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  font-weight: 800;
  min-height: 44px;
  padding: 9px 12px;
  text-align: left;
}

.suggestion-button:focus,
.suggestion-button:hover {
  background: #e7f2ec;
  border-color: var(--brand);
}

.diagnosis-choice-button,
.topic-option-button {
  touch-action: pan-y;
}

.diagnosis-tag-panel {
  background: #f3f7f4;
  border: 1px solid #b7c7bc;
  border-radius: 8px;
  display: grid;
  gap: 12px;
  padding: 12px;
}

.diagnosis-tag-panel[hidden] {
  display: none;
}

.diagnosis-tag-panel-header {
  align-items: start;
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.diagnosis-tag-panel h3 {
  font-size: 1rem;
  margin: 0 0 4px;
}

.diagnosis-selected-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.diagnosis-selected-list[hidden] {
  display: none;
}

.selected-diagnosis-chip {
  background: #e7f2ec;
  border: 1px solid var(--brand);
  border-radius: 8px;
  color: var(--brand-dark);
  cursor: pointer;
  font: inherit;
  font-weight: 800;
  min-height: 40px;
  padding: 8px 12px;
  text-align: left;
}

.diagnosis-topic-browser {
  border: 1px solid var(--line);
  border-radius: 8px;
}

.diagnosis-topic-browser[hidden] {
  display: none;
}

.diagnosis-topic-browser summary {
  cursor: pointer;
  font-weight: 800;
  padding: 12px;
}

.diagnosis-topic-browser[open] summary {
  border-bottom: 1px solid var(--line);
}

.diagnosis-topic-buttons {
  background: #f3f7f4;
  border-bottom: 1px solid var(--line);
  padding: 12px;
}

.diagnosis-topic-select-label {
  color: var(--muted);
  display: grid;
  font-size: .95rem;
  font-weight: 800;
  gap: 6px;
}

.diagnosis-topic-select {
  background: var(--panel);
  border: 1px solid var(--brand);
  border-radius: 8px;
  color: var(--ink);
  font: inherit;
  font-weight: 800;
  min-height: 44px;
  padding: 9px 10px;
  width: 100%;
}

.topic-option-button {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  font-weight: 800;
  min-height: 42px;
  padding: 9px 12px;
  text-align: left;
}

.topic-option-button:focus,
.topic-option-button:hover {
  background: #e7f2ec;
  border-color: var(--brand);
}

.diagnosis-topic-options {
  background: #fbfcfb;
  display: grid;
  gap: 8px;
  max-height: 280px;
  overflow-y: auto;
  padding: 12px;
}

.diagnosis-topic-options[hidden] {
  display: none;
}

[data-diagnosis-suggestions] {
  padding-inline: 6px;
}

.crop-grid,
.task-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 8px;
}

.crop-option,
.task-option {
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  font-weight: 800;
  gap: 8px;
  justify-content: center;
  min-height: 92px;
  padding: 12px 10px;
  text-align: center;
  transition: background-color .15s ease, border-color .15s ease, box-shadow .15s ease;
}

.crop-option[hidden],
.task-option[hidden] {
  display: none;
}

.crop-option:has(input:checked),
.task-option:has(input:checked) {
  background: #e7f2ec;
  border-color: var(--brand);
  box-shadow: inset 0 0 0 1px var(--brand);
}

.crop-option input,
.task-option input {
  height: 1px;
  opacity: 0;
  position: absolute;
  width: 1px;
}

.crop-option:focus-within,
.crop-option:focus,
.task-option:focus-within,
.task-option:focus {
  border-color: var(--brand);
  outline: 3px solid rgba(36, 95, 70, .2);
  outline-offset: 2px;
}

.crop-icon {
  display: block;
  height: 36px;
  object-fit: contain;
  width: 44px;
}

.two-column {
  align-items: start;
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.recent-date-picker,
.planting-date-manual,
.estimate-units-control,
.known-units-picker,
.manual-units-entry {
  display: grid;
  gap: 12px;
}

.recent-date-picker[hidden],
.planting-date-manual[hidden],
.known-units-picker[hidden],
.manual-units-entry[hidden] {
  display: none;
}

.date-choice-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

.date-choice-button {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  font-weight: 800;
  min-height: 48px;
  padding: 10px 12px;
}

.date-choice-button.is-selected,
.secondary-action.is-selected {
  background: #e7f2ec;
  border-color: var(--brand);
  box-shadow: inset 0 0 0 1px var(--brand);
}

.estimate-units-control {
  align-self: start;
}

.estimate-group {
  display: grid;
  gap: 14px;
}

.estimate-group + .estimate-group {
  border-top: 3px solid #b7c7bc;
  margin-top: 4px;
  padding-top: 20px;
}

.compact-help {
  font-size: .95rem;
  line-height: 1.35;
  margin: 0;
}

#id_expert_yield_estimate,
#id_expert_yield_estimate_units,
#id_days_until_ready {
  height: 60px;
}

.image-preview {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
}

.image-preview-item {
  display: grid;
  gap: 6px;
}

.image-preview img {
  aspect-ratio: 1;
  border-radius: 8px;
  object-fit: cover;
  width: 100%;
}

.remove-image-button {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  font-size: .9rem;
  font-weight: 800;
  min-height: 36px;
}

.recent-list {
  display: grid;
  gap: 10px;
  margin-top: 24px;
}

.recent-uploads-panel {
  margin-top: 20px;
}

.recent-list article {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: flex;
  justify-content: space-between;
  padding: 12px;
}

.modal-backdrop {
  align-items: center;
  background: rgba(0, 0, 0, .45);
  display: flex;
  height: 100vh;
  height: 100svh;
  height: 100dvh;
  inset: 0;
  justify-content: center;
  overflow: hidden;
  padding: max(16px, env(safe-area-inset-top)) 14px max(16px, env(safe-area-inset-bottom));
  pointer-events: auto;
  position: fixed;
  touch-action: none;
  width: 100vw;
  z-index: 1000;
}

.modal-backdrop[hidden] {
  display: none;
}

.protocol-modal {
  background: var(--panel);
  border-radius: 8px;
  display: grid;
  gap: 16px;
  max-height: calc(100vh - 32px);
  max-height: calc(100svh - 32px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  max-height: calc(100dvh - 32px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  max-width: 760px;
  overscroll-behavior: contain;
  overflow-y: auto;
  padding: 18px;
  pointer-events: auto;
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
  width: 100%;
}

.protocol-modal img {
  border: 1px solid var(--line);
  border-radius: 8px;
  width: 100%;
}

.protocol-modal [data-protocol-text] {
  white-space: pre-line;
}

.form-modal {
  background: var(--panel);
  border-radius: 8px;
  display: grid;
  gap: 16px;
  max-width: 520px;
  padding: 18px;
  pointer-events: auto;
  width: 100%;
}

.modal-form {
  display: grid;
  gap: 16px;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

table {
  border-collapse: collapse;
  width: 100%;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 10px;
  text-align: left;
}

.sortable-header {
  align-items: center;
  color: var(--ink);
  display: inline-flex;
  gap: 6px;
  text-decoration: none;
}

.sortable-header span {
  color: var(--brand);
  font-size: .85rem;
}

.sortable-header:hover,
.sortable-header:focus {
  color: var(--brand-dark);
  text-decoration: underline;
}

.sortable-header.is-active {
  color: var(--brand-dark);
}

@media (max-width: 720px) {
  .page {
    padding-inline: 10px;
  }

  .dashboard-header,
  .workflow-header,
  .topbar,
  .workspace-banner {
    align-items: stretch;
    flex-direction: column;
  }

  .workspace-form {
    align-items: stretch;
    grid-template-columns: 1fr;
  }

  .sticky-filter {
    align-items: stretch;
    display: grid;
    position: static;
    top: auto;
  }

  .configuration-intro-panel {
    position: static;
    top: auto;
  }

  .sticky-filter select {
    width: 100%;
  }

  .filter-context-note span {
    display: block;
    margin-left: 0;
    margin-top: 4px;
  }

  .panel-title-row {
    align-items: start;
    display: grid;
  }

  .panel-actions {
    justify-content: flex-start;
    max-width: 100%;
  }

  .panel-title-row span {
    max-width: 100%;
  }

  .workflow-step summary,
  .workflow-step-body {
    padding-inline: 12px;
  }

  .workflow-step summary {
    font-size: 1rem;
    gap: 6px;
  }

  .step-summary {
    font-size: .85rem;
    max-width: 34%;
    padding-inline: 6px;
  }

  .nav,
  .button-row,
  .dashboard-actions,
  .workflow-header-actions,
  .image-card-toolbar {
    justify-content: flex-start;
  }

  .brand-logo-wide {
    display: none;
  }

  .brand-logo-mark {
    display: block;
  }

  [data-diagnosis-suggestions],
  .diagnosis-topic-options {
    padding-inline: 14px;
  }

  .diagnosis-choice-button,
  .topic-option-button {
    min-height: 48px;
  }

  .diagnosis-tag-panel-header {
    display: grid;
  }

  .image-action-row {
    display: grid;
    grid-template-columns: 1fr;
  }

  .image-action-row .workflow-next-action,
  .workflow-next-action,
  .secondary-action,
  .primary-action {
    width: 100%;
  }

  .diagnosis-add-row {
    justify-content: stretch;
  }
}

@media (min-width: 640px) {
  .crop-grid,
  .task-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media print {
  @page {
    margin: .55in;
  }

  :root {
    --bg: #ffffff;
    --panel: #ffffff;
    --line: #b8c2bb;
  }

  body {
    background: #ffffff;
    color: #000000;
    font-size: 11pt;
  }

  .topbar,
  .messages,
  .dashboard-actions,
  .sticky-filter,
  .compact-export-action {
    display: none !important;
  }

  .page {
    max-width: none;
    padding: 0;
  }

  .dashboard-header {
    display: block;
    margin-bottom: 16px;
  }

  .filter-context-note {
    margin: -6px 0 12px;
  }

  .filter-context-note span {
    margin-left: 10px;
  }

  h1 {
    font-size: 22pt;
  }

  h2 {
    font-size: 13pt;
  }

  .metric-grid {
    grid-template-columns: repeat(2, 1fr);
    margin-bottom: 14px;
  }

  .metric,
  .table-panel {
    break-inside: avoid;
    box-shadow: none;
  }

  .metric,
  .table-panel,
  .success-panel,
  .narrow-panel,
  .form-section,
  .workspace-panel {
    border-color: #b8c2bb;
  }

  .table-panel {
    margin-top: 14px;
    overflow: visible;
    padding: 14px;
  }

  .panel-title-row {
    align-items: start;
    display: flex;
  }

  .panel-title-row span {
    border-color: #b8c2bb;
    color: #344039;
  }

  table {
    font-size: 10pt;
    page-break-inside: auto;
  }

  tr {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  th,
  td {
    padding: 6px 7px;
  }
}
