﻿:root {
  color-scheme: light;
  --ink: #18221f;
  --muted: #65736d;
  --subtle: #eef3ef;
  --line: #d9e2dc;
  --panel: #ffffff;
  --panel-soft: #f8faf8;
  --brand: #276749;
  --brand-dark: #1f513a;
  --accent: #c26b3a;
  --yellow: #f4c95d;
  --red: #c74b44;
  --blue: #426a8c;
  --shadow: 0 18px 45px rgba(24, 34, 31, 0.08);
  --collect-phase-width: 150px;
  --collect-day-width: 84px;
  --collect-date-width: 132px;
  --collect-sample-width: 360px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: #f3f7f4;
  overflow-x: hidden;
}

body {
  min-height: 100%;
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(232, 240, 234, 0.92), rgba(248, 250, 248, 0.95)),
    #f3f7f4;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

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

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.btn.is-disabled {
  cursor: not-allowed;
  opacity: 0.55;
  pointer-events: none;
}

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
}

.shell.collect-shell {
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto 1fr;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px;
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(18px);
  overflow-y: auto;
}

.collect-sidebar {
  display: flex;
  gap: 20px;
  align-items: center;
  justify-content: space-between;
  height: auto;
  padding: 14px 22px;
  border-right: 0;
  border-bottom: 1px solid var(--line);
  overflow: visible;
}

.collect-sidebar .brand-lockup {
  margin-bottom: 0;
}

.collect-sidebar .nav-list {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.collect-sidebar .nav-button {
  width: auto;
  min-width: 0;
  padding: 9px 12px;
  white-space: nowrap;
}

.brand-lockup {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 26px;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 8px;
  color: white;
  background: var(--brand);
  font-weight: 800;
}

.brand-title {
  margin: 0;
  font-size: 1rem;
  letter-spacing: 0;
}

.brand-subtitle {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}

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

.nav-button {
  display: flex;
  gap: 10px;
  align-items: center;
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
  text-align: left;
}

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

.nav-button.active {
  color: var(--ink);
  border-color: var(--line);
  background: #ffffff;
  box-shadow: 0 8px 20px rgba(24, 34, 31, 0.06);
}

.nav-icon {
  display: grid;
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  place-items: center;
}

.nav-icon svg,
.icon svg {
  display: block;
  width: 18px;
  height: 18px;
  stroke-width: 2;
}

.sidebar-panel {
  margin-top: 26px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.sidebar-panel h3 {
  margin: 0 0 8px;
  font-size: 0.88rem;
}

.sidebar-panel p {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.45;
}

.main {
  min-width: 0;
  padding: 22px clamp(16px, 3vw, 34px) 42px;
}

.collect-main {
  padding-top: 18px;
}

.topbar {
  display: flex;
  gap: 18px;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 20px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--brand);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  margin: 0;
  max-width: 880px;
  font-size: clamp(1.9rem, 2.7vw, 3.2rem);
  line-height: 1.03;
  letter-spacing: 0;
}

.page-note {
  max-width: 760px;
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.sync-shell {
  display: grid;
  gap: 8px;
  justify-items: end;
}

.sync-status-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  justify-content: flex-end;
  align-items: flex-end;
}

.sync-diagnostics {
  max-width: min(560px, 70vw);
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.25;
  text-align: right;
  word-break: break-word;
}

.sync-refresh {
  white-space: nowrap;
}

.btn {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 9px 13px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: white;
  background: var(--brand);
  font-weight: 750;
  text-decoration: none;
  transition:
    transform 140ms ease,
    background 140ms ease,
    border-color 140ms ease;
}

.btn:hover {
  background: var(--brand-dark);
  transform: translateY(-1px);
}

.btn.secondary {
  color: var(--ink);
  border-color: var(--line);
  background: white;
}

.btn.secondary:hover {
  background: var(--subtle);
}

.btn.danger {
  background: var(--red);
}

.btn.warning {
  color: #2f2819;
  background: var(--yellow);
}

.icon-btn {
  display: inline-grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: white;
}

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

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(320px, 0.8fr);
  gap: 18px;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(136px, 160px));
  gap: 10px;
  justify-content: start;
  margin-bottom: 18px;
}

.metrics-grid.compact-metrics {
  max-width: 700px;
}

.metric {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 10px 28px rgba(24, 34, 31, 0.06);
}

.metric-button {
  width: 100%;
  color: inherit;
  text-align: left;
  appearance: none;
}

.metric-button:hover {
  border-color: rgba(39, 103, 73, 0.4);
  background: var(--panel-soft);
}

.metric-active {
  border-color: var(--brand);
  background: #eff7f1;
  box-shadow: inset 0 0 0 1px rgba(39, 103, 73, 0.18);
}

.metric span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.metric strong {
  display: block;
  margin-top: 6px;
  font-size: 1.35rem;
  line-height: 1;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.panel + .panel,
.stack > .panel + .panel {
  margin-top: 18px;
}

.panel-header {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  justify-content: space-between;
  padding: 18px 18px 0;
}

.panel-header h2,
.panel-header h3 {
  margin: 0;
  font-size: 1.15rem;
}

.panel-header p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.panel-body {
  padding: 18px;
}

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

.import-report {
  margin-bottom: 16px;
  padding: 14px;
  border: 1px solid rgba(39, 103, 73, 0.22);
  border-radius: 12px;
  background: #f7fbf7;
}

.excel-status {
  display: grid;
  gap: 4px;
  margin-bottom: 16px;
  padding: 12px 14px;
  border: 1px solid rgba(39, 103, 73, 0.22);
  border-radius: 12px;
  background: #f7fbf7;
  color: var(--brand-dark);
}

.excel-status span {
  color: var(--muted);
  font-size: 0.9rem;
}

.excel-status.working {
  border-color: rgba(39, 103, 73, 0.36);
  background: #eef8f0;
}

.excel-status.success {
  border-color: rgba(39, 103, 73, 0.34);
  background: #f2fbf4;
}

.excel-status.error {
  border-color: rgba(194, 58, 58, 0.34);
  background: #fff6f4;
  color: #9b2f26;
}

.import-report.has-errors {
  border-color: rgba(194, 107, 58, 0.4);
  background: #fffaf5;
}

.import-report-head {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  justify-content: space-between;
}

.import-report-head p {
  margin: 5px 0 0;
  color: var(--muted);
}

.import-report-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.import-report-stats span {
  padding: 5px 9px;
  border-radius: 999px;
  background: rgba(39, 103, 73, 0.09);
  color: var(--brand-dark);
  font-size: 0.82rem;
  font-weight: 700;
}

.import-report-list {
  display: grid;
  gap: 8px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.import-sheet-summary {
  display: grid;
  gap: 6px;
  margin-top: 12px;
}

.import-sheet-summary div {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(39, 103, 73, 0.06);
}

.import-sheet-summary span {
  color: var(--muted);
  font-size: 0.85rem;
}

.import-report-list li {
  padding: 10px;
  border: 1px solid rgba(194, 107, 58, 0.22);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.72);
}

.import-report-list span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
}

