.live-offline-panel {
  margin-top: 24px;
}

.live-offline-panel .live-toolbar {
  margin-bottom: 8px;
}

.live-offline-panel h2 {
  margin: 4px 0 0;
}

.live-offline-panel form {
  max-width: 620px;
}

.live-saved-draft {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 20px 0;
  border-top: 1px solid var(--border,var(--line));
  flex-wrap: wrap;
  overflow-wrap: anywhere;
}

.live-saved-draft small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  line-height: 1.65;
  font-size: 13px;
}

.live-local-receipts {
  margin-top: 16px;
}

.live-local-receipts summary {
  cursor: pointer;
  font-weight: 500;
  min-height: 48px;
  padding: 11px 0;
  overflow-wrap: anywhere;
}

.live-offline-panel .live-hint {
  line-height: 1.65;
}

.field-install {
  position: fixed;
  z-index: 50;
  bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  right: max(18px, env(safe-area-inset-right, 0px));
  padding: 12px 18px;
  background: var(--lime);
  border: 1px solid var(--control-line);
  border-radius: 9px;
  color: var(--ink);
  font: 500 14px var(--font-body);
  box-shadow: var(--shadow);
  cursor: pointer;
  min-height: 48px;
  max-width: calc(100vw - 36px - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px));
  line-height: 1.5;
  white-space: normal;
  overflow-wrap: anywhere;
}

.live-filter-panel {
  margin: 0 0 24px;
  padding: 24px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.live-filter-panel .form-grid {
  gap: 12px;
}

.live-filter-panel .live-actions {
  margin-top: 14px;
}

.live-map {
  width: 100%;
  height: auto;
  max-height: 420px;
  background: var(--map);
  border-radius: 12px;
  display: block;
  min-height: 300px;
}

.live-map .boundary {
  fill: #d8e2cd;
  stroke: var(--paper);
  stroke-width: .85;
}

.live-map text {
  font-family: var(--font-body);
  font-size: 12px;
  fill: var(--muted);
}

.live-map .unit-dot {
  stroke: #fff;
  stroke-width: 1.2;
}

.live-map-legend {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  padding-top: 14px;
  font-size: 13px;
}

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

.live-map-legend i {
  height: 9px;
  width: 9px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.live-export-controls {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.live-export-controls .button {
  font-size: 14px;
}

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

#live-save-error[hidden] {
  display: none;
}

.live-field input[type=password] {
  letter-spacing: .08em;
}

.live-field input[type=file] {
  max-width: 100%;
}

@media(max-width:700px) {
  .live-saved-draft {
    align-items: flex-start;
    gap: 12px;
  }
  .live-saved-draft .button {
    flex-shrink: 0;
  }
  .live-session {
    align-items: flex-start;
    gap: 12px;
    flex-wrap: wrap;
  }
  .field-install {
    bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    right: max(12px, env(safe-area-inset-right, 0px));
    max-width: calc(100vw - 24px - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px));
  }
  .live-offline-panel .live-toolbar {
    align-items: flex-start;
  }
  .live-filter-panel .form-grid {
    grid-template-columns: 1fr;
  }
  .live-offline-panel .live-actions .button {
    white-space: normal;
  }
}

.live-saved-draft > div, .live-saved-draft > span {
  flex: 1 1 200px;
  min-width: 0;
  overflow-wrap: anywhere;
}

.live-saved-draft > .button {
  flex: 0 1 auto;
}

body.mobile-nav-open .field-install {
  display: none;
}

.field-install:not(:disabled):active {
  opacity: .82;
}

@media (prefers-reduced-motion: no-preference) {
  html[data-input-modality="pointer"] .field-install {
    transition: transform 120ms var(--ease-out);
  }
  html[data-input-modality="pointer"] .field-install:not(:disabled):active:not(:focus-visible) {
    transform: scale(.98);
  }
}

body:has(.field-install) .main {
  padding-bottom: calc(108px + env(safe-area-inset-bottom, 0px));
}

body:has(.field-install) .toast {
  bottom: calc(80px + env(safe-area-inset-bottom, 0px));
  max-height: calc(100dvh - 104px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
}

/* A field submission is one continuous, evidence-backed record. */
.atlas-field-record { max-width: 1080px; min-width: 0; }
.atlas-field-section { padding: 28px 0; border-top: 1px solid var(--line); min-width: 0; }
.atlas-field-section > :first-child { margin-top: 0; }
.atlas-field-section h3 { margin: 0 0 16px; font-family: var(--font-display); font-size: 23px; font-weight: 400; letter-spacing: -.035em; line-height: 1.35; }
.atlas-field-section h3:not(:first-child) { margin-top: 28px; }
.atlas-field-section p { max-width: 65ch; }
.atlas-field-section .live-hint { font-size: 14px; line-height: 1.65; }
.atlas-field-section .live-field:last-child { margin-bottom: 0; }
.atlas-field-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 26px; padding-top: 22px; border-top: 1px solid var(--line); }
.atlas-field-actions > .primary { min-width: 180px; }
.live-saved-draft strong { font-weight: 500; }
.live-local-receipts summary::marker { color: var(--green); }
@media (hover: hover) and (pointer: fine) {
  .field-install:hover { background: #d4e7a2; border-color: var(--green); }
}
@media (max-width: 640px) {
  .live-filter-panel { padding: 20px 0; }
  .live-map { min-height: 240px; }
  .live-map-legend { gap: 12px 18px; }
  .atlas-field-section { padding: 24px 0; }
  .atlas-field-section h3 { font-size: 22px; }
  .atlas-field-actions { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); width: 100%; }
  .atlas-field-actions > .primary, .atlas-field-actions > .notice, .atlas-field-actions > .live-hint { grid-column: 1/-1; }
  .atlas-field-actions > .primary { min-width: 0; width: 100%; }
}

/* Capture keeps the evidence, counts and final confirmation in a clear sequence. */
.atlas-capture-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  margin: 24px 0 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.atlas-capture-steps button {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  min-height: 76px;
  padding: 16px;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  text-align: left;
  font-size: 14px;
  font-weight: 400;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.atlas-capture-steps button:first-child { padding-left: 0; }
.atlas-capture-steps button:last-child { padding-right: 0; }
.atlas-capture-steps button[aria-current="step"] { color: var(--ink); border-bottom-color: var(--green); font-weight: 600; }
.atlas-capture-steps button:focus-visible { outline-offset: -3px; }

.atlas-step-number {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--control-line);
  border-radius: 50%;
  background: var(--ground);
  color: var(--muted);
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 400;
}

[aria-current="step"] > .atlas-step-number {
  background: var(--green);
  color: var(--on-accent);
  border-color: var(--green);
}

.atlas-capture-step-title { scroll-margin-top: 24px; }
.atlas-capture-summary { max-width: 680px; }
.atlas-capture-summary dd { white-space: normal; max-width: 65%; flex-shrink: 1; }
.atlas-field-section + .atlas-field-actions { margin-top: 0; }

.atlas-assignment-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px 24px;
  flex-wrap: wrap;
  padding: 24px 0;
  border-top: 1px solid var(--line);
  min-width: 0;
}

