:root {
  --bg: #e6edf5;
  --panel: #ffffff;
  --panel-soft: #f7f9fc;
  --text: #1f2937;
  --muted: #64748b;
  --line: #9fb4c7;
  --field: #dce7f7;
  --accent: #f59e0b;
  --accent-dark: #b45309;
  --teal: #14b8a6;
  --teal-dark: #0f766e;
  --navy: #1f2937;
  --danger: #dc2626;
  --shadow: 0 14px 34px rgba(31, 41, 55, 0.12);
  --radius: 18px;
  --radius-sm: 12px;
  --page-width: min(100%, 720px);
  --slot-gap: 12px;
  --grid-rows: repeat(4, minmax(160px, 1fr));
  --font-lg: 18px;
  --font-md: 14px;
  --font-sm: 12px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: linear-gradient(180deg, #eef3f8 0%, #dce6f0 100%);
  color: var(--text);
  font: 400 var(--font-md)/1.45 "Montserrat", "Segoe UI", Arial, sans-serif;
}

body {
  min-height: 100vh;
}

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

.hidden {
  display: none !important;
}

.app-shell {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 12px 16px 28px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  margin-bottom: 14px;
  border-radius: 22px;
  overflow: hidden;
  box-shadow: var(--shadow);
  background: linear-gradient(90deg, #30b9bd 0%, #f1cc36 100%);
}

.topbar-accent {
  height: 6px;
  background: var(--accent);
}

.topbar-main {
  display: grid;
  grid-template-columns: minmax(280px, 1.15fr) minmax(300px, 1fr);
  gap: 14px;
  padding: 14px;
  align-items: start;
}

.brand-card,
.action-card,
 .panel {
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid rgba(159, 180, 199, 0.8);
  border-radius: var(--radius);
  box-shadow: 0 10px 24px rgba(31, 41, 55, 0.08);
}

.brand-card {
  padding: 14px 16px;
}

.brand-date {
  text-align: center;
  font-size: 16px;
  line-height: 1.1;
  font-weight: 700;
  color: #ffffff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.18);
  margin-bottom: 8px;
}

.brand-row {
  display: flex;
  gap: 14px;
  align-items: center;
}

.brand-logo {
  width: min(100%, 330px);
  max-width: 330px;
  height: auto;
  border-radius: 12px;
  border: 1px solid rgba(31, 41, 55, 0.2);
  background: white;
}

.brand-copy {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.brand-title {
  font-size: 22px;
  line-height: 1.05;
  font-weight: 800;
  color: var(--navy);
}

.brand-subtitle {
  color: var(--muted);
  font-size: 13px;
}

.action-card {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

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

.action-status {
  color: var(--muted);
  font-size: var(--font-sm);
}

.app-btn,
.chip-btn,
.page-chip,
.module-chip {
  border: 1px solid rgba(31, 41, 55, 0.18);
  border-radius: 999px;
  background: #ffffff;
  color: var(--navy);
  padding: 9px 12px;
  min-height: 38px;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.app-btn:hover,
.chip-btn:hover,
.page-chip:hover,
.module-chip:hover {
  transform: translateY(-1px);
  border-color: rgba(15, 118, 110, 0.5);
  box-shadow: 0 6px 14px rgba(31, 41, 55, 0.1);
}

.app-btn-primary {
  background: var(--teal);
  color: white;
  border-color: rgba(15, 118, 110, 0.35);
}

.app-btn-danger {
  border-color: rgba(220, 38, 38, 0.35);
  color: var(--danger);
}

.icon-btn {
  width: 38px;
  min-width: 38px;
  height: 38px;
  border-radius: 999px;
  border: 1px solid rgba(31, 41, 55, 0.18);
  background: white;
  color: var(--navy);
  font-size: 20px;
  cursor: pointer;
}

.main-wrap {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.panel {
  padding: 14px 16px;
}

.panel-title,
.page-title {
  display: inline-flex;
  align-items: center;
  background: var(--accent);
  color: var(--navy);
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
  margin-bottom: 12px;
}

.report-meta-panel {
  padding: 10px 12px;
}

.report-meta-panel .panel-title {
  margin-bottom: 8px;
  padding: 4px 9px;
  font-size: 12px;
}

.meta-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.meta-grid-compact {
  grid-template-columns: minmax(280px, 2.2fr) minmax(180px, 1.2fr) minmax(150px, 0.8fr);
  gap: 8px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field span {
  font-size: var(--font-sm);
  font-weight: 800;
  color: var(--muted);
}

.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: var(--field);
  color: var(--navy);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  outline: none;
}

.report-meta-panel .field {
  gap: 4px;
}

.report-meta-panel .field span {
  font-size: 11px;
}

.report-meta-panel .field input {
  min-height: 38px;
  padding: 8px 10px;
  font-size: 13px;
}

.field textarea {
  min-height: 92px;
  resize: vertical;
}

.compact-field {
  min-width: 160px;
}

.compact-field select {
  min-width: 120px;
}

.pages-panel {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.pages-root {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(760px, 1fr));
  gap: 20px;
  align-items: start;
}

.page-editor {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.page-editor-toolbar {
  position: sticky;
  top: 88px;
  z-index: 8;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(159, 180, 199, 0.85);
  border-radius: var(--radius);
  box-shadow: 0 12px 24px rgba(31, 41, 55, 0.08);
  backdrop-filter: blur(12px);
}

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

.page-meta {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.page-subtitle {
  color: var(--muted);
  font-size: var(--font-sm);
}

.page-actions,
.module-actions,
.module-chip-row,
.page-add-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.report-page-shell {
  display: flex;
  justify-content: flex-start;
}

.report-page {
  position: relative;
  width: var(--page-width);
  aspect-ratio: 8.5 / 11;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 10px;
  padding: 18px;
  padding-top: 20px;
  background: #ffffff;
  border-radius: 22px;
  border: 1px solid rgba(31, 41, 55, 0.12);
  box-shadow: 0 20px 38px rgba(31, 41, 55, 0.14);
  overflow: hidden;
}

.page-top-accent {
  position: absolute;
  inset: 0 0 auto 0;
  height: 6px;
  background: var(--accent);
}

.page-header {
  position: relative;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
}

.page-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1 1 auto;
  min-width: 0;
}

.page-brand img {
  width: 180px;
  max-width: 44vw;
  height: auto;
}

.page-brand-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.page-report-title {
  font-size: 21px;
  line-height: 1.05;
  font-weight: 800;
  color: var(--navy);
}

.page-report-subtitle {
  color: var(--muted);
  font-size: 12px;
}

.page-number {
  background: var(--accent);
  color: var(--navy);
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 800;
}

.page-header-fields {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  align-content: start;
}

.header-pill {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  min-width: 0;
  min-height: 40px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, #f7fbff 0%, #ecf4ff 100%);
  color: var(--navy);
  padding: 7px 10px;
  border-radius: 12px;
  font-size: 12px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.72);
}

.header-pill strong {
  color: #58748f;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.header-pill span {
  display: block;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
  color: var(--navy);
  word-break: break-word;
}

.header-pill-empty {
  grid-column: 1 / -1;
}

.page-grid {
  position: relative;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: var(--grid-rows);
  gap: var(--slot-gap);
  min-height: 0;
}

.grid-module {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: linear-gradient(180deg, #fffaf0 0%, #f8fbff 100%);
  border: 2px solid rgba(245, 158, 11, 0.85);
  border-radius: 18px;
  overflow: hidden;
}

.grid-module.module-large {
  grid-column: span 2;
  grid-row: span 2;
}

.module-topbar {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  padding: 8px 10px 4px;
}

.photo-module .module-topbar {
  justify-content: space-between;
}

.module-top-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.photo-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  border-radius: 999px;
  background: rgba(31, 41, 55, 0.9);
  color: white;
  font-size: 11px;
  font-weight: 800;
}

.photo-label span {
  opacity: 0.9;
  font-weight: 600;
}

.module-code-field {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  padding: 5px 8px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.92);
  color: #ffffff;
}

.module-code-field span {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  opacity: 0.82;
}

.module-code-input {
  width: 40px;
  min-width: 40px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 12px;
  line-height: 1;
  font-weight: 800;
  text-align: center;
  outline: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14);
}

.module-code-input::placeholder {
  color: rgba(255, 255, 255, 0.62);
  opacity: 1;
}

.module-title-input,
.module-caption-input,
.module-note-title,
.module-note-body {
  width: 100%;
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--navy);
  border-radius: 12px;
  padding: 8px 10px;
}

.module-title-input {
  font-weight: 700;
}

.module-media {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  margin: 0 10px;
  border-radius: 14px;
  overflow: hidden;
  background: linear-gradient(180deg, #dbeafe 0%, #eff6ff 100%);
  border: 1px solid rgba(159, 180, 199, 0.9);
}

.grid-module.module-large .module-media {
  min-height: 286px;
}

.grid-module.module-small .module-media {
  min-height: 146px;
}

.module-media.has-image {
  background: #0f172a;
}

.module-media.map-media .module-image {
  object-fit: cover;
}

.module-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.image-stage-wrap {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
}

.image-stage {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border-radius: 12px;
}

.image-stage-help {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
  background: rgba(15, 23, 42, 0.72);
  color: rgba(255, 255, 255, 0.94);
  border-radius: 10px;
  padding: 6px 8px;
  font-size: 11px;
  text-align: center;
}

.module-image-placeholder,
.note-placeholder {
  height: 100%;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 20px;
  color: var(--muted);
  font-size: 13px;
}

.module-map-placeholder {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.module-map-placeholder strong {
  color: var(--navy);
  font-size: 15px;
}

.module-map-placeholder span {
  max-width: 440px;
}

.module-map-placeholder-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.photo-input-overlay {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 4;
  max-width: calc(100% - 16px);
  display: flex;
  align-items: center;
  gap: 6px;
}

.photo-input-overlay.text-only {
  width: min(260px, calc(100% - 16px));
}

.photo-overlay-input {
  border: 1px solid rgba(255, 255, 255, 0.34);
  background: rgba(15, 23, 42, 0.18);
  color: #ffffff;
  border-radius: 10px;
  outline: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(5px);
}

.photo-overlay-input {
  flex: 1 1 auto;
  min-width: 0;
  padding: 6px 9px;
  font-size: 11px;
  font-weight: 700;
}

.module-small.photo-module .image-stage-wrap {
  padding: 4px;
}

.module-small.photo-module .photo-input-overlay.text-only {
  width: min(210px, calc(100% - 12px));
}

.module-overlay-label {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 2;
  background: linear-gradient(
    90deg,
    rgba(15, 23, 42, 0.54) 0%,
    rgba(15, 23, 42, 0.2) 58%,
    rgba(15, 23, 42, 0) 100%
  );
  color: white;
  padding: 6px 16px 7px 8px;
  border-radius: 0 0 12px 0;
  font-size: 12px;
  font-weight: 800;
  max-width: calc(100% - 20px);
  pointer-events: none;
  text-shadow: 0 1px 2px rgba(15, 23, 42, 0.35);
}

.module-overlay-label span {
  font-weight: 600;
  opacity: 0.92;
}

.overlay-separator {
  opacity: 0.85;
}

.annotation-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.annotation-pin {
  position: absolute;
  width: 28px;
  height: 28px;
  margin-left: -14px;
  margin-top: -14px;
  border-radius: 999px;
  background: rgba(20, 184, 166, 0.92);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.25);
}

.annotation-text {
  position: absolute;
  transform: translate(-50%, -50%);
  background: rgba(255, 255, 255, 0.92);
  color: var(--navy);
  border: 1px solid rgba(15, 118, 110, 0.35);
  border-radius: 10px;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 700;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.18);
  white-space: nowrap;
}

.annotation-box {
  position: absolute;
  border: 3px solid rgba(245, 158, 11, 0.95);
  border-radius: 10px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.28);
  background: rgba(245, 158, 11, 0.08);
}

.interactive-stage .annotation-pin,
.interactive-stage .annotation-text {
  pointer-events: auto;
  cursor: grab;
}

.interactive-stage .annotation-pin:active,
.interactive-stage .annotation-text:active {
  cursor: grabbing;
}

.annotation-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.annotation-stroke {
  fill: none;
  stroke: rgba(220, 38, 38, 0.86);
  stroke-width: 0.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.module-bottom {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 6px 10px 10px;
}

.module-caption-wrap {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.module-caption-label {
  font-size: 11px;
  line-height: 1;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #58748f;
}

.module-chip-row {
  justify-content: space-between;
}

.page-chip,
.module-chip {
  min-height: 30px;
  padding: 6px 10px;
  font-size: 12px;
  background: var(--panel-soft);
}

.page-chip.teal,
.module-chip.teal {
  background: rgba(20, 184, 166, 0.14);
  border-color: rgba(15, 118, 110, 0.25);
}

.page-chip.orange,
.module-chip.orange {
  background: rgba(245, 158, 11, 0.16);
  border-color: rgba(180, 83, 9, 0.28);
}

.page-chip.danger,
.module-chip.danger {
  background: rgba(220, 38, 38, 0.1);
  border-color: rgba(220, 38, 38, 0.24);
  color: var(--danger);
}

.overflow-warning {
  color: var(--danger);
  font-weight: 700;
  margin-top: 8px;
}

.module-caption-input {
  min-height: 0;
  background: linear-gradient(180deg, #ffffff 0%, #f7fbff 100%);
  border-color: rgba(88, 116, 143, 0.35);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.92);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.module-caption-input::placeholder {
  color: #6b7c93;
  opacity: 1;
}

.module-small .module-caption-input {
  padding-top: 6px;
  padding-bottom: 6px;
}

.module-note-body {
  flex: 1 1 auto;
  min-height: 0;
  height: auto;
  resize: none;
  overflow: hidden;
  background: #fff;
}

.readonly-block {
  width: 100%;
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--navy);
  border-radius: 12px;
  padding: 8px 10px;
  font-size: 12px;
  line-height: 1.35;
}

.readonly-caption {
  min-height: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.readonly-title {
  font-weight: 700;
}

.readonly-note {
  flex: 1 1 auto;
  min-height: 0;
  white-space: normal;
}

.export-topbar {
  padding-bottom: 2px;
}

.export-bottom {
  padding-top: 6px;
}

.export-note-stack {
  padding-top: 0;
}

.module-actions-photo {
  justify-content: flex-end;
  flex: 1 1 auto;
}

.module-actions-photo .module-chip {
  min-height: 28px;
  padding: 5px 9px;
  font-size: 11px;
}

.module-actions-photo-small {
  flex-wrap: wrap;
  gap: 5px;
}

.module-actions-photo-small .module-chip {
  padding: 5px 7px;
  font-size: 10px;
}

.module-workflow-hint {
  margin: 0 10px 8px;
  padding: 7px 10px;
  border-radius: 12px;
  background: rgba(20, 184, 166, 0.1);
  border: 1px solid rgba(20, 184, 166, 0.22);
  color: #0f766e;
  font-size: 11px;
  font-weight: 700;
}

.module-note-stack {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1 1 auto;
  min-height: 0;
  padding: 0 10px 10px;
  overflow: hidden;
}

.module-counter {
  align-self: flex-end;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.empty-state {
  padding: 30px 22px;
  text-align: center;
  background: rgba(255, 255, 255, 0.96);
  border: 1px dashed rgba(159, 180, 199, 0.9);
  border-radius: var(--radius);
  color: var(--muted);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%) translateY(24px);
  min-width: 200px;
  max-width: min(92vw, 520px);
  background: rgba(31, 41, 55, 0.92);
  color: white;
  padding: 12px 14px;
  border-radius: 999px;
  box-shadow: 0 12px 26px rgba(15, 23, 42, 0.3);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
  text-align: center;
  z-index: 40;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.64);
}

.modal-card {
  position: relative;
  z-index: 1;
  width: min(100%, 1040px);
  max-height: calc(100vh - 28px);
  overflow: hidden;
  background: #fff;
  border-radius: 22px;
  border: 1px solid rgba(159, 180, 199, 0.9);
  display: flex;
  flex-direction: column;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.28);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 12px;
  padding: 16px 18px 12px;
  border-bottom: 1px solid rgba(159, 180, 199, 0.7);
}

.modal-title {
  font-size: 20px;
  font-weight: 800;
}

.modal-subtitle,
.annot-help {
  color: var(--muted);
  font-size: 12px;
}

.annot-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: end;
  padding: 12px 18px 0;
}

.annot-canvas-wrap {
  padding: 12px 18px 18px;
  flex: 1 1 auto;
  min-height: 0;
}

.annot-canvas {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: min(68vh, 760px);
  border-radius: 18px;
  border: 1px solid rgba(159, 180, 199, 0.95);
  background: linear-gradient(180deg, #dce7f7 0%, #f8fbff 100%);
  overflow: hidden;
  touch-action: none;
}

.annot-canvas .image-stage-wrap {
  width: 100%;
  height: 100%;
  padding: 16px;
}

.annot-canvas .image-stage {
  width: 100%;
  height: 100%;
}

.annot-canvas-empty {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  text-align: center;
  color: var(--muted);
}

.annot-help {
  padding: 0 18px 18px;
}

.page-chip.is-active,
.module-chip.is-active {
  background: var(--teal);
  border-color: rgba(15, 118, 110, 0.35);
  color: #ffffff;
}

.page-chip.is-active.danger,
.module-chip.is-active.danger {
  background: var(--danger);
  border-color: rgba(220, 38, 38, 0.42);
}

.field-map-card {
  width: min(100%, 1480px);
  max-height: calc(100vh - 16px);
  padding: 0;
  background: rgba(247, 250, 253, 0.84);
  backdrop-filter: blur(12px);
}

.field-map-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  min-height: min(90vh, 920px);
}

.field-map-stage-wrap {
  position: relative;
  min-width: 0;
  min-height: 0;
  padding: 12px;
}

.field-map-canvas {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: min(76vh, 860px);
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid rgba(159, 180, 199, 0.95);
  background:
    radial-gradient(circle at top right, rgba(245, 158, 11, 0.16), transparent 28%),
    linear-gradient(180deg, #dce7f7 0%, #eef5fb 100%);
}

.field-map-google,
.field-map-overlay-stage,
.field-map-markup-stage {
  position: absolute;
  inset: 0;
}

.field-map-overlay-stage {
  pointer-events: none;
  z-index: 3;
}

.field-map-markup-stage {
  z-index: 4;
}

.field-map-markup-stage.tool-pin,
.field-map-markup-stage.tool-text,
.field-map-markup-stage.tool-draw,
.field-map-markup-stage.tool-line,
.field-map-markup-stage.tool-erase {
  cursor: crosshair;
}

.field-map-boundary-svg,
.field-map-markup-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.field-map-boundary-path {
  fill: rgba(37, 99, 235, 0.08);
  stroke: rgba(37, 99, 235, 0.95);
  stroke-width: 2.8;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.field-map-line {
  stroke: rgba(245, 158, 11, 0.96);
  stroke-width: 3.2;
  stroke-linecap: round;
}

.field-map-live-location {
  position: absolute;
  width: 0;
  height: 0;
  pointer-events: none;
}

.field-map-live-ring {
  position: absolute;
  left: 50%;
  top: 50%;
  border-radius: 999px;
  background: rgba(59, 130, 246, 0.14);
  border: 1.5px solid rgba(59, 130, 246, 0.34);
  transform: translate(-50%, -50%);
}

.field-map-live-dot {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: #2563eb;
  border: 3px solid #ffffff;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.16), 0 6px 14px rgba(15, 23, 42, 0.24);
}

.field-map-live-heading {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 0;
  height: 0;
  border-left: 8px solid transparent;
  border-right: 8px solid transparent;
  border-bottom: 24px solid rgba(37, 99, 235, 0.92);
  transform-origin: 50% calc(100% + 12px);
  filter: drop-shadow(0 3px 8px rgba(15, 23, 42, 0.28));
}

.field-map-png-overlay {
  position: absolute;
  left: 50%;
  top: 50%;
  max-width: none;
  width: 52%;
  pointer-events: auto;
  transform-origin: center center;
  cursor: move;
  filter: drop-shadow(0 8px 18px rgba(15, 23, 42, 0.26));
}

.field-map-png-overlay.is-locked {
  cursor: default;
}

.field-map-empty,
.field-map-message {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
  text-align: center;
  color: var(--muted);
  z-index: 5;
}

.field-map-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.72);
  border-left: 1px solid rgba(159, 180, 199, 0.75);
  backdrop-filter: blur(18px);
  overflow: auto;
}

.field-map-panel.is-collapsed {
  width: 90px;
  padding-left: 10px;
  padding-right: 10px;
}

.field-map-panel.is-collapsed .modal-subtitle,
.field-map-panel.is-collapsed .field,
.field-map-panel.is-collapsed .field-map-section,
.field-map-panel.is-collapsed #fieldMapStatus {
  display: none;
}

.field-map-panel-header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: start;
}