.project-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.project-row:hover {
  border-color: rgba(39, 103, 73, 0.45);
  box-shadow: 0 12px 26px rgba(24, 34, 31, 0.06);
}

.project-row-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.project-row h3 {
  margin: 0;
  font-size: 1rem;
}

.link-title {
  display: inline;
  padding: 0;
  border: 0;
  color: var(--ink);
  background: transparent;
  font: inherit;
  font-weight: 850;
  text-align: left;
}

.link-title:hover {
  color: var(--brand);
  text-decoration: underline;
}

.project-meta {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 7px;
  color: var(--muted);
  font-size: 0.84rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 24px;
  padding: 4px 8px;
  border-radius: 999px;
  color: var(--ink);
  background: var(--subtle);
  font-size: 0.75rem;
  font-weight: 800;
}

.badge.success {
  color: #155c38;
  background: #dff2e7;
}

.badge.warning {
  color: #6b4d00;
  background: #fff1c7;
}

.badge.danger {
  color: #7d1d18;
  background: #f8d6d4;
}

.badge.info {
  color: #214866;
  background: #dcecf8;
}

.badge.neutral {
  color: var(--muted);
  background: #edf1ed;
}

.progress-track {
  position: relative;
  height: 9px;
  border-radius: 999px;
  background: var(--subtle);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--brand);
}

.progress-label {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.8rem;
  text-align: right;
}

.workflow {
  display: grid;
  gap: 8px;
}

.workflow-step {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.step-number {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 8px;
  color: white;
  background: var(--brand);
  font-size: 0.82rem;
  font-weight: 850;
}

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

.phase-start-date-list {
  display: grid;
  width: 100%;
  max-width: 100%;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-top: 10px;
}

.phase-start-date-card {
  display: grid;
  gap: 6px;
  min-width: 0;
  max-width: 100%;
  box-sizing: border-box;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-soft);
}

.phase-start-date-card.is-missing {
  border-color: var(--danger);
}

.phase-start-date-card input {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  min-height: 44px;
  box-sizing: border-box;
}

.phase-start-date-card small,
.phase-start-date-card em {
  color: var(--muted);
  font-style: normal;
}

.phase-start-date-card.is-missing em {
  color: var(--danger);
}

.phase-start-date-name {
  font-weight: 800;
  overflow-wrap: anywhere;
}

@media (max-width: 1200px) {
  .phase-start-date-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.project-phase-date-editor {
  margin: 16px 0;
}

.profile-manager {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(360px, 1.1fr);
  gap: 20px;
  align-items: start;
  max-width: 100%;
  min-width: 0;
}

.profile-list,
.profile-editor {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.profile-card {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-soft);
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
}

.profile-card.active {
  border-color: rgba(39, 103, 73, 0.45);
  box-shadow: 0 12px 24px rgba(39, 103, 73, 0.08);
}

.profile-card.muted {
  opacity: 0.68;
}

.profile-card h4 {
  margin: 0 0 4px;
}

.profile-card p {
  margin: 0;
  color: var(--muted);
}

.profile-phase-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
  max-width: 100%;
  min-width: 0;
}

.profile-phase-chip {
  display: grid;
  gap: 2px;
  min-width: 0;
  max-width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.profile-phase-chip span,
.profile-phase-chip small {
  color: var(--muted);
  font-size: 0.8rem;
  overflow-wrap: anywhere;
}

.code-textarea {
  min-height: 420px;
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 0.86rem;
  line-height: 1.45;
}

.profile-editor-section,
.profile-advanced-json,
.profile-validation {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}

.profile-editor-section h4,
.profile-editor-section h5 {
  margin: 0 0 10px;
}

.profile-section-title,
.profile-phase-editor-header,
.profile-subsection-header {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 14px;
}

.profile-subsection-header > div {
  min-width: 0;
}

.profile-subsection .toolbar {
  justify-content: flex-start;
  max-width: 100%;
}

.profile-subsection .btn {
  max-width: 100%;
}

.profile-standard-column-line {
  justify-content: flex-start;
}

.profile-section-title p,
.profile-phase-editor-header p,
.profile-subsection-header p {
  margin: 3px 0 0;
  color: var(--muted);
}

.profile-phase-editor-list {
  display: grid;
  gap: 16px;
}

.profile-phase-editor {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel-soft);
}

.profile-phase-editor h4 {
  margin: 0;
}

.profile-phase-columns {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  margin-top: 14px;
}

.profile-subsection {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  max-width: 100%;
  min-width: 0;
}

.profile-paste-box {
  min-height: 92px;
}

.profile-copy-line,
.profile-editable-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  max-width: 100%;
  min-width: 0;
}

.profile-editable-item {
  grid-template-columns: minmax(0, 1fr) auto auto auto;
}

.profile-regular-column {
  grid-template-columns: minmax(0, 1fr) auto auto auto;
}

.profile-static-column {
  grid-template-columns: minmax(0, 1fr) auto auto auto auto;
}

.profile-column-meta-input {
  display: none;
}

.profile-static-column {
  padding: 6px;
  border: 1px solid rgba(39, 103, 73, 0.16);
  border-radius: 8px;
  background: rgba(39, 103, 73, 0.04);
}

.profile-static-column .badge {
  display: none;
}

.profile-static-settings-btn,
.profile-static-column .compact-btn {
  min-width: 36px;
  padding-inline: 9px;
}