.atlas-assignment-card > div { min-width: 0; }
.atlas-assignment-card > div:not(.live-actions) { flex: 1 1 240px; }
.atlas-assignment-card > .live-actions { flex: 0 1 auto; margin: 0; }
.atlas-assignment-card strong, .atlas-assignment-card h3 { display: block; font-family: var(--font-display); font-size: 20px; font-weight: 400; letter-spacing: -.035em; line-height: 1.4; margin: 0 0 7px; overflow-wrap: anywhere; }
.atlas-assignment-card small { display: block; color: var(--muted); font-size: 13px; line-height: 1.65; }
.atlas-assignment-card code { font-family: var(--font-mono); font-size: 12px; overflow-wrap: anywhere; }

@media (hover: hover) and (pointer: fine) {
  .atlas-capture-steps button:hover { background: var(--ground); color: var(--ink); }
}

@media (max-width: 640px) {
  .atlas-capture-steps { margin-top: 20px; }
  .atlas-capture-steps button { flex-direction: column; align-items: flex-start; gap: 9px; padding: 15px 10px; font-size: 13px; }
  .atlas-assignment-card { padding: 22px 0; gap: 16px; }
  .atlas-assignment-card > .button, .atlas-assignment-card > .live-actions { width: 100%; }
  .atlas-assignment-card .live-actions > .button.primary { flex: 1; }
}

.live-evidence-viewer {
  width: min(1100px, 94vw);
  max-height: 94dvh;
  padding: 20px;
  border: 1px solid var(--border, #d3dbd4);
  background: var(--surface, #fff);
  color: var(--text, #172b23);
  overflow: auto;
}
.live-evidence-viewer::backdrop { background: #000a; }
.live-evidence-viewer .live-toolbar { align-items: flex-start; }
.live-evidence-viewer h2 { margin: 0; }
.live-evidence-canvas {
  max-height: 68dvh;
  overflow: auto;
  overscroll-behavior: contain;
}
.live-evidence-canvas img { display: block; height: auto; }
.live-evidence-canvas .is-fit { width: auto; max-width: 100%; max-height: 68dvh; margin: 0 auto; }
.live-evidence-canvas .is-zoomed { max-width: none; }