.field-map-panel-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.field-map-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.58);
  border: 1px solid rgba(159, 180, 199, 0.72);
}

.field-map-section-title {
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #58748f;
}

.field-map-meta {
  color: #4b647d;
  font-size: 12px;
  line-height: 1.35;
}

.field-map-chip-row,
.field-map-search-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.field-map-search-row input {
  flex: 1 1 220px;
}

.field-map-panel textarea {
  resize: vertical;
  min-height: 92px;
}

.field-map-panel .field input[type="range"] {
  padding: 0;
  border: none;
  background: transparent;
}

.export-stage {
  position: fixed;
  left: -99999px;
  top: 0;
  width: 850px;
  background: white;
  padding: 0;
}

.export-page {
  width: 816px;
  height: 1056px;
  background: white;
}

@media (max-width: 980px) {
  .topbar-main,
  .meta-grid,
  .helper-list {
    grid-template-columns: 1fr;
  }

  .pages-root {
    grid-template-columns: 1fr;
  }

  .brand-row {
    flex-direction: column;
    align-items: start;
  }

  .page-editor-toolbar,
  .page-editor-header,
  .pages-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
}

@media (max-width: 760px) {
  :root {
    --slot-gap: 10px;
  }

  .app-shell {
    padding: 0 0 18px;
  }

  .topbar {
    border-radius: 0 0 22px 22px;
  }

  .topbar-main {
    padding: 12px;
  }

  .brand-date {
    font-size: 15px;
  }

  .brand-logo {
    max-width: min(100%, 300px);
  }

  .brand-title {
    font-size: 20px;
  }

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

  .app-btn {
    width: 100%;
  }

  .main-wrap {
    padding: 0 10px;
  }

  .meta-grid-compact {
    grid-template-columns: 1fr;
  }

  .pages-root {
    gap: 16px;
  }

  .page-editor-toolbar {
    top: 72px;
    padding: 10px 12px;
  }

  .page-header {
    gap: 8px;
  }

  .page-brand {
    flex-direction: column;
    align-items: start;
    gap: 4px;
  }

  .page-brand img {
    width: 150px;
    max-width: 48vw;
  }

  .page-report-title {
    font-size: 16px;
  }

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

  .page-grid {
    grid-template-columns: 1fr;
    grid-template-rows: none;
    grid-auto-rows: minmax(180px, auto);
  }

  .grid-module,
  .grid-module.module-large {
    grid-column: auto;
    grid-row: auto;
    min-height: 220px;
  }

  .module-chip-row {
    flex-wrap: wrap;
  }

  .module-topbar {
    align-items: stretch;
  }

  .module-top-left,
  .module-actions-photo,
  .module-actions-photo-small {
    width: 100%;
  }

  .module-code-field {
    width: fit-content;
  }

  .photo-input-overlay {
    right: 8px;
    max-width: none;
  }

  .photo-overlay-input {
    flex-basis: 0;
  }

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

  .field-map-panel {
    order: -1;
    border-left: 0;
    border-top: 1px solid rgba(159, 180, 199, 0.75);
  }

  .modal {
    padding: 0;
  }

  .modal-card {
    width: 100%;
    max-height: 100vh;
    border-radius: 0;
  }

  .annot-canvas {
    min-height: 54vh;
  }
}

@media (orientation: landscape) and (max-width: 980px), (max-height: 560px) {
  .modal {
    padding: 0;
  }

  .modal-card {
    width: 100%;
    max-height: 100vh;
    border-radius: 0;
  }

  .modal-header,
  .annot-toolbar,
  .annot-help {
    background: rgba(255, 255, 255, 0.88);
    backdrop-filter: blur(12px);
  }

  .annot-toolbar {
    position: sticky;
    top: 0;
    z-index: 2;
    padding-top: 10px;
  }

  .field-map-card {
    width: 100%;
    max-height: 100vh;
    border-radius: 0;
  }

  .field-map-shell {
    grid-template-columns: minmax(0, 1fr) minmax(220px, 28vw);
    min-height: 100vh;
  }

  .field-map-stage-wrap {
    padding: 6px;
  }

  .field-map-canvas {
    min-height: calc(100vh - 12px);
    border-radius: 12px;
  }

  .field-map-panel {
    background: rgba(255, 255, 255, 0.54);
    backdrop-filter: blur(16px);
  }

  .annot-canvas-wrap {
    padding: 8px 10px 10px;
  }

  .annot-canvas {
    min-height: calc(100vh - 180px);
    border-radius: 12px;
  }
}