.profile-static-column .profile-column-name-input {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.profile-item-list {
  display: grid;
  gap: 8px;
  max-width: 100%;
  min-width: 0;
}

.static-column-dialog {
  width: min(620px, calc(100vw - 32px));
}

.static-column-summary {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.static-column-day-list {
  display: grid;
  gap: 8px;
}

.static-column-day-row {
  display: grid;
  grid-template-columns: 80px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}

.static-column-day-row label {
  margin: 0;
  font-weight: 800;
}

.profile-preview-grid {
  display: grid;
  gap: 10px;
}

.profile-preview-card {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-soft);
}

.profile-preview-card span,
.profile-preview-card small {
  color: var(--muted);
}

.profile-validation {
  border-color: rgba(199, 75, 68, 0.35);
  color: var(--red);
  background: #fff8f7;
}

.profile-validation.warning {
  border-color: rgba(194, 107, 58, 0.32);
  color: #7a4a1f;
  background: #fff8ee;
}

.profile-validation.warning strong {
  color: #8a4b18;
}

.profile-validation .btn {
  margin-top: 12px;
}

.profile-validation p {
  margin: 6px 0 0;
}

.profile-advanced-json summary {
  cursor: pointer;
  font-weight: 850;
}

.field {
  display: grid;
  gap: 7px;
}

.field.full {
  grid-column: 1 / -1;
}

label,
.field-label {
  color: #2c3834;
  font-size: 0.86rem;
  font-weight: 800;
}

input,
textarea,
select {
  width: 100%;
  min-height: 40px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: white;
  outline: none;
}

textarea {
  min-height: 104px;
  resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(39, 103, 73, 0.14);
}

.segmented {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.segment {
  min-height: 50px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: white;
  font-weight: 800;
}

.segment.active {
  color: white;
  border-color: var(--brand);
  background: var(--brand);
}

.help-text {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.35;
}

.switch-line {
  display: flex;
  gap: 10px;
  align-items: center;
}

.switch-line input {
  width: auto;
  min-height: 0;
}

.ai-box,
.soft-box {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.ai-box h3,
.soft-box h3 {
  margin: 0 0 8px;
  font-size: 0.95rem;
}

.ai-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.api-strip {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
}

.protocol-grid,
.analysis-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.protocol-grid.protocol-stack {
  grid-template-columns: minmax(0, 1fr);
}

.analysis-grid.detail-stack {
  grid-template-columns: minmax(0, 1fr);
}

.protocol-card,
.analysis-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.protocol-card strong,
.analysis-card strong {
  display: block;
  margin-bottom: 8px;
}

.analysis-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
}

.analysis-results-stack {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
}

/* L'onglet Analyse reste volontairement vertical, quelle que soit la largeur. */
.analysis-workspace .analysis-summary-grid,
.analysis-workspace .analysis-target-grid,
.analysis-workspace .analysis-controls,
.analysis-workspace .shelf-life-controls,
.analysis-workspace .analysis-sample-list {
  grid-template-columns: minmax(0, 1fr);
}

.analysis-workspace .analysis-criterion-row {
  grid-template-columns: minmax(220px, 1.5fr) minmax(112px, 0.55fr) minmax(180px, 0.8fr) minmax(140px, 0.6fr);
  align-items: center;
}

.analysis-summary-grid,
.analysis-target-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.analysis-target-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.analysis-controls {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 12px;
  align-items: end;
  margin-bottom: 16px;
}

.analysis-phase-selector {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel-soft);
}

.analysis-phase-context,
.analysis-chart-context {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 10px 12px;
  border-left: 4px solid var(--green);
  border-radius: 8px;
  background: var(--green-soft);
}

.analysis-phase-context strong,
.analysis-chart-context strong {
  color: var(--ink);
}

.analysis-controls .analysis-phase-context span,
.analysis-chart-context span {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 600;
  letter-spacing: normal;
  text-transform: none;
}

.analysis-chart-context {
  margin-bottom: 12px;
}

.analysis-controls label,
.analysis-criterion-row label {
  display: grid;
  gap: 6px;
}

.analysis-controls span,
.analysis-criterion-row span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.analysis-criteria-grid {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
}

.analysis-criterion-row {
  display: grid;
  grid-template-columns: minmax(220px, 1.5fr) minmax(112px, 0.55fr) minmax(180px, 0.8fr) minmax(140px, 0.6fr);
  gap: 10px;
  align-items: center;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-soft);
}

.analysis-criterion-field {
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
}

.analysis-criterion-field span {
  white-space: nowrap;
}

.analysis-criterion-field input,
.analysis-criterion-field select {
  min-width: 0;
  width: 100%;
}

.analysis-criterion-name {
  justify-self: start;
  min-width: 0;
}

.analysis-criterion-name span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.analysis-criterion-row.active {
  border-color: rgba(39, 103, 73, 0.35);
  background: #f1f7f3;
}

.checkbox-badge {
  display: inline-flex !important;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 7px;
  width: fit-content;
  max-width: 100%;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  font-weight: 800;
}

.analysis-criteria-grid .checkbox-badge,
.analysis-sample-list .checkbox-badge {
  padding: 5px 8px;
  font-size: 0.86rem;
}

.analysis-criteria-grid .checkbox-badge input,
.analysis-sample-list .checkbox-badge input {
  width: 14px;
  height: 14px;
  accent-color: var(--brand);
}

.checkbox-badge span {
  color: inherit;
  font-size: 0.86rem;
  letter-spacing: 0;
  text-transform: none;
}

.analysis-sample-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin: 2px 0 8px;
}

.analysis-sample-toolbar strong {
  font-size: 0.9rem;
}

.analysis-sample-toolbar div {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.analysis-sample-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, max-content));
  gap: 7px;
  margin: 4px 0 14px;
}

.analysis-chart-wrap {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  overflow-x: auto;
}

.analysis-chart {
  min-width: 760px;
}

.analysis-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 750;
}

.analysis-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.analysis-legend i {
  width: 12px;
  height: 12px;
  border-radius: 999px;
}

.shelf-life-controls {
  grid-template-columns: repeat(3, minmax(160px, 1fr));
}

.shelf-life-matrix {
  max-height: 460px;
}

.analysis-results-table th,
.analysis-results-table td {
  min-width: 132px;
  vertical-align: top;
}

.analysis-results-table th:first-child,
.analysis-results-table td:first-child {
  min-width: 70px;
}

.analysis-results-table th:nth-child(2),
.analysis-results-table td:nth-child(2) {
  min-width: 220px;
}

.analysis-rank-status {
  display: inline-flex;
  padding: 5px 9px;
  border-radius: 999px;
  color: #315b4b;
  background: #e8f0eb;
  font-size: 0.78rem;
  font-weight: 850;
  white-space: nowrap;
}

.analysis-rank-status.best {
  color: #145b3f;
  background: #dff3e7;
}

.analysis-rank-status.missing {
  color: var(--muted);
  background: #edf1ee;
}

.shelf-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 78px;
  padding: 5px 9px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 850;
  white-space: nowrap;
}

.shelf-status.pass {
  color: #176044;
  background: #dff3e7;
}

.shelf-status.fail {
  color: #a43b32;
  background: #fde5e1;
}

.shelf-status.missing {
  color: var(--muted);
  background: #edf1ee;
}

.chart-axis-label {
  fill: var(--ink);
  font-weight: 800;
}

.analysis-report-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.analysis-result-note,
.analysis-export-note {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid rgba(39, 103, 73, 0.18);
  border-radius: 12px;
  background: #f3f8f4;
  color: var(--muted);
}

.analysis-export-note p {
  margin: 0 0 6px;
}

.analysis-export-note p:last-child {
  margin-bottom: 0;
}

.subsection-title {
  margin: 18px 0 10px;
  font-size: 1rem;
}

.preline {
  white-space: pre-line;
}

.structured-list {
  display: grid;
  gap: 8px;
  margin: 8px 0 0;
  padding-left: 18px;
}

.structured-list li {
  line-height: 1.45;
}

.structured-list strong {
  display: inline;
  margin: 0;
}

.structured-sections {
  display: grid;
  gap: 14px;
}

.structured-sections section {
  display: grid;
  gap: 4px;
}

.structured-sections strong {
  margin: 0;
}

.structured-sections p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.sample-list {
  display: grid;
  gap: 8px;
  margin: 10px 0;
}

.sample-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.sample-item p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
}

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

.protocol-variable-item {
  grid-template-columns: minmax(0, 1fr);
}

.protocol-variable-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  align-items: end;
}

.protocol-variable-actions {
  justify-content: flex-start;
}

.phase-measurement-preview {
  display: grid;
  gap: 12px;
}

.phase-measurement-group {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.phase-measurement-group ul {
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
  line-height: 1.45;
}

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

.data-table-wrap {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  max-width: 100%;
}

.collect-table-wrap {
  overflow: auto;
  position: relative;
  max-height: min(72vh, 720px);
  scrollbar-gutter: stable both-edges;
  scrollbar-width: auto;
  overscroll-behavior: contain;
}

.collect-table-wrap::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

.collect-table-wrap::-webkit-scrollbar-thumb {
  border: 3px solid #fff;
  border-radius: 999px;
  background: rgba(101, 115, 109, 0.62);
}

.collect-table-wrap::-webkit-scrollbar-track {
  background: #f2f6f3;
}

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

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

th {
  color: #35413d;
  background: var(--panel-soft);
  font-size: 0.78rem;
  text-transform: uppercase;
}

td input,
td select {
  min-width: 100px;
  min-height: 34px;
  padding: 6px 8px;
}

.collect-today-panel {
  margin-bottom: 18px;
}

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

.today-task-card {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.today-task-head {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
}

.today-task-card p {
  margin: 0;
  color: var(--muted);
}

.collect-tools {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.collect-filter-field {
  display: inline-grid;
  grid-template-columns: auto minmax(72px, 96px);
  gap: 6px;
  align-items: center;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
}

.collect-filter-field input {
  min-height: 32px;
  padding: 5px 7px;
  font-size: 0.82rem;
}

.collect-filter-sample {
  grid-template-columns: auto minmax(130px, 220px);
}

.compact-btn {
  min-height: 32px;
  padding: 6px 10px;
  font-size: 0.82rem;
}

.collect-save-line {
  min-height: 26px;
  height: 26px;
  margin-bottom: 6px;
  overflow: hidden;
  display: flex;
  align-items: center;
  gap: 8px;
}

.collect-save-status,
.collect-cell-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
}

.collect-save-status {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.collect-retry-link {
  flex: 0 0 auto;
  font-size: 0.72rem;
  font-weight: 900;
  white-space: nowrap;
}

.collect-save-status.success,
.collect-cell-status.saved {
  color: var(--brand);
}

.collect-cell-status.pending,
.collect-cell-status.saving {
  color: #9a6a11;
}

.collect-save-status.error,
.collect-cell-status.error {
  color: var(--red);
}

.collect-table-shell {
  display: grid;
  gap: 10px;
  max-height: none;
  min-height: 0;
  overflow: visible;
  padding-right: 2px;
}

.collect-phase-section {
  min-width: 0;
  display: grid;
}

.collect-phase-header {
  position: sticky;
  top: 0;
  z-index: 18;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-bottom: none;
  border-radius: 10px 10px 0 0;
  background: #f7fbf8;
  box-shadow: 0 8px 18px rgba(24, 34, 31, 0.04);
}

.collect-phase-header h3 {
  margin: 0;
  font-size: 0.95rem;
}

.collect-phase-header p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.76rem;
}

.collect-phase-number {
  color: var(--brand);
  font-weight: 900;
}

.collect-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(280px, 0.45fr);
  gap: 18px;
}

.calendar-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.65fr);
  gap: 18px;
}

.collect-table {
  width: 100%;
  min-width: 0;
  table-layout: auto;
  border-collapse: separate;
  border-spacing: 0;
}

.collect-wide-table {
  min-width: max(100%, 1800px);
  table-layout: auto;
}

.collect-mobile-card-summary,
.collect-mobile-card-nav,
.collect-mobile-field-help {
  display: none;
}

.collect-table th,
.collect-table td {
  padding: 6px 7px;
  white-space: normal;
  overflow-wrap: anywhere;
  transition: background-color 180ms ease, opacity 180ms ease, box-shadow 180ms ease, transform 160ms ease;
}

.collect-table th {
  font-size: 0.74rem;
  line-height: 1.25;
  position: sticky;
  top: 0;
  z-index: 14;
  background: #f7fbf8;
  box-shadow: inset 0 -1px 0 var(--line);
}

.collect-sticky {
  position: sticky;
  z-index: 8;
  background: #fff;
}

thead .collect-sticky,
.collect-table th.collect-sticky {
  z-index: 22;
  background: #f7fbf8;
}

.collect-sticky-phase {
  left: 0;
  width: var(--collect-phase-width);
  min-width: var(--collect-phase-width);
  max-width: var(--collect-phase-width);
}

.collect-sticky-day {
  left: var(--collect-phase-width);
  width: var(--collect-day-width);
  min-width: var(--collect-day-width);
  max-width: var(--collect-day-width);
}

.collect-sticky-date {
  left: calc(var(--collect-phase-width) + var(--collect-day-width));
  width: var(--collect-date-width);
  min-width: var(--collect-date-width);
  max-width: var(--collect-date-width);
}

.collect-sticky-sample {
  left: calc(var(--collect-phase-width) + var(--collect-day-width) + var(--collect-date-width));
  width: var(--collect-sample-width);
  min-width: var(--collect-sample-width);
  max-width: var(--collect-sample-width);
  box-shadow: 10px 0 16px -16px rgba(24, 34, 31, 0.45);
}

.collect-table .collect-col-day {
  width: 80px;
}

.collect-table .collect-col-phase {
  width: 140px;
}

.collect-table .collect-col-date {
  width: 160px;
}

.collect-table .collect-col-variant {
  width: auto;
}

.collect-table .collect-col-status {
  width: 120px;
}

.collect-table .collect-col-photos {
  width: 170px;
}

.collect-table .collect-col-action {
  width: 70px;
}

.collect-table td input,
.collect-table td select,
.collect-table td textarea {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  min-height: 30px;
  padding: 4px 6px;
  font-size: 0.82rem;
  box-sizing: border-box;
}

.collect-observation-input {
  height: 30px;
  resize: none;
  overflow: hidden;
  font-family: inherit;
}

.collect-cell-input {
  border-radius: 7px;
}

.collect-measure-cell,
.collect-observation-cell,
.collect-table td {
  transition: background 0.16s ease, box-shadow 0.16s ease;
}

td.is-saving .collect-cell-input {
  border-color: rgba(199, 143, 39, 0.45);
  box-shadow: 0 0 0 3px rgba(199, 143, 39, 0.08);
}

td.is-pending .collect-cell-input {
  border-color: rgba(199, 143, 39, 0.32);
}

td.is-saved .collect-cell-input {
  border-color: rgba(39, 103, 73, 0.35);
}

td.is-error .collect-cell-input {
  border-color: rgba(194, 58, 58, 0.55);
  box-shadow: 0 0 0 3px rgba(194, 58, 58, 0.1);
}

td.is-active-paste-cell .collect-cell-input {
  border-color: rgba(39, 103, 73, 0.65);
  box-shadow: 0 0 0 3px rgba(39, 103, 73, 0.14);
}

td.is-pasted .collect-cell-input {
  animation: collect-paste-flash 1.15s ease;
}

@keyframes collect-paste-flash {
  0% {
    background: rgba(211, 238, 224, 0.95);
    box-shadow: 0 0 0 3px rgba(39, 103, 73, 0.16);
  }
  100% {
    background: #fff;
    box-shadow: none;
  }
}

.collect-measure-cell,
.collect-observation-cell {
  min-width: 170px;
}

.collect-static-measure-cell {
  background: rgba(39, 103, 73, 0.035);
}

.collect-static-measure-cell .collect-static-value {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  color: #51615b;
}

.collect-wide-table th:not(.collect-sticky),
.collect-wide-table td:not(.collect-sticky) {
  min-width: 160px;
}

.collect-wide-table th:nth-child(5),
.collect-wide-table td:nth-child(5) {
  min-width: 120px;
}

.collect-wide-table th:last-child,
.collect-wide-table td:last-child {
  min-width: 76px;
}

.collect-observation-cell {
  min-width: 260px;
}

.collect-wide-table th {
  white-space: normal;
  overflow-wrap: anywhere;
}

.collect-table th:nth-child(4),
.collect-table td:nth-child(4) {
  text-align: left;
}

.collect-static-value {
  display: block;
  min-width: 0;
  color: var(--ink);
  font-weight: 650;
  line-height: 1.35;
  overflow-wrap: anywhere;
  white-space: normal;
}

.collect-table td.collect-sticky {
  background: #fff;
}

.collect-table td:not(.collect-sticky) {
  position: relative;
  z-index: 1;
}

.collect-table thead th:not(.collect-sticky) {
  position: sticky;
  top: 0;
  z-index: 16;
  background: #f7fbf8;
}

.collect-table td:nth-child(7),
.collect-table th:nth-child(7) {
  text-align: center;
}

.collect-table td:nth-child(5),
.collect-table th:nth-child(5) {
  text-align: center;
}

.photo-cell {
  display: grid;
  gap: 6px;
  justify-items: start;
}

.photo-action-btn {
  position: relative;
  width: 100%;
  min-height: 36px;
  padding: 8px 10px;
  font-size: 0.86rem;
  overflow: hidden;
}

.photo-action-btn.disabled {
  pointer-events: none;
}

.photo-inline-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.photo-hint {
  color: var(--muted);
  font-size: 0.76rem;
}

.error-text {
  margin: 10px 0 0;
  color: #9f2f2f;
  font-weight: 600;
}

.collect-row-completed td:not(.collect-sticky) {
  background: rgba(39, 103, 73, 0.08);
}

.collect-row-completed td:not(.collect-sticky) {
  opacity: 0.94;
}

.collect-row-completed td.collect-sticky {
  background: #eef6f0;
  opacity: 1;
}

.collect-checkbox {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  width: 100%;
  min-height: 36px;
}

.collect-checkbox input {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.collect-checkbox-ui {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 1px solid #b9c9bf;
  border-radius: 8px;
  color: transparent;
  background: #fff;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
  font-weight: 900;
  transition: transform 160ms ease, background-color 180ms ease, color 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.collect-checkbox input:hover + .collect-checkbox-ui {
  border-color: rgba(39, 103, 73, 0.45);
}

.collect-checkbox input:focus-visible + .collect-checkbox-ui {
  outline: 2px solid rgba(66, 106, 140, 0.28);
  outline-offset: 2px;
}

.collect-checkbox input:checked + .collect-checkbox-ui {
  color: #fff;
  border-color: var(--brand);
  background: var(--brand);
  box-shadow: 0 8px 18px rgba(39, 103, 73, 0.18);
  transform: scale(1.04);
}

.photo-library-panel {
  margin-top: 18px;
}

.photo-library-grid,
.photo-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  align-items: start;
}

.photo-group {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-soft);
}

.photo-group-header {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

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

.photo-card {
  display: grid;
  gap: 10px;
  padding: 10px;
  border: 1px solid rgba(24, 34, 31, 0.08);
  border-radius: 10px;
  background: white;
  box-shadow: 0 10px 20px rgba(24, 34, 31, 0.04);
}

.photo-card-header {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  justify-content: space-between;
}

.photo-card-header strong {
  display: block;
  font-size: 0.92rem;
  line-height: 1.25;
}

.photo-card-header p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.25;
}

.photo-thumb-button {
  display: block;
  padding: 0;
  border: 0;
  background: transparent;
  text-align: left;
}

.photo-thumb-placeholder {
  display: grid;
  width: 100%;
  aspect-ratio: 4 / 3;
  place-items: center;
  gap: 8px;
  border: 1px dashed rgba(31, 110, 78, 0.28);
  border-radius: 10px;
  background: rgba(242, 248, 244, 0.92);
  color: var(--primary);
  font-weight: 800;
  text-align: center;
  cursor: pointer;
}

.photo-thumb-placeholder:hover,
.photo-thumb-placeholder:focus-visible {
  border-color: rgba(31, 110, 78, 0.55);
  background: rgba(232, 243, 237, 0.98);
}

.photo-thumb-icon svg {
  width: 28px;
  height: 28px;
}

.photo-thumb {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid rgba(24, 34, 31, 0.08);
}

.photo-card-meta {
  display: grid;
  gap: 4px;
}

.photo-card-meta strong {
  font-size: 0.86rem;
  line-height: 1.35;
  word-break: break-word;
}

.photo-card-meta span {
  color: var(--muted);
  font-size: 0.78rem;
}

.photo-card-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.photo-delete-button-icon {
  display: none;
}

.collection-row-delete-button svg {
  display: block;
  width: 20px;
  height: 20px;
  max-width: 20px;
  max-height: 20px;
}

.text-link {
  padding: 0;
  border: 0;
  color: var(--brand);
  background: transparent;
  font-weight: 700;
  text-decoration: none;
}

.danger-link {
  color: var(--red);
}

.photo-lightbox {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 24px;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 45;
  display: grid;
  place-items: center;
  padding: 24px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(16, 22, 20, 0.62);
}

.modal-dialog {
  position: relative;
  z-index: 1;
  width: min(720px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  overflow: auto;
  display: grid;
  gap: 14px;
  padding: 18px;
  border-radius: 16px;
  background: white;
  box-shadow: 0 28px 60px rgba(12, 17, 15, 0.28);
}

.modal-header {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  justify-content: space-between;
}

.modal-header h2 {
  margin: 0;
}

.modal-actions {
  justify-content: flex-end;
}

.collection-observation-context,
.photo-lightbox-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.collection-observation-field {
  margin: 0;
}

.collection-observation-field textarea {
  min-height: 160px;
  resize: vertical;
}

.photo-lightbox-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(16, 22, 20, 0.72);
}

.photo-lightbox-dialog {
  position: relative;
  z-index: 1;
  width: min(960px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  display: grid;
  gap: 12px;
  padding: 16px;
  border-radius: 14px;
  background: white;
  box-shadow: 0 28px 60px rgba(12, 17, 15, 0.28);
}

.photo-lightbox-header,
.photo-lightbox-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}

.photo-lightbox-meta {
  margin-top: -2px;
}

.photo-lightbox-body {
  overflow: auto;
}

.photo-lightbox-body img {
  display: block;
  width: 100%;
  height: auto;
  max-height: calc(100vh - 180px);
  object-fit: contain;
  border-radius: 12px;
  background: #f3f6f2;
}

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

.calendar-header > div {
  display: grid;
  gap: 8px;
}

.calendar-month-nav {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.calendar-nav-btn {
  width: 38px;
  height: 38px;
  padding: 0;
}

.calendar-nav-btn svg {
  width: 18px;
  height: 18px;
}

.calendar-nav-prev svg {
  transform: rotate(180deg);
}

.scope-switch {
  display: inline-flex;
  gap: 8px;
  flex-wrap: wrap;
}

.scope-pill {
  min-height: 34px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: white;
  font-weight: 750;
}

.scope-pill.active {
  color: white;
  border-color: var(--brand);
  background: var(--brand);
}

.scope-pill:hover {
  border-color: rgba(39, 103, 73, 0.45);
}

.month-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}

.weekday {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 850;
  text-align: center;
  text-transform: uppercase;
}

.month-cell {
  min-height: 72px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: white;
  text-align: left;
}

.month-cell:hover {
  border-color: rgba(39, 103, 73, 0.55);
}

.month-cell.active {
  border-color: var(--brand);
  background: #eff7f1;
  box-shadow: inset 0 0 0 2px rgba(39, 103, 73, 0.18);
}

.month-cell.muted {
  background: transparent;
  border-color: transparent;
}

.month-cell strong {
  display: block;
  margin-bottom: 6px;
}

.day-dot {
  display: inline-flex;
  margin: 2px 0;
  padding: 2px 5px;
  border-radius: 999px;
  color: #214866;
  background: #dcecf8;
  font-size: 0.64rem;
  font-weight: 800;
}

.day-dot.done {
  color: #155c38;
  background: #dff2e7;
}

.day-dot.has-observation {
  box-shadow: inset 0 -2px 0 rgba(194, 107, 58, 0.8);
}

.day-panel {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.day-panel h3 {
  margin: 0 0 10px;
}

.day-task {
  display: grid;
  gap: 8px;
  margin-top: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.day-task.has-observation {
  border-color: rgba(194, 107, 58, 0.35);
  box-shadow: inset 4px 0 0 rgba(194, 107, 58, 0.55);
}

.day-task p {
  margin: 0;
  color: var(--muted);
}

.day-task-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid rgba(24, 34, 31, 0.08);
  border-radius: 10px;
  background: var(--panel-soft);
}

.day-task-row.has-observation {
  background: #fff8ee;
  border-color: rgba(194, 107, 58, 0.25);
}

.day-task-row strong {
  display: block;
  margin-bottom: 4px;
  font-size: 0.9rem;
}

.task-list {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.test-calendar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
  gap: 8px;
  margin-top: 14px;
}

.test-calendar-cell {
  display: grid;
  gap: 4px;
  min-height: 104px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.test-calendar-cell.done {
  border-color: rgba(39, 103, 73, 0.42);
  background: #eff7f1;
}

.test-calendar-cell span,
.test-calendar-cell small,
.test-calendar-cell em {
  color: var(--muted);
  font-size: 0.78rem;
  font-style: normal;
}

.test-calendar-cell strong {
  margin: 0;
  font-size: 1.35rem;
}

.chart {
  width: 100%;
  height: auto;
  min-height: 260px;
}

.chart text {
  fill: var(--muted);
  font-size: 12px;
}

.report {
  display: grid;
  gap: 14px;
}

.report-builder {
  align-items: start;
}

.report-section {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.report-section h3 {
  margin: 0 0 8px;
}

.report-info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
}

.report-field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.report-field-card {
  display: grid;
  gap: 6px;
  align-content: start;
}

.report-field-card span {
  color: var(--ink);
  font-weight: 850;
}

.report-field-card textarea {
  width: 100%;
  resize: vertical;
  min-height: 96px;
}

.report-dynamic-sections {
  display: grid;
  gap: 12px;
}

.report-section-card {
  background: #fbfdfb;
}

.report-section-head {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 12px;
}

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

.report-section-title-input {
  width: min(520px, 100%);
  margin-top: 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 6px 8px;
  background: #fff;
  font-weight: 850;
}

.report-section-title-input:focus {
  border-color: rgba(39, 103, 73, 0.35);
  outline: none;
  box-shadow: 0 0 0 3px rgba(39, 103, 73, 0.12);
}

.empty-state {
  padding: 28px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: var(--panel-soft);
  text-align: center;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 20;
  max-width: min(420px, calc(100vw - 36px));
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  box-shadow: var(--shadow);
  transform: translateY(120%);
  transition: transform 180ms ease;
}

.toast.show {
  transform: translateY(0);
}

.hidden {
  display: none !important;
}

@media (max-width: 1100px) {
  .analysis-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .analysis-controls,
  .analysis-criterion-row,
  .analysis-target-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .analysis-workspace .analysis-criterion-row {
    grid-template-columns: minmax(0, 1fr) minmax(112px, 0.6fr);
  }

  .photo-library-grid,
  .photo-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    padding: 14px;
  }

  .nav-list {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .sidebar-panel {
    display: none;
  }

  .dashboard-grid,
  .collect-layout,
  .metrics-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 900px) {
  .photo-library-grid,
  .photo-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 768px) {
  .phase-start-date-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .analysis-summary-grid,
  .analysis-controls,
  .analysis-criterion-row,
  .analysis-target-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .analysis-workspace .analysis-criterion-row {
    grid-template-columns: minmax(0, 1fr);
  }

  .analysis-chart {
    min-width: 640px;
  }

  .main {
    padding: 16px 12px calc(32px + env(safe-area-inset-bottom, 0px));
  }

  .topbar,
  .project-row,
  .panel-header {
    display: grid;
  }

  .toolbar {
    justify-content: start;
  }

  .nav-list,
  .metrics-grid,
  .dashboard-grid,
  .form-grid,
  .segmented,
  .protocol-grid,
  .analysis-grid,
  .protocol-variable-grid,
  .profile-manager,
  .profile-phase-columns,
  .collect-layout,
  .calendar-layout {
    grid-template-columns: 1fr;
  }

  .api-strip {
    grid-template-columns: 1fr;
  }

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

  .collect-tools {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: stretch;
  }

  .collect-tools > *,
  .collect-tools .scope-switch {
    width: 100%;
    min-width: 0;
    max-width: 100%;
  }

  .collect-tools .scope-pill,
  .collect-tools .compact-btn {
    min-height: 44px;
  }

  .collect-filter-field,
  .collect-filter-sample {
    grid-template-columns: minmax(84px, auto) minmax(0, 1fr);
  }

  .collect-filter-field input {
    width: 100%;
    min-width: 0;
    min-height: 44px;
    box-sizing: border-box;
  }

  .collect-panel .panel-header {
    padding: 14px 12px 0;
  }

  .collect-panel .panel-body {
    padding: 12px;
  }

  .collect-table-wrap {
    border: none;
    background: transparent;
    max-height: none;
    overflow: visible;
    scrollbar-gutter: auto;
    overscroll-behavior: auto;
  }

  .collect-table,
  .collect-table tbody {
    display: block;
    width: 100%;
    min-width: 0;
    max-width: 100%;
  }

  .collect-wide-table {
    min-width: 0;
    table-layout: fixed;
  }

  .collect-wide-table th:not(.collect-sticky),
  .collect-wide-table td:not(.collect-sticky),
  .collect-measure-cell,
  .collect-observation-cell {
    min-width: 0;
  }

  .collect-table colgroup,
  .collect-table thead {
    display: none;
  }

  .collect-table tbody {
    display: grid;
    gap: 12px;
  }

  .collect-table tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 76px;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    padding: 0;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: white;
    box-shadow: 0 8px 18px rgba(24, 34, 31, 0.06);
    scroll-margin-top: 12px;
  }

  .collect-table td {
    display: grid;
    grid-column: 1 / -1;
    grid-template-columns: minmax(0, 1fr);
    gap: 6px;
    align-items: stretch;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    padding: 12px;
    border-bottom: 1px solid rgba(24, 34, 31, 0.08);
    text-align: left;
    overflow: visible;
    overflow-wrap: anywhere;
    box-sizing: border-box;
  }

  .collect-table tr:not(.is-mobile-expanded) > td:not(.collect-mobile-card-summary):not(.collect-mobile-status-cell) {
    display: none;
  }

  .collect-table td[data-label="Phase"],
  .collect-table td[data-label="Jour de phase"],
  .collect-table td[data-label="Date"],
  .collect-table td[data-label="Échantillon"] {
    display: none;
  }

  .collect-table-shell,
  .collect-phase-section,
  .collect-layout,
  .panel,
  .panel-body {
    width: 100%;
    min-width: 0;
    max-width: 100%;
  }

  .collect-table-shell {
    max-height: none;
    overflow: visible;
  }

  .collect-phase-header,
  .collect-table th,
  .collect-sticky,
  thead .collect-sticky,
  .collect-table th.collect-sticky {
    position: static;
    left: auto;
    width: auto;
    min-width: 0;
    box-shadow: none;
  }

  .collect-table td:last-child {
    border-bottom: none;
  }

  .collect-table td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .collect-table .collect-mobile-card-summary {
    display: block;
    grid-column: 1;
    grid-row: 1;
    padding: 0;
    border: 0;
  }

  .collect-table .collect-mobile-card-summary::before,
  .collect-table .collect-mobile-card-nav::before {
    display: none;
  }

  .collect-mobile-card-toggle {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas:
      "day date chevron"
      "sample sample chevron";
    gap: 4px 10px;
    align-items: center;
    width: 100%;
    min-width: 0;
    min-height: 70px;
    padding: 12px;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: var(--ink);
    font: inherit;
    text-align: left;
  }

  .collect-mobile-card-day {
    grid-area: day;
    color: var(--brand);
    font-size: 0.88rem;
    font-weight: 900;
  }

  .collect-mobile-card-date {
    grid-area: date;
    min-width: 0;
    color: var(--muted);
    font-size: 0.82rem;
    overflow-wrap: anywhere;
  }

  .collect-mobile-card-sample {
    grid-area: sample;
    min-width: 0;
    line-height: 1.35;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .collect-mobile-card-chevron {
    grid-area: chevron;
    align-self: center;
    font-size: 1.35rem;
    transition: transform 160ms ease;
  }

  .collect-table tr.is-mobile-expanded .collect-mobile-card-chevron {
    transform: rotate(180deg);
  }

  .collect-table .collect-mobile-status-cell {
    display: grid;
    grid-column: 2;
    grid-row: 1;
    place-items: center;
    width: 76px;
    min-width: 0;
    max-width: 76px;
    padding: 8px;
    border-bottom: 0;
    border-left: 1px solid rgba(24, 34, 31, 0.08);
    background: rgba(39, 103, 73, 0.035);
    box-sizing: border-box;
  }

  .collect-table .collect-mobile-status-cell::before {
    font-size: 0.62rem;
    letter-spacing: 0.02em;
    text-align: center;
  }

  .collect-table td[data-label="Action"] {
    grid-template-columns: 1fr;
    justify-items: stretch;
  }

  .collect-table td[data-label="Photos"] {
    grid-template-columns: 1fr;
  }

  .collect-table td[data-label="Action"]::before {
    display: none;
  }

  .collect-mobile-field-help {
    display: block;
    color: var(--muted);
    font-size: 0.78rem;
    line-height: 1.4;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .collect-table td input,
  .collect-table td select,
  .collect-table td textarea,
  .collect-table td button {
    max-width: 100%;
    box-sizing: border-box;
  }

  .collect-table td input,
  .collect-table td select,
  .collect-table td textarea {
    width: 100%;
    min-width: 0;
    min-height: 44px;
    padding: 10px 12px;
    font-size: 16px;
  }

  .collect-table td button {
    min-height: 44px;
  }

  .collect-table .collect-observation-input {
    height: auto;
    min-height: 96px;
    resize: vertical;
    overflow: auto;
  }

  .collect-checkbox {
    width: 44px;
    min-width: 44px;
    min-height: 44px;
    justify-content: center;
  }

  .collect-checkbox-ui {
    width: 32px;
    height: 32px;
  }

  .photo-cell {
    justify-items: stretch;
  }

  .photo-cell .btn,
  .photo-action-btn {
    width: 100%;
    min-height: 44px;
  }

  .collect-table td[data-label="Action"] {
    justify-items: end;
  }

  .collect-table td[data-label="Action"] .collection-row-delete-button {
    display: inline-grid;
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    max-width: 44px;
    max-height: 44px;
    padding: 10px;
    place-items: center;
    justify-self: end;
    overflow: hidden;
  }

  .collect-table td[data-label="Action"] .collection-row-delete-button svg {
    width: 20px;
    height: 20px;
    max-width: 20px;
    max-height: 20px;
  }

  .photo-card-actions .photo-delete-button {
    display: inline-flex;
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    max-width: 44px;
    max-height: 44px;
    margin-left: auto;
    padding: 10px;
    align-items: center;
    justify-content: center;
    overflow: hidden;
  }

  .photo-delete-button-icon {
    display: inline-flex;
    width: 20px;
    height: 20px;
  }

  .photo-delete-button-icon svg {
    display: block;
    width: 20px;
    height: 20px;
    max-width: 20px;
    max-height: 20px;
  }

  .photo-delete-button-label {
    display: none;
  }

  .collect-table .collect-mobile-card-nav {
    display: none;
  }

  .collect-table tr.is-mobile-expanded .collect-mobile-card-nav {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    gap: 8px;
    align-items: center;
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    border-bottom: 0;
  }

  .collect-mobile-card-nav .btn {
    min-height: 44px;
  }

  .collect-mobile-card-nav .btn:last-child {
    grid-column: 3;
  }

  .collect-mobile-card-position {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 750;
    text-align: center;
    white-space: nowrap;
  }

  .collect-phase-header h3,
  .collect-phase-header p {
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .photo-group-header,
  .photo-lightbox-header,
  .photo-lightbox-actions {
    display: grid;
    justify-content: start;
  }

  .photo-lightbox {
    padding: 12px;
  }

  .photo-lightbox-dialog {
    width: min(100%, calc(100vw - 12px));
    max-height: calc(100vh - 12px);
  }

  .modal-overlay {
    padding: 12px;
  }

  .modal-dialog {
    width: min(100%, calc(100vw - 12px));
    max-height: calc(100vh - 12px);
  }

  .day-task-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .phase-start-date-list {
    grid-template-columns: minmax(0, 1fr);
  }

  .photo-library-grid,
  .photo-grid {
    grid-template-columns: 1fr;
  }
}

@media print {
  body {
    background: white;
  }

  .sidebar,
  .topbar,
  .toolbar,
  .no-print,
  .toast {
    display: none !important;
  }

  .shell {
    display: block;
  }

  .main {
    padding: 0;
  }

  .panel,
  .report-section {
    box-shadow: none;
    break-inside: avoid;
  }
}



.auth-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-card {
  width: min(560px, 100%);
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
}

.auth-copy {
  margin-bottom: 18px;
}

.auth-form-grid {
  grid-template-columns: minmax(0, 1fr);
}

.auth-toolbar {
  justify-content: flex-start;
  margin-top: 8px;
}

.auth-note {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.45;
}

.auth-error {
  margin: 10px 0 0;
  color: var(--red);
  font-weight: 700;
}

.topbar-user {
  max-width: 280px;
}
