body {
  margin: 0;
  font-family: "Segoe UI", sans-serif;
  background: #eef2f5;
  color: #15202b;
}

.is-hidden {
  display: none !important;
}

.annotated-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: #fff; /* match XAML white window */
  color: #111827;

}

.annotated-player-mode .annotated-video-storage,
.annotated-player-mode .annotated-media-controls,
.annotated-player-mode #annotatedDepthPanel,
.annotated-player-mode #annotatedClearWellBtn,
.annotated-player-mode #annotatedSaveValues,
.annotated-player-mode .depth-crop-overlay { display: none !important; }
.annotated-opening .annotated-workspace { visibility: hidden; }
.annotated-opening .annotated-actions > button:not(#annotatedBackHomeBtn) { display: none !important; }
.annotated-opening-status { margin: 24px; text-align: center; }
#annotatedEditCurrentSurvey[hidden] { display: none; }
.annotated-player-mode #annotatedEditCurrentSurvey[hidden] { display: inline-flex; }
.annotated-viewer-only #annotatedEditSurvey,
.annotated-viewer-only #annotatedEditCurrentSurvey { display: none !important; }
.annotated-survey-picker { max-width: min(720px, 90vw); border: 1px solid #cbd5e1; border-radius: 12px; }
.annotated-survey-picker > div { display: grid; gap: 10px; max-height: 60vh; overflow-y: auto; margin-bottom: 16px; }
.read-only-active .annotated-player-mode .datum-label[data-survey-seek-depth] {
  pointer-events: auto !important;
}
.annotated-player-mode .annotated-toolbar {
  position: relative;
  display: flex;
  flex-direction: row;
  justify-content: center;
  text-align: center;
}
.annotated-player-mode .annotated-toolbar > div:first-child {
  width: var(--player-title-width, 40%);
  min-width: 0;
}
.annotated-player-mode #annotatedTitle {
  display: block !important;
  color: #111827;
  font-size: 18px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.annotated-player-mode .annotated-kicker,
.annotated-player-mode #wellInfoPanel { display: none; }
.annotated-player-mode .annotated-actions {
  position: absolute;
  right: 16px;
  justify-content: flex-end;
  flex-wrap: nowrap;
}
.annotated-player-mode .annotated-video-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.annotated-player-mode .annotated-video-stage { position: relative; top: auto; }
#annotatedHistoricViews { display: none; }
.annotated-player-mode #annotatedHistoricViews {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  width: 100%;
  margin-top: 8px;
}
.annotated-player-mode #annotatedHistoricViews[hidden] { display: none; }
#annotatedHistoricView { max-width: 100%; padding: 6px 8px; }
.annotated-camera-hit {
  position: absolute;
  left: 0;
  width: 100%;
  height: 24px;
  z-index: 8;
  cursor: ns-resize;
  touch-action: none;
  background: transparent;
  border: 0;
}
.annotated-camera-hit:focus-visible { outline: 2px solid #f59e0b; }

.annotated-toolbar {
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 16px;
  background: #ffffff; /* keep header neutral */
  color: #111827;
  box-sizing: border-box;
  border-bottom: 1px solid #e6e6e6;
}

.annotated-kicker {
  margin: 0 0 2px;
  color: #f59e0b;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.annotated-toolbar h1 {
  margin: 0;
  color: #ffd700;
  font-family: "Eurostile Extended", "Square 721 Extended", "Segoe UI", sans-serif;
  font-size: clamp(16px, 2.4vw, 30px);
  font-weight: 800;
  letter-spacing: 0.8px;
  white-space: nowrap;
}

.annotated-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.annotated-workspace {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 640px 1fr; /* left fixed like XAML, right expands */
  gap: 18px;
  padding: 18px;
  box-sizing: border-box;
}

.annotated-video-panel,
.annotated-diagram-panel {
  min-width: 0;
  min-height: 0;
  position: relative;
}

.annotated-video-panel {
  background: #fff;
  border-right: 1px solid #e6e6e6;
  padding-right: 10px;

}

.annotated-video-stage {
  width: 640px;
  height: 360px;
  display: block;
  position: relative;
  background: #000;
}

.annotated-video-stage .annotated-video-drop-button {
  width: 100%;
  height: 100%;
  border: 2px dashed #64748b;
  background: transparent;
  color: #fff;
  cursor: pointer;
  font: inherit;
  box-sizing: border-box;
}
.annotated-video-drop-button:focus-visible,
.annotated-video-stage.is-dragover {
  outline: 3px solid #10b981;
  outline-offset: -3px;
}
.annotated-video-storage {
  max-width: 640px;
  padding: 8px 0;
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.annotated-video-storage select { min-width: 0; max-width: 100%; flex: 1; }
.annotated-video-storage p { flex-basis: 100%; margin: 0; font-size: 12px; color: #334155; }
.annotated-video-storage .is-error { color: #b91c1c; }
.annotated-video-storage [hidden] { display: none; }

.annotated-media-controls {
  padding: 12px 14px;
  border-top: 1px solid #e6e6e6;
  background: #fafafa;
}
/* keep media controls constrained to the video width so controls don't flow into the right panel */
.annotated-media-controls { max-width: 640px; box-sizing: border-box; }
.annotated-media-row { display:flex; align-items:center; gap:8px; margin-bottom:10px; flex-wrap:wrap; }
.media-btn {
  background:#173f39;
  color:#fff;
  border:0;
  padding:8px 12px;
  border-radius:10px;
  cursor:pointer;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-width:84px;
  font-family: "Segoe UI Symbol", "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size:14px;
  line-height:1;
}
.media-btn:hover { opacity:0.95; }
.media-btn[disabled] { opacity:0.4; cursor:default; }

/* SVG icon inside media buttons */
.media-btn svg { width:18px; height:18px; flex:0 0 18px; fill:#fff; }
.media-btn .btn-label { margin-left:8px; font-size:13px; color:#fff; }

.ocr-controls { display:flex; align-items:center; gap:8px; flex-wrap:wrap; flex:1 1 100%; margin-left:0; padding-top:8px; }
.ocr-controls label { color:#334155; font-size:13px; font-weight:700; }
.ocr-progress { font-size:13px; color:#334155; margin-left:6px; }
.ocr-progress.running { color:#fff; background:#1a7f37; padding:4px 8px; border-radius:6px; }
.depth-crop-controls { flex:1 1 100%; display:flex; align-items:center; gap:6px; flex-wrap:wrap; padding-top:6px; color:#334155; font-size:12px; }
.depth-crop-controls span { font-weight:800; margin-right:4px; }
.depth-crop-controls input { width:54px; padding:4px 6px; border:1px solid #cbd5e1; border-radius:6px; }
.depth-crop-overlay { position:absolute; border:2px solid #f59e0b; background:rgba(245,158,11,0.14); box-shadow:0 0 0 9999px rgba(0,0,0,0.16); pointer-events:auto; z-index:35; }
.depth-crop-overlay::after { content:'Depth OCR crop'; position:absolute; left:0; top:-24px; background:#f59e0b; color:#111827; padding:3px 6px; border-radius:4px; font-size:11px; font-weight:800; white-space:nowrap; }
.depth-crop-handle { position:absolute; width:12px; height:12px; background:#fff; border:2px solid #f59e0b; border-radius:50%; box-shadow:0 1px 2px rgba(0,0,0,0.2); z-index:36; }
.depth-crop-handle-nw { left:-7px; top:-7px; cursor:nwse-resize; }
.depth-crop-handle-ne { right:-7px; top:-7px; cursor:nesw-resize; }
.depth-crop-handle-se { right:-7px; bottom:-7px; cursor:nwse-resize; }
.depth-crop-handle-sw { left:-7px; bottom:-7px; cursor:nesw-resize; }
.annotated-media-meta { margin-left:auto; color:#334155; font-weight:600; }
.annotated-segments { background:#fff; border:1px solid #e6e6e6; padding:8px; border-radius:8px; }
.annotated-segments { max-height: 360px; overflow: auto; overscroll-behavior: contain; }
.annotated-segments-title { font-weight:700; margin-bottom:6px; }
.annotated-segments-table { width:100%; border-collapse:collapse; font-size:0.85rem; table-layout:fixed; }
.annotated-segments-table th, .annotated-segments-table td { padding:6px 8px; border-bottom:1px solid #f0f0f0; text-align:left; }
.annotated-segments-table th, .annotated-segments-table td { overflow:hidden; text-overflow:ellipsis; vertical-align:top; }
.annotated-segments-table th:nth-child(3),
.annotated-segments-table td:nth-child(3),
.annotated-segments-table th:nth-child(4),
.annotated-segments-table td:nth-child(4),
.annotated-segments-table th:nth-child(5),
.annotated-segments-table td:nth-child(5),
.annotated-segments-table th:nth-child(7),
.annotated-segments-table td:nth-child(7),
.annotated-segments-table th:nth-child(8),
.annotated-segments-table td:nth-child(8),
.annotated-segments-table th:nth-child(10),
.annotated-segments-table td:nth-child(10),
.annotated-segments-table th:nth-child(11),
.annotated-segments-table td:nth-child(11),
.annotated-segments-table th:nth-child(12),
.annotated-segments-table td:nth-child(12) { display:none; }
.annotated-segments-table th:nth-child(1),
.annotated-segments-table td:nth-child(1),
.annotated-segments-table th:nth-child(2),
.annotated-segments-table td:nth-child(2),
.annotated-segments-table th:nth-child(6),
.annotated-segments-table td:nth-child(6),
.annotated-segments-table th:nth-child(9),
.annotated-segments-table td:nth-child(9) { width:25%; }
.annotated-segments-table .ocr-text { white-space:normal; word-break:break-word; }
.annotated-segments-table .verified { background:#f0fdf4; }
.annotated-segments-table tr.segment-row { cursor:pointer; }
.annotated-segments-table tr.segment-row.segment-active { outline:2px solid #f59e0b; outline-offset:-2px; background:#fff7ed; }
.annotated-segments-table .mode-compare { font-weight:700; color:#334155; white-space:nowrap; }
.annotated-segments-table .normalized-candidate { font-variant-numeric: tabular-nums; }
.annotated-segments-table .estimated-corrected { font-variant-numeric: tabular-nums; }
.annotated-segments-table .guess-correct { background:#dcfce7; color:#14532d; font-weight:700; }
.annotated-segments-table .guess-incorrect { background:#fee2e2; color:#7f1d1d; font-weight:700; }
.annotated-segments-table .manual-depth-input { width:86px; padding:4px 6px; border:1px solid #cbd5e1; border-radius:6px; }
.annotated-segments-table .muted { color:#6b7280; text-align:center; }

.annotated-video-player {
  width: 100%;
  height: 100%;
  border: 6px solid #000; /* black video area like XAML */
  box-sizing: border-box;
  background: #000;
  object-fit: contain;
  display: block;
}

.annotated-placeholder { width:100%; height:100%; background:#000; border:6px solid #000; display:flex; align-items:center; justify-content:center; color:#fff; }

/* Overlay buttons shown on the video window */
.video-overlay { position:absolute; top:10px; right:10px; display:flex; gap:8px; z-index:30; }
.video-overlay .control-button { padding:8px 10px; }
.video-overlay .ghost-button { padding:8px 10px; background:#fff; color:#111; border-radius:6px; }

.annotated-placeholder {
  color: #475569;
  font-weight: 700;
}

.annotated-diagram-panel {
  overflow: hidden;
  background: #f8fafc;
}

.annotated-diagram-slot {
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  padding: 12px;
}

/* Make right column a vertical layout with header then full-height rightPanel */
.annotated-diagram-panel { display:flex; flex-direction:column; }
.annotated-diagram-header { flex: 0 0 auto; }
#annotatedDiagramSlot { flex: 1 1 auto; display:flex; gap:12px; }
#rightPanel { width: 100%; height: 100%; box-sizing:border-box; background: #fff; border-radius:6px; padding:12px; box-shadow: 0 1px 3px rgba(0,0,0,0.06); }

/* Ensure wellFrame and viewport fill the right panel */
#wellFrame { display:flex; flex-direction:column; height:100%; }
#viewport { flex:1 1 auto; height:100%; }

/* Larger, empty segments area to mimic DataGrid */
.annotated-segments { min-height:220px; }

/* Adjust title and metadata font sizing */
.annotated-diagram-title label { color:#111827; font-weight:600; }
.annotated-title-input { font-size:14px; }
.annotated-kicker { color:#f59e0b; }


.annotated-diagram-header {
  display:flex; align-items:center; justify-content:space-between; gap:12px; padding:12px 16px; background:#0b0b0d; border-bottom:1px solid rgba(255,255,255,0.04);
}
.annotated-diagram-title { display:flex; align-items:center; gap:8px; }
.annotated-diagram-title label { color:#d1d5db; font-weight:700; }
.annotated-title-input { padding:8px 10px; border-radius:6px; border:1px solid #2b2b2b; background:#0f1724; color:#f8fafc; min-width:320px; }
.annotated-diagram-actions { display:flex; gap:8px; }
.annotated-right-meta { padding:14px; display:flex; flex-direction:column; gap:8px; color:#e6eef6; }
.meta-row { display:flex; gap:8px; align-items:center; }
.meta-label { width:140px; color:#94a3b8; font-weight:700; }
.meta-input { flex:1; padding:8px 10px; border-radius:6px; border:1px solid #2b2b2b; background:#071128; color:#e6eef6; }

.annotated-diagram-slot #rightPanel {
  position: static;
  width: 100%;
  height: 100%;
}

.annotated-diagram-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #111;
}

.home-screen {
  min-height: 100vh;
  box-sizing: border-box;
  padding: 22px;
  background:
    linear-gradient(135deg, rgba(255,255,255,0.92), rgba(232,239,243,0.88)),
    repeating-linear-gradient(90deg, rgba(21,32,43,0.045) 0 1px, transparent 1px 48px),
    repeating-linear-gradient(0deg, rgba(21,32,43,0.035) 0 1px, transparent 1px 48px);
}

.home-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  max-width: 1160px;
  margin: 0 auto 42px auto;
}

.home-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 1.05rem;
}

.home-account {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  min-width: 0;
}

#homeAuthStatus {
  max-width: 180px;
  overflow-wrap: anywhere;
  font-size: 0.86rem;
}

.home-account button {
  flex-shrink: 0;
}

.home-signin-dialog {
  width: 360px;
  max-width: calc(100vw - 32px);
  box-sizing: border-box;
  border: 1px solid #b9c4cf;
  border-radius: 8px;
  padding: 24px;
  color: #15202b;
  background: #fff;
}

.home-signin-dialog::backdrop {
  background: rgba(0, 0, 0, 0.4);
}

.home-signin-dialog h2 {
  margin: 0 0 20px;
  font-size: 1.2rem;
}

.home-signin-dialog label {
  display: block;
  margin-bottom: 6px;
}

.home-signin-dialog input {
  width: 100%;
  box-sizing: border-box;
  margin-bottom: 16px;
  padding: 10px;
  border: 1px solid #b9c4cf;
  border-radius: 4px;
}

.home-signin-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.home-signin-error {
  color: #b91c1c;
  overflow-wrap: anywhere;
}

.app-back-to-home {
  position: fixed;
  left: 12px;
  top: 12px;
  z-index: 1200;
  background: #ffffffcc;
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}
.app-back-to-home:hover { background: #fff; }

.home-brand-mark {
  width: 24px;
  height: 24px;
  border-radius: 7px;
  background: linear-gradient(135deg, #17594a, #e2b45b);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.6);
}

.home-search-wrap {
  display: grid;
  grid-template-columns: auto minmax(240px, 360px);
  align-items: center;
  gap: 10px;
  color: #5d6874;
  font-size: 0.86rem;
}

.home-search-input {
  border: 1px solid #b9c4cf;
  border-radius: 8px;
  background: rgba(255,255,255,0.86);
  padding: 10px 12px;
  font-size: 0.95rem;
}

.home-landing,
.home-explorer {
  max-width: 1160px;
  margin: 0 auto;
}

.home-landing {
  display: grid;
  grid-template-columns: minmax(280px, 0.82fr) minmax(480px, 1.18fr);
  gap: 42px;
  align-items: start;
}

.home-kicker {
  margin: 0 0 12px 0;
  color: #17594a;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 0.78rem;
}

.home-hero-copy h1 {
  margin: 0;
  max-width: 460px;
  font-size: clamp(2rem, 5vw, 4.4rem);
  line-height: 0.98;
  letter-spacing: 0;
}

.home-summary {
  max-width: 440px;
  margin: 18px 0 0 0;
  color: #52606d;
  line-height: 1.6;
}

.home-credit {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 22px;
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(23, 89, 74, 0.14);
  box-shadow: 0 14px 28px rgba(18, 46, 39, 0.06);
}

.home-credit-logo {
  width: 94px;
  max-width: 34vw;
  height: auto;
  object-fit: contain;
  flex: 0 0 auto;
}

.home-credit p {
  margin: 0;
  color: #24453d;
  font-weight: 700;
  line-height: 1.45;
}

.home-menu-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

/* subtle swap animation when the menu cards change */
.home-menu-grid {
  transition: opacity 220ms ease, transform 220ms ease;
}
.home-menu-grid.swap-out { opacity: 0; transform: translateY(-8px) scale(0.995); }
.home-menu-grid.swap-in { opacity: 1; transform: translateY(0) scale(1); }

.home-menu-card { will-change: transform, opacity; transition: transform 180ms ease, box-shadow 180ms ease; }
.home-wells-choices {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 24px;
  padding: 24px;
}
.home-wells-choices .home-menu-card { min-height: 240px; }
.well-map-view { padding: 16px; }
.well-map-tools, .well-map-legend { display: flex; gap: 16px; flex-wrap: wrap; align-items: center; }
.well-map-tools label { display: flex; gap: 8px; align-items: center; }
.well-map-tools label[hidden] { display: none; }
.well-map-tools input, .well-map-tools select { padding: 8px; }
.well-search-results { overflow-x: auto; }
.well-search-spinner { display: inline-block; width: 12px; height: 12px; border: 2px solid #9ca3af; border-top-color: #22c55e; border-radius: 50%; animation: well-search-spin 0.8s linear infinite; }
@keyframes well-search-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .well-search-spinner { animation: none; } }
.well-search-results table { width: 100%; border-collapse: collapse; }
.well-search-results th, .well-search-results td { padding: 10px; border-bottom: 1px solid #374151; text-align: left; }
#wellSearchForm[hidden] { display: none; }
#wellSearchDetails details { margin: 12px 0; }
#wellSearchDetails summary { padding: 10px; cursor: pointer; font-weight: 600; }
#wellSearchDetails button[hidden] { display: none; }
#mapToolsCanvas button[hidden], #mapToolsMissing button[hidden] { display: none; }
.well-map-legend { margin: 12px 0; }
.well-map-legend span { display: flex; align-items: center; gap: 8px; }
.well-map-legend img, .well-map-marker {
  background: #17594a; border-radius: 8px; border: 2px solid #fff;
  box-shadow: 0 1px 5px #0005;
}
.well-map-legend img { width: 32px; height: 32px; object-fit: contain; }
.well-map-marker img { width: 100%; height: 100%; object-fit: contain; }
.well-map-name { font-weight: 700; font-size: 14px; color: #173f35; }
.well-map-dot { display: block; width: 14px; height: 14px; margin: 15px; border: 2px solid white; border-radius: 50%; background: #94a3b8; }
#wellMapCanvas, #mapToolsCanvas { height: min(65vh, 680px); min-height: 360px; border: 1px solid #cbd5e1; border-radius: 8px; }
#wellMapMissing details { padding: 8px; border-bottom: 1px solid #cbd5e1; }
.home-menu-card:hover { transform: translateY(-4px); }

.home-menu-card {
  min-height: 176px;
  text-align: left;
  border: 1px solid #c7d0d8;
  border-radius: 8px;
  background: rgba(255,255,255,0.82);
  color: #15202b;
  padding: 18px;
  cursor: pointer;
  box-shadow: 0 14px 34px rgba(42,58,73,0.08);
  display: grid;
  align-content: start;
  gap: 10px;
}

.home-menu-card:hover {
  border-color: #17594a;
  transform: translateY(-1px);
}

.home-menu-card.primary {
  background: #173f39;
  color: #fff;
  border-color: #173f39;
}

.home-menu-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: rgba(226,180,91,0.16);
  color: #9a6a14;
  font-weight: 900;
}

.home-menu-card.primary .home-menu-icon {
  background: rgba(255,255,255,0.16);
  color: #f6d48d;
}

.home-menu-title {
  font-size: 1.12rem;
  font-weight: 800;
}

.home-menu-copy {
  color: #5b6774;
  line-height: 1.45;
  font-size: 0.92rem;
}

.home-menu-card.primary .home-menu-copy {
  color: rgba(255,255,255,0.76);
}

.home-explorer {
  background: rgba(255,255,255,0.9);
  border: 1px solid #c7d0d8;
  border-radius: 8px;
  box-shadow: 0 18px 42px rgba(42,58,73,0.1);
  overflow: hidden;
}

.home-explorer-head {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  border-bottom: 1px solid #d6dee5;
  background: #f8fafb;
}

.home-explorer-head .home-explorer-right-actions {
  margin-left: auto;
  display: flex;
  gap: 10px;
  align-items: center;
}

.home-explorer-head .home-explorer-right-actions .control-button {
  padding: 8px 12px;
  font-size: 0.92rem;
}

.home-explorer-head h2,
.home-explorer-head p {
  margin: 0;
}

.home-explorer-head p {
  color: #66717c;
  font-size: 0.9rem;
}

.home-back-button {
  border: 1px solid #b9c4cf;
  border-radius: 7px;
  background: #fff;
  padding: 8px 12px;
  cursor: pointer;
}

.home-file-browser {
  padding: 8px;
  min-height: 420px;
}

/* Folder group children and collapse styles */
.home-folder-group > .home-folder-children {
  transition: max-height 180ms ease, opacity 160ms ease;
}
.home-folder-group.is-collapsed > .home-folder-children {
  display: none;
}
.home-folder-row { cursor: pointer; }
.home-folder-row .home-icon { display: inline-block; width: 22px; text-align: center; }

.home-folder-row,
.home-file-row {
  width: 100%;
  min-height: 34px;
  display: grid;
  grid-template-columns: 22px 1fr auto;
  align-items: center;
  gap: 8px;
  border: 0;
  border-radius: 6px;
  padding: 5px 10px;
  background: transparent;
  color: #182531;
  font-size: 0.94rem;
}

.home-folder-row {
  font-weight: 750;
}

.home-file-row {
  cursor: pointer;
  text-align: left;
}

.home-file-row:hover {
  background: #e8f0f2;
}

.home-file-row .home-file-name {
  font-weight: 600;
}

.home-file-meta {
  color: #6c7884;
  font-size: 0.82rem;
}

.level-1 { padding-left: 10px; }
.level-2 { padding-left: 34px; }
.level-3 { padding-left: 58px; color: #3d4b58; }
.home-file-row { padding-left: 82px; }

.home-icon {
  color: #17594a;
}

.home-empty {
  padding: 42px;
  color: #66717c;
  text-align: center;
}

.home-diagram-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 170px), 210px));
  gap: 16px;
  padding: 12px 16px;
}

#homePage[data-explorer-mode="wells"] .home-explorer-right-actions {
  display: none;
}

.home-wells-breadcrumb {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.home-wells-breadcrumb button {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #17594a;
  font: inherit;
  cursor: pointer;
}

.home-wells-breadcrumb button:hover,
.home-wells-breadcrumb button:focus-visible {
  text-decoration: underline;
}

.home-breadcrumb-separator {
  color: #66717c;
  font-weight: 400;
}

.home-wells-folder {
  display: flex;
  align-items: center;
  width: 100%;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
}

.home-file-row.home-diagram-tile {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  min-width: 0;
  padding: 10px;
  border: 1px solid #b9c4cf;
  border-radius: 6px;
  background: #fff;
  color: #15202b;
  text-align: left;
}

.home-diagram-tile:hover,
.home-diagram-tile:focus-visible {
  border-color: #17594a;
  box-shadow: 0 0 0 1px #17594a;
}

.home-diagram-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 3 / 4;
  background: #f3f6f8;
  overflow: hidden;
}

.home-diagram-preview img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.home-diagram-placeholder {
  font-size: 40px;
  color: #66717c;
}

.home-diagram-title {
  font-size: 0.9rem;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.home-diagram-date {
  font-size: 0.76rem;
  line-height: 1.4;
  color: #5d6874;
  overflow-wrap: anywhere;
}

.home-upload-tile {
  border-style: dashed !important;
}

.home-upload-tile.is-dragging {
  border-color: #17594a;
  background: #e6f1eb;
}

.home-upload-plus {
  font-size: 64px;
  font-weight: 300;
  color: #17594a;
}

.home-document-filename {
  overflow-wrap: anywhere;
}

.home-document-status {
  margin: 8px 16px;
  color: #5d6874;
}

.home-pdf-viewer {
  width: min(1100px, calc(100vw - 32px));
  height: calc(100dvh - 32px);
  max-width: calc(100vw - 32px);
  max-height: calc(100dvh - 32px);
  padding: 0;
  border: 1px solid #b9c4cf;
  border-radius: 6px;
  background: #f3f6f8;
  color: #15202b;
  box-sizing: border-box;
}

.home-pdf-viewer[open] {
  display: flex;
  flex-direction: column;
}

.home-pdf-viewer::backdrop {
  background: rgba(0, 0, 0, 0.45);
}

.home-pdf-header,
.home-pdf-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: #fff;
  border-bottom: 1px solid #b9c4cf;
}

.home-pdf-header h2 {
  flex: 1;
  min-width: 0;
  margin: 0;
  font-size: 1rem;
  overflow-wrap: anywhere;
}

.home-pdf-toolbar {
  flex-wrap: wrap;
}

.home-pdf-toolbar input {
  width: 64px;
}

.home-pdf-toolbar select,
.home-pdf-toolbar input {
  padding: 6px;
  border: 1px solid #b9c4cf;
  border-radius: 4px;
  background: #fff;
}

.home-pdf-status {
  margin: 0;
  padding: 8px 16px;
  overflow-wrap: anywhere;
}

.home-pdf-status:empty {
  display: none;
}

.home-pdf-pages {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 20px;
}

.home-pdf-pages canvas {
  display: block;
  margin: 0 auto;
  background: #fff;
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.18);
}

.home-pdf-workspace {
  display: flex;
  flex: 1;
  min-height: 0;
}

.home-pdf-left {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  min-height: 0;
}

.home-pdf-viewer.pump-entry-mode {
  width: min(1500px, calc(100vw - 32px));
  container-type: inline-size;
}

.home-pump-sidebar[hidden],
.home-pump-complete[hidden] {
  display: none;
}

.home-pump-sidebar {
  flex: 0 0 46%;
  min-width: 280px;
  overflow: auto;
  padding: 16px;
  box-sizing: border-box;
  border-left: 1px solid #b9c4cf;
  background: #fff;
}

.home-pump-sidebar h2 {
  font-size: 1.1rem;
  margin: 0 0 16px;
}

.home-pump-section {
  padding-bottom: 16px;
  margin-bottom: 16px;
  border-bottom: 1px solid #d8dee8;
}

.home-pump-section h3 {
  margin: 0 0 10px;
  font-size: 0.95rem;
}

.home-pump-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.home-pump-fields label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 0.8rem;
  min-width: 0;
}

.home-pump-field-wide {
  grid-column: 1 / -1;
}

.home-pump-fields input,
.home-pump-fields select,
.home-pump-table input {
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
  padding: 7px;
  border: 1px solid #b9c4cf;
  border-radius: 4px;
}

.home-pump-table-wrap {
  overflow-x: auto;
}

.home-pump-table {
  border-collapse: collapse;
  width: 100%;
  min-width: 560px;
  font-size: 0.75rem;
}

.home-pump-table th,
.home-pump-table td {
  padding: 5px;
  text-align: left;
}

.home-pump-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.home-pump-complete {
  color: #166534;
  font-size: 0.76rem;
  font-weight: 600;
}

.home-operating-record-dialog {
  width: min(1500px, calc(100vw - 24px));
  max-width: none;
  max-height: calc(100vh - 24px);
  margin: auto;
  padding: 0;
  border: 1px solid #b9c4cf;
  border-radius: 8px;
  color: #15202b;
  background: #fff;
}

.home-operating-record-dialog::backdrop {
  background: rgba(15, 23, 42, 0.45);
}

.home-operating-record-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid #d8dee8;
}

.home-operating-record-header h2 {
  margin: 0;
  font-size: 1.1rem;
}

.home-operating-record-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.home-operating-record-content {
  max-height: calc(100vh - 88px);
  overflow: auto;
  padding: 16px;
}

.home-operating-record-fields {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.home-operating-record-fields label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  color: #334155;
  font-size: 0.78rem;
}

.home-operating-field-span-2 {
  grid-column: span 2;
}

.home-operating-record-fields input,
.home-operating-record-fields select,
.home-operating-record-fields textarea {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  padding: 7px;
  border: 1px solid #b9c4cf;
  border-radius: 4px;
  color: #15202b;
  background: #fff;
  font: inherit;
}

.home-operating-unit-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 76px;
  gap: 6px;
}

.home-operating-record-status {
  min-height: 1.2em;
}

.home-operating-history {
  margin-top: 18px;
}

.home-operating-history h3 {
  margin: 0 0 8px;
  font-size: 0.95rem;
}

.home-operating-record-table-wrap {
  max-height: 42vh;
  overflow: auto;
  border: 1px solid #d8dee8;
}

.home-operating-record-table {
  width: max-content;
  min-width: 100%;
  border-collapse: collapse;
  font-size: 0.76rem;
  font-variant-numeric: tabular-nums;
}

.home-operating-record-table th,
.home-operating-record-table td {
  padding: 6px 8px;
  border-bottom: 1px solid #e5eaf0;
  text-align: left;
  white-space: nowrap;
}

.home-operating-record-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f1f5f8;
}

.home-operating-record-table .home-operating-record-notes {
  min-width: 200px;
  max-width: 320px;
  white-space: normal;
}

.home-operating-history-empty {
  margin: 0;
  padding: 12px;
  color: #64748b;
}

.home-pump-context-menu {
  position: fixed;
  z-index: 20000;
  padding: 4px;
  border: 1px solid #b9c4cf;
  border-radius: 4px;
  background: #fff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.home-pump-context-menu[hidden] {
  display: none;
}

.home-pump-context-menu button {
  border: 0;
  background: #fff;
  padding: 8px 12px;
  cursor: pointer;
}

@media (max-width: 850px) {
  .pump-entry-mode .home-pdf-workspace {
    flex-direction: column;
  }
  .pump-entry-mode .home-pdf-left {
    flex: 0 0 45%;
  }
  .home-pump-sidebar {
    flex: 1;
    min-width: 0;
    border-left: 0;
    border-top: 1px solid #b9c4cf;
  }
  .home-operating-record-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@container (max-width: 850px) {
  .pump-entry-mode .home-pdf-workspace {
    flex-direction: column;
  }
  .pump-entry-mode .home-pdf-left {
    flex: 0 0 45%;
  }
  .home-pump-sidebar {
    flex: 1;
    min-width: 0;
    border-left: 0;
    border-top: 1px solid #b9c4cf;
  }
  .home-operating-record-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 520px) {
  .home-operating-record-fields { grid-template-columns: minmax(0, 1fr); }
  .home-operating-field-span-2 { grid-column: auto; }
}

.home-signin-dialog select {
  width: 100%;
  box-sizing: border-box;
  padding: 10px;
  margin-bottom: 16px;
  border: 1px solid #b9c4cf;
  border-radius: 4px;
  background: #fff;
}

@media (max-width: 860px) {
  .home-topbar,
  .home-landing {
    grid-template-columns: 1fr;
  }

  .home-topbar {
    align-items: stretch;
    flex-wrap: wrap;
  }

  .home-search-wrap {
    flex: 1 1 100%;
    min-width: 0;
    order: 3;
  }

  .home-account {
    margin-left: auto;
  }

  .home-search-wrap,
  .home-menu-grid {
    grid-template-columns: 1fr;
  }
}

#app {
  display: flex;
  height: 100vh;
}

#app.diagram-view-only {
  flex-direction: column;
}

#diagramViewToolbar[hidden] {
  display: none;
}

.diagram-view-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  flex: 0 0 auto;
  padding: 10px 20px;
  border-bottom: 1px solid #d8dee8;
  background: #fff;
}

.diagram-viewer-focus {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.diagram-viewer-focus label {
  display: flex;
  align-items: center;
  gap: 6px;
}
.diagram-viewer-focus input {
  width: 90px;
  padding: 6px;
}
#diagramViewerFocus[hidden],
#diagramViewerFocusedWell[hidden] {
  display: none;
}

#wellDataDateRail .diagram-viewer-focus {
  padding: 12px;
  border-bottom: 1px solid #d8dee8;
}

#app.diagram-view-only #controls,
#app.diagram-view-only #ocrControls {
  display: none;
}

#app.diagram-view-only #rightPanel {
  flex: 1;
  min-height: 0;
  width: 100%;
  height: auto;
}

#app.diagram-view-only #viewport {
  pointer-events: none;
}

#app.well-data-view-active {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr) auto;
  overflow: hidden;
}

#app.well-data-view-active #diagramViewToolbar {
  display: none;
}

#app.well-data-view-active #rightPanel {
  grid-column: 2;
  grid-row: 1;
  flex: none;
  width: auto;
  min-width: 0;
  min-height: 0;
  height: 100%;
}

#app.well-data-view-active #wellDataDateRail {
  grid-column: 1;
  grid-row: 1;
}

#app.well-data-view-active #mostRecentLabelTabs {
  grid-column: 1 / -1;
  grid-row: 2;
}

.home-well-data-dialog {
  display: flex;
  flex: 0 0 min(380px, 36vw);
  flex-direction: column;
  gap: 12px;
  width: min(380px, 36vw);
  min-width: 300px;
  height: 100%;
  min-height: 0;
  box-sizing: border-box;
  padding: 12px;
  overflow: auto;
  border-right: 1px solid #d8dee8;
  background: #fff;
}

.home-well-data-dialog[hidden] {
  display: none;
}

#app.well-data-view-active {
  display: grid;
  grid-template-columns: minmax(230px, 270px) minmax(0, 1fr) minmax(300px, 350px);
  grid-template-rows: minmax(0, 1fr) auto auto;
  gap: 0;
}

#app.well-data-view-active #wellDataDateRail {
  grid-column: 1;
  grid-row: 1;
  width: auto;
  min-width: 0;
  flex: none;
}

#app.well-data-view-active #rightPanel {
  grid-column: 2;
  grid-row: 1;
  width: auto;
  height: 100%;
  min-width: 0;
  min-height: 0;
}

#app.well-data-view-active #wellDataRecordsPanel {
  display: flex;
  grid-column: 3;
  grid-row: 1;
}

#app.well-data-view-active #wellDataRecordsPanel[hidden] {
  display: none;
}

#app.well-data-view-active #wellDataTimeline {
  display: flex;
  grid-column: 1 / -1;
  grid-row: 3;
}

#app.well-data-view-active #wellDataTimeline[hidden] {
  display: none;
}

#app.well-data-view-active #mostRecentLabelTabs {
  grid-column: 1 / -1;
  grid-row: 2;
}

.home-well-data-pump-specs,
.home-well-data-pump-curve {
  min-width: 0;
}

.home-well-data-pump-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 5px;
  margin: 0;
}

.home-well-data-pump-grid > div {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 5px 0;
  border-bottom: 1px solid #e7edf1;
}

.home-well-data-pump-grid dt {
  color: #64748b;
  font-size: 0.76rem;
}

.home-well-data-pump-grid dd {
  margin: 0;
  text-align: right;
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
}

.home-well-data-pump-table {
  width: 100%;
  margin-top: 10px;
  border-collapse: collapse;
  font-size: 0.7rem;
  font-variant-numeric: tabular-nums;
}

.home-well-data-pump-table th,
.home-well-data-pump-table td {
  padding: 4px 3px;
  border-bottom: 1px solid #e7edf1;
  text-align: right;
}

.home-well-data-pump-table th:first-child,
.home-well-data-pump-table td:first-child { text-align: left; }

.home-well-data-records-panel {
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  min-height: 0;
  padding: 12px;
  overflow: auto;
  border-left: 1px solid #d8dee8;
  background: #fff;
}

.home-well-data-record-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.home-well-data-record-header h2 { margin: 0; font-size: 1rem; }
.home-well-data-record-header span { color: #64748b; font-size: 0.78rem; }

.home-well-data-timeline {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  padding: 8px 12px;
  border-top: 1px solid #d8dee8;
  background: #fff;
}

.home-well-data-timeline[hidden] { display: none; }

.home-well-data-timeline-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.home-well-data-timeline-header h2 { margin: 0; font-size: 0.88rem; }
.home-well-data-play-controls { display: flex; align-items: center; gap: 8px; }
#wellDataOpenAnnotated[hidden] { display: none !important; }
#wellDataPlayStatus { color: #64748b; font-size: 0.74rem; }

#wellDataDates {
  flex-direction: row;
  max-height: none;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 3px;
}

#wellDataDates .home-well-data-date {
  flex: 0 0 132px;
  min-height: 44px;
}

@media (max-width: 1050px) {
  #app.well-data-view-active {
    grid-template-columns: minmax(210px, 250px) minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) minmax(220px, 32vh) auto auto;
  }
  #app.well-data-view-active #wellDataRecordsPanel { grid-column: 1 / -1; grid-row: 2; }
  #app.well-data-view-active #mostRecentLabelTabs { grid-column: 1 / -1; grid-row: 3; }
  #app.well-data-view-active #wellDataTimeline { grid-column: 1 / -1; grid-row: 4; }
}

@media (max-width: 600px) {
  #app.well-data-view-active {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(180px, 28vh) minmax(320px, 1fr) minmax(220px, 30vh) auto auto;
    overflow: auto;
  }
  #app.well-data-view-active #wellDataDateRail { grid-column: 1; grid-row: 1; }
  #app.well-data-view-active #rightPanel { grid-column: 1; grid-row: 2; }
  #app.well-data-view-active #wellDataRecordsPanel { grid-column: 1; grid-row: 3; }
  #app.well-data-view-active #mostRecentLabelTabs { grid-column: 1; grid-row: 4; }
  #app.well-data-view-active #wellDataTimeline { grid-column: 1; grid-row: 5; }
}

.home-well-data-layout,
.home-well-data-main {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
}

.home-well-data-date-rail h3,
.home-well-data-trend-header h3 {
  margin: 0;
  font-size: 0.9rem;
}

#wellDataDates {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 168px;
  overflow: auto;
}

.home-well-data-date {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  padding: 7px 9px;
  border: 1px solid #d8dee8;
  border-radius: 4px;
  color: #243342;
  background: #fff;
  text-align: left;
  cursor: pointer;
}

.home-well-data-date[aria-current="true"] {
  border-color: #167a68;
  background: #eaf4f1;
}

.home-well-data-date small {
  color: #64748b;
  font-size: 0.72rem;
}

.home-well-data-record-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.home-well-data-stat {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  min-width: 0;
  padding: 7px 8px;
  border: 1px solid #e0e6eb;
  border-radius: 4px;
  background: #f9fbfc;
  text-align: left;
}

button.home-well-data-stat {
  width: 100%;
  color: inherit;
  cursor: pointer;
}

button.home-well-data-stat[aria-pressed="true"] {
  border-color: #167a68;
  background: #eaf4f1;
}

.home-well-data-stat span {
  color: #64748b;
  font-size: 0.7rem;
}

.home-well-data-stat strong {
  overflow-wrap: anywhere;
  font-size: 0.9rem;
  font-weight: 600;
}

.home-well-data-notes,
.home-well-data-empty,
.home-well-data-chart-empty {
  margin: 0;
  color: #53616e;
  font-size: 0.8rem;
  overflow-wrap: anywhere;
}

.home-well-data-trend-header {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.home-well-data-trend-header label {
  color: #64748b;
  font-size: 0.75rem;
}

.home-well-data-trend-header select {
  min-width: 0;
  padding: 5px 7px;
  border: 1px solid #b9c4cf;
  border-radius: 4px;
  background: #fff;
}

.home-well-data-chart-wrap {
  overflow: hidden;
}

.home-well-data-chart-wrap svg {
  display: block;
  width: 100%;
  height: auto;
}

#most-recent-pump.well-data-pump-running rect:nth-of-type(n+3) {
  animation: well-data-pump-glow 1.5s ease-in-out infinite alternate;
}

#most-recent-pump.well-data-pump-running .well-data-pump-stripe-cutouts {
  transform-box: view-box;
  transform-origin: 0 0;
  animation: well-data-stripes-up 0.12s linear infinite;
}

@keyframes well-data-pump-glow {
  from { filter: drop-shadow(0 0 1px rgba(37, 99, 235, 0.35)); }
  to { filter: drop-shadow(0 0 5px rgba(37, 99, 235, 0.9)); }
}

#annotated-camera-position {
  animation: annotated-camera-glow 1.5s ease-in-out infinite alternate;
}

@keyframes annotated-camera-glow {
  from { filter: drop-shadow(0 0 2px rgba(245, 158, 11, 0.75)) drop-shadow(0 0 4px rgba(245, 158, 11, 0.4)); }
  to { filter: drop-shadow(0 0 4px rgba(245, 158, 11, 1)) drop-shadow(0 0 9px rgba(245, 158, 11, 0.85)); }
}

@keyframes well-data-stripes-up {
  to { transform: translateY(-20px); }
}

@media (prefers-reduced-motion: reduce) {
  #annotated-camera-position { animation: none; filter: drop-shadow(0 0 3px rgba(245, 158, 11, 1)) drop-shadow(0 0 7px rgba(245, 158, 11, 0.75)); }
  #most-recent-pump.well-data-pump-running rect { animation: none; filter: drop-shadow(0 0 3px rgba(37, 99, 235, 0.7)); }
  #most-recent-pump.well-data-pump-running .well-data-pump-stripe-cutouts { animation: none; }
}

@media (max-width: 760px) {
  #app.well-data-view-active {
    grid-template-columns: minmax(220px, 34vw) minmax(320px, 1fr);
  }
  .home-well-data-dialog {
    flex-basis: 290px;
    width: 290px;
    min-width: 260px;
    padding: 8px;
  }
  .home-well-data-record-grid { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  #app.well-data-view-active {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(180px, 30vh) minmax(0, 1fr) auto;
  }
  #app.well-data-view-active #wellDataDateRail { grid-column: 1; grid-row: 1; }
  #app.well-data-view-active #rightPanel { grid-column: 1; grid-row: 2; }
  #app.well-data-view-active #mostRecentLabelTabs { grid-column: 1; grid-row: 3; }
}

#app.well-data-view-active {
  display: grid;
  grid-template-columns: minmax(230px, 270px) minmax(0, 1fr) minmax(300px, 350px);
  grid-template-rows: minmax(0, 1fr) auto auto;
  gap: 0;
  align-items: stretch;
  overflow: hidden;
}

#app.well-data-view-active #rightPanel {
  grid-column: 2;
  grid-row: 1;
  flex: none;
  width: auto;
  min-width: 0;
  min-height: 0;
  height: 100%;
}

#app.well-data-view-active #wellDataDateRail { grid-column: 1; grid-row: 1; width: auto; min-width: 0; flex: none; }
#app.well-data-view-active #wellDataRecordsPanel { display: flex; grid-column: 3; grid-row: 1; }
#app.well-data-view-active #wellDataRecordsPanel[hidden] { display: none; }
#app.well-data-view-active #wellDataTimeline { display: flex; grid-column: 1 / -1; grid-row: 3; }
#app.well-data-view-active #wellDataTimeline[hidden] { display: none; }
#app.well-data-view-active #mostRecentLabelTabs { grid-column: 1 / -1; grid-row: 2; }

@media (max-width: 1050px) {
  #app.well-data-view-active {
    grid-template-columns: minmax(210px, 250px) minmax(0, 1fr);
    grid-template-rows: minmax(0, 1fr) minmax(220px, 32vh) auto auto;
  }
  #app.well-data-view-active #wellDataRecordsPanel { grid-column: 1 / -1; grid-row: 2; }
  #app.well-data-view-active #mostRecentLabelTabs { grid-column: 1 / -1; grid-row: 3; }
  #app.well-data-view-active #wellDataTimeline { grid-column: 1 / -1; grid-row: 4; }
}

@media (max-width: 600px) {
  #app.well-data-view-active {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(180px, 28vh) minmax(320px, 1fr) minmax(220px, 30vh) auto auto;
    overflow: auto;
  }
  #app.well-data-view-active #wellDataDateRail { grid-column: 1; grid-row: 1; }
  #app.well-data-view-active #rightPanel { grid-column: 1; grid-row: 2; }
  #app.well-data-view-active #wellDataRecordsPanel { grid-column: 1; grid-row: 3; }
  #app.well-data-view-active #mostRecentLabelTabs { grid-column: 1; grid-row: 4; }
  #app.well-data-view-active #wellDataTimeline { grid-column: 1; grid-row: 5; }
}

.home-well-data-dialog {
  display: flex;
  flex: 0 0 min(380px, 36vw);
  flex-direction: column;
  gap: 12px;
  width: min(380px, 36vw);
  min-width: 300px;
  height: 100%;
  min-height: 0;
  box-sizing: border-box;
  padding: 12px;
  overflow: auto;
  border-right: 1px solid #d8dee8;
  background: #fff;
}

.home-well-data-dialog[hidden] {
  display: none;
}

.home-well-data-layout,
.home-well-data-main {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
}

.home-well-data-date-rail h3,
.home-well-data-trend-header h3 {
  margin: 0;
  font-size: 0.9rem;
}

#wellDataDates {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 168px;
  overflow: auto;
}

#app.well-data-view-active #wellDataDates {
  flex-direction: row;
  max-height: none;
  overflow-x: auto;
  overflow-y: hidden;
}

#app.well-data-view-active #wellDataDates .home-well-data-date {
  flex: 0 0 132px;
  min-height: 44px;
}

.home-well-data-date {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  width: 100%;
  padding: 7px 9px;
  border: 1px solid #d8dee8;
  border-radius: 4px;
  color: #243342;
  background: #fff;
  text-align: left;
  cursor: pointer;
}

.home-well-data-date[aria-current="true"] {
  border-color: #167a68;
  background: #eaf4f1;
}

.home-well-data-date small {
  color: #64748b;
  font-size: 0.72rem;
}

.home-well-data-record-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.home-well-data-stat {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  min-width: 0;
  padding: 7px 8px;
  border: 1px solid #e0e6eb;
  border-radius: 4px;
  background: #f9fbfc;
  text-align: left;
}

button.home-well-data-stat {
  width: 100%;
  color: inherit;
  cursor: pointer;
}

button.home-well-data-stat[aria-pressed="true"] {
  border-color: #167a68;
  background: #eaf4f1;
}

.home-well-data-stat span {
  color: #64748b;
  font-size: 0.7rem;
}

.home-well-data-stat strong {
  overflow-wrap: anywhere;
  font-size: 0.9rem;
  font-weight: 600;
}

.home-well-data-notes,
.home-well-data-empty,
.home-well-data-chart-empty {
  margin: 0;
  color: #53616e;
  font-size: 0.8rem;
  overflow-wrap: anywhere;
}

.home-well-data-trend {
  min-height: 0;
}

.home-well-data-trend-header {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.home-well-data-trend-header label {
  color: #64748b;
  font-size: 0.75rem;
}

.home-well-data-trend-header select {
  min-width: 0;
  padding: 5px 7px;
  border: 1px solid #b9c4cf;
  border-radius: 4px;
  background: #fff;
}

.home-well-data-chart-wrap {
  overflow: hidden;
}

.home-well-data-chart-wrap svg {
  display: block;
  width: 100%;
  height: auto;
}

#most-recent-pump.well-data-pump-running rect:nth-of-type(n+3) {
  animation: well-data-pump-glow 1.5s ease-in-out infinite alternate;
}

@keyframes well-data-pump-glow {
  from { filter: drop-shadow(0 0 1px rgba(37, 99, 235, 0.35)); }
  to { filter: drop-shadow(0 0 5px rgba(37, 99, 235, 0.9)); }
}

@media (prefers-reduced-motion: reduce) {
  #most-recent-pump.well-data-pump-running rect { animation: none; filter: drop-shadow(0 0 3px rgba(37, 99, 235, 0.7)); }
}

@media (max-width: 760px) {
  .home-well-data-dialog {
    flex-basis: 290px;
    width: 290px;
    min-width: 260px;
    padding: 8px;
  }
  .home-well-data-record-grid { grid-template-columns: 1fr; }
}

.most-recent-label-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 10px 16px;
  border-top: 1px solid #d8dee8;
  background: #fff;
  order: 2;
}

.most-recent-label-controls[hidden] {
  display: none;
}

.most-recent-label-tabs {
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

.most-recent-label-tabs[hidden],
.most-recent-pump-toggle[hidden] {
  display: none;
}

.most-recent-label-tabs button,
#annotatedHistoricStatic,
#annotatedHistoricDynamic {
  border: 1px solid #b9c4cf;
  border-radius: 4px;
  padding: 8px 12px;
  background: #fff;
  color: #15202b;
  cursor: pointer;
}

.most-recent-label-tabs button[aria-selected="true"],
#annotatedHistoricStatic[aria-pressed="true"],
#annotatedHistoricDynamic[aria-pressed="true"] {
  background: #17594a;
  border-color: #17594a;
  color: #fff;
}
#annotatedHistoricStatic:disabled,
#annotatedHistoricDynamic:disabled { cursor: not-allowed; opacity: 0.45; }

.well-data-water-modes {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-left: 8px;
  border-left: 1px solid #d8dee8;
}

.well-data-water-modes[hidden] { display: none; }

.well-data-water-modes button {
  min-width: 72px;
  padding: 8px 12px;
  border: 1px solid #b9c4cf;
  border-radius: 4px;
  background: #fff;
  color: #15202b;
  cursor: pointer;
}

.well-data-water-modes button[aria-pressed="true"] {
  border-color: #167a68;
  background: #167a68;
  color: #fff;
}

.well-data-water-modes button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.most-recent-pump-toggle {
  border: 1px solid #b9c4cf;
  border-radius: 4px;
  padding: 8px 12px;
  background: #fff;
  color: #15202b;
  cursor: pointer;
}

.most-recent-pump-toggle:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

#app.annotated-survey-mode {
  display: none;
  min-height: 100vh;
  background: #111;
}

#app.annotated-survey-mode #controls {
  display: none;
}

/* LEFT PANEL */
.controls-shell {
  width: 300px;
  background: #f4f4f4;
  border-right: 1px solid #ccc;
  padding: 20px 16px;
  box-sizing: border-box;
  overflow-y: auto;
  flex-direction: column;
  gap: 16px;
}

.controls-title {
  margin: 0;
  font-size: 1.1rem;
}

.diagram-tab {
  border: 1px solid #bfc8d6;
  background: #fff;
    padding: 0;
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 0.95rem;
  cursor: pointer;
}

.diagram-tab.is-active {
  background: #1f2937;
  color: #fff;
  border-color: #1f2937;
}

.diagram-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: #fff;
  border: 1px solid #d8dee8;
  border-radius: 12px;
  padding: 16px;
}

.diagram-panel-host {
  min-height: 0;
}

.diagram-panel-title {
  margin: 0;
  font-size: 1rem;
}

.diagram-panel-copy {
  margin: 0;
  color: #4b5563;
  font-size: 0.9rem;
  line-height: 1.4;
}

.control-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.control-label {
  font-size: 0.9rem;
  color: #374151;
}

.control-hint {
  font-size: 0.8rem;
  color: #6b7280;
  line-height: 1.35;
}

.control-input {
  border: 1px solid #c6cfdb;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 0.95rem;
  background: #fbfcff;
  width: 100%;
  box-sizing: border-box;
}

textarea.control-input {
  resize: vertical;
  min-height: 110px;
}

select.control-input {
  appearance: none;
}

.checkbox-row {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.checkbox-row input {
  width: 16px;
  height: 16px;
  margin: 0;
}

.checkbox-group {
  margin: 0;
  padding: 0;
  border: 0;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.control-button,
.ghost-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  border-radius: 10px;
  padding: 8px 12px;
  line-height: 1.2;
  background: transparent;
.annotated-media-row { display:flex; align-items:center; gap:16px; margin-top:12px; }
.media-btn { background:transparent; color:#111; border:0; padding:6px 8px; font-size:20px; cursor:pointer; }
.media-btn:hover { opacity:0.8; }
.annotated-media-meta { margin-left:auto; color:#374151; font-weight:600; }
.annotated-segments { background:#f3f4f6; border:1px solid #d1d5db; padding:8px; border-radius:3px; margin-top:14px; }
.annotated-segments-title { font-weight:700; margin-bottom:6px; color:#111827; }
.annotated-segments-table { width:100%; border-collapse:collapse; font-size:0.95rem; background:#fff; }
.annotated-segments-table th, .annotated-segments-table td { padding:6px 8px; border-bottom:1px solid #e5e7eb; text-align:left; }
.annotated-segments-table thead { background:#fff; }
.annotated-segments-table .muted { color:#6b7280; text-align:center; }
}

.control-button {
  border: 1px solid #111827;
  background: #111827;
  color: #fff;
}

.completion-ocr-panel {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid #d8dee8;
  background: #fff;
}

.completion-ocr-status {
  color: #374151;
  font-size: 0.82rem;
}

.completion-ocr-status.is-processing {
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.completion-ocr-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid #cbd5e1;
  border-top-color: #111827;
  border-radius: 50%;
  animation: completion-ocr-spin 0.8s linear infinite;
}

.completion-ocr-elapsed {
  color: #6b7280;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

@keyframes completion-ocr-spin {
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .completion-ocr-spinner { animation: none; }
}

.completion-ocr-review {
  display: grid;
  border-top: 1px solid #e5e7eb;
}

.completion-ocr-table-title {
  margin: 14px 0 2px;
  color: #111827;
  font-size: 0.88rem;
}

.completion-ocr-field {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 9px 0;
  border-bottom: 1px solid #e5e7eb;
}

.completion-ocr-field-details {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.completion-ocr-field-details span {
  overflow-wrap: anywhere;
}

.completion-ocr-field-details small {
  color: #6b7280;
}

.ghost-button {
  border: 1px solid #c6cfdb;
  background: #fff;
  color: #111827;
}

.danger-button {
  border-color: #7f1d1d;
  background: #7f1d1d;
}

.small-button {
  padding: 8px 10px;
  font-size: 0.8rem;
}

.form-section {
  border: 1px solid #d8dee8;
  border-radius: 12px;
  background: #f8fafc;
  overflow: hidden;
}

.form-section-summary {
  list-style: none;
  cursor: pointer;
  padding: 14px 16px;
  background: #eef2f7;
  border-bottom: 1px solid transparent;
}

.form-section[open] .form-section-summary {
  border-bottom-color: #d8dee8;
}

.form-section-summary::-webkit-details-marker {
  display: none;
}

.form-section-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: #111827;
}

.form-section-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px;
}

.form-section-copy {
  margin: 0;
  font-size: 0.88rem;
  color: #4b5563;
}

.feature-group {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-top: 4px;
  border-top: 1px solid #e5e7eb;
}

.feature-group:first-child {
  border-top: 0;
  padding-top: 0;
}

.feature-group-title {
  margin: 0;
  font-size: 0.92rem;
  color: #111827;
}

.range-field {
  display: flex;
  align-items: center;
  gap: 10px;
}

.range-field input[type="range"] {
  width: 100%;
}

.range-output,
.turbid-zone-value {
  min-width: 42px;
  font-size: 0.85rem;
  color: #4b5563;
}

.video-sync-player {
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: 210px;
  background: #020617;
  border: 1px solid #c6cfdb;
  border-radius: 10px;
}

.video-sync-floating-preview {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 50;
  width: min(520px, calc(100vw - 360px));
  min-width: 320px;
  max-width: calc(100vw - 48px);
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  overflow: auto;
  resize: both;
  background: rgba(248, 250, 252, 0.98);
  border: 1px solid #94a3b8;
  border-radius: 14px;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.28);
}

.video-sync-annotation-workspace {
  position: fixed;
  left: 320px;
  top: 18px;
  bottom: 18px;
  z-index: 60;
  width: min(720px, calc(100vw - 350px));
  min-width: 520px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
  overflow: auto;
  resize: horizontal;
  background: rgba(248, 250, 252, 0.99);
  border: 1px solid #94a3b8;
  border-radius: 16px;
  box-shadow: 0 22px 60px rgba(15, 23, 42, 0.32);
}

#app.annotated-survey-mode ~ .video-sync-annotation-workspace {
  left: 0;
  top: 0;
  bottom: 0;
  z-index: 60;
  width: 50vw;
  min-width: 0;
  max-width: none;
  gap: 8px;
  padding: 0;
  overflow: auto;
  resize: none;
  background: #fff;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

#app.annotated-survey-mode ~ .video-sync-annotation-workspace .video-sync-floating-header {
  padding: 8px 10px;
  border-bottom: 1px solid #d8dee8;
}

#app.annotated-survey-mode ~ .video-sync-annotation-workspace .video-annotation-content {
  min-height: calc(100vh - 50px);
  padding: 0 10px 10px;
  box-sizing: border-box;
}

#app.annotated-survey-mode ~ .video-sync-annotation-workspace .video-ocr-stage {
  border-radius: 0;
}

#app.annotated-survey-mode ~ .video-sync-annotation-workspace .video-sync-annotation-player {
  max-height: 62vh;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.video-sync-floating-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.video-sync-floating-title {
  font-size: 0.92rem;
  color: #111827;
}

.video-sync-floating-player {
  width: 100%;
  max-height: min(52vh, 380px);
  background: #020617;
  border: 1px solid #c6cfdb;
  border-radius: 10px;
}

.video-annotation-content {
  display: flex;
  flex-direction: column;
  min-height: 0;
  gap: 12px;
}

.video-annotation-video-column {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.video-ocr-selector {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.video-ocr-stage {
  position: relative;
  width: 100%;
  background: #000;
  border-radius: 12px;
}

.video-sync-annotation-player {
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: 360px;
  object-fit: contain;
  background: #000;
  border: 8px solid #fff;
  border-radius: 12px;
  box-shadow: inset 0 0 0 1px #c6cfdb;
}

.video-ocr-crop-overlay {
  position: absolute;
  left: 8px;
  top: 8px;
  width: calc(100% - 16px);
  height: calc(100% - 16px);
  z-index: 2;
  border-radius: 8px;
  cursor: crosshair;
}

.video-ocr-crop-overlay::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 8px;
  box-shadow: inset 0 0 0 9999px rgba(2, 6, 23, 0.18);
  pointer-events: none;
}

.video-ocr-crop-box {
  position: absolute;
  min-width: 24px;
  min-height: 18px;
  border: 2px solid #facc15;
  border-radius: 8px;
  background: rgba(250, 204, 21, 0.1);
  box-shadow: 0 0 0 9999px rgba(2, 6, 23, 0.28), 0 0 0 2px rgba(2, 6, 23, 0.22);
  cursor: move;
  touch-action: none;
}

.video-ocr-crop-label {
  position: absolute;
  left: -2px;
  top: -23px;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(17, 24, 39, 0.74);
  color: #fef3c7;
  font-size: 0.64rem;
  font-weight: 800;
  pointer-events: none;
}

.video-ocr-handle {
  position: absolute;
  width: 13px;
  height: 13px;
  background: #facc15;
  border: 2px solid #111827;
  border-radius: 999px;
}

.video-ocr-handle-nw { left: -8px; top: -8px; cursor: nwse-resize; }
.video-ocr-handle-n { left: calc(50% - 7px); top: -8px; cursor: ns-resize; }
.video-ocr-handle-ne { right: -8px; top: -8px; cursor: nesw-resize; }
.video-ocr-handle-e { right: -8px; top: calc(50% - 7px); cursor: ew-resize; }
.video-ocr-handle-se { right: -8px; bottom: -8px; cursor: nwse-resize; }
.video-ocr-handle-s { left: calc(50% - 7px); bottom: -8px; cursor: ns-resize; }
.video-ocr-handle-sw { left: -8px; bottom: -8px; cursor: nesw-resize; }
.video-ocr-handle-w { left: -8px; top: calc(50% - 7px); cursor: ew-resize; }

.video-ocr-diagnostics {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.video-ocr-sample {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: start;
  padding: 8px;
  background: #fff;
  border: 1px solid #d8dee8;
  border-radius: 10px;
}

.video-ocr-preview-stack {
  display: flex;
  flex-direction: column;
  gap: 3px;
  width: 100%;
}

.video-ocr-preview-label {
  color: #475569;
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1.1;
  text-transform: uppercase;
}

.video-ocr-preview {
  width: 100%;
  max-height: 150px;
  object-fit: contain;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  cursor: zoom-in;
  image-rendering: pixelated;
}

.video-ocr-sample-detail {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
  min-width: 0;
}

.video-ocr-sample-title {
  color: #111827;
  font-size: 0.84rem;
}

.video-ocr-raw-text {
  display: block;
  max-height: 110px;
  overflow: auto;
  padding: 6px;
  background: #f1f5f9;
  border-radius: 7px;
  color: #111827;
  font-size: 0.78rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.video-ocr-copy-button {
  align-self: flex-start;
  margin-top: 2px;
}

.video-ocr-fallback {
  margin-top: 4px;
  color: #064e3b;
  font-weight: 700;
  font-size: 0.78rem;
}

.video-ocr-attempts {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.video-ocr-attempt {
  display: block;
  padding: 4px 6px;
  overflow: hidden;
  color: #334155;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-size: 0.72rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.video-annotation-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  width: fit-content;
  max-width: 100%;
  align-self: center;
  padding: 6px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
}

.media-button {
  width: 54px;
  height: 36px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #111827;
  font-weight: 800;
  cursor: pointer;
}

.media-button:hover {
  color: #ca8a04;
}

.media-button:active {
  color: #dc2626;
}

.video-annotation-depth-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 10px;
}

.video-annotation-grid-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
  padding: 10px;
  background: #fff;
  border: 1px solid #d8dee8;
  border-radius: 12px;
}

.video-annotation-grid {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
}

.video-annotation-grid th,
.video-annotation-grid td {
  padding: 8px;
  border-bottom: 1px solid #e5e7eb;
  text-align: left;
  vertical-align: middle;
}

.video-annotation-grid th {
  color: #374151;
  background: #f8fafc;
  font-weight: 700;
}

.video-annotation-grid td:last-child {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}

.video-sync-status {
  border: 1px solid #d8dee8;
  border-radius: 10px;
  background: #f8fafc;
  color: #111827;
  font-size: 0.88rem;
  font-weight: 600;
  padding: 9px 10px;
}

.video-sync-anchor-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.video-sync-anchor-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px;
  border: 1px solid #d8dee8;
  border-radius: 10px;
  background: #fff;
  padding: 8px;
}

.video-sync-anchor-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.84rem;
  color: #111827;
}

.turbid-zones {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.turbid-zone-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.turbid-zone-item {
  border: 1px solid #dbe2ea;
  border-radius: 10px;
  background: #f8fafc;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.turbid-zone-item.is-draft {
  background: #eff6ff;
  border-color: #bfdbfe;
}

.turbid-zone-title {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 700;
  color: #1f2937;
}

.turbid-zone-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.turbid-zone-fields .control-field {
  min-width: 0;
}

.turbid-zone-fields .range-field {
  gap: 8px;
}

@media (max-width: 520px) {
  .turbid-zone-fields {
    grid-template-columns: 1fr;
  }

  .video-sync-floating-preview {
    left: 12px;
    right: 12px;
    bottom: 12px;
    width: auto;
    min-width: 0;
  }

  .video-sync-annotation-workspace {
    left: 12px;
    right: 12px;
    top: 12px;
    bottom: 12px;
    width: auto;
    min-width: 0;
  }

  .video-annotation-depth-row {
    grid-template-columns: 1fr;
  }

  .video-ocr-sample {
    grid-template-columns: 1fr;
  }

  .video-ocr-preview {
    width: 100%;
  }
}

/* RIGHT PANEL */
#rightPanel {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
  box-sizing: border-box;
}

#app.annotated-survey-mode #rightPanel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 50vw;
  padding: 0;
  background: #111;
}

#wellFrame {
  width: min(760px, 100%);
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

#app.annotated-survey-mode #wellFrame {
  width: min(600px, 100%);
  height: 100%;
  gap: 0;
}

#wellInfoPanel {
  background: #fff;
  border: 1px solid #d8dee8;
  border-radius: 16px;
  padding: 18px 20px;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
}

#app.annotated-survey-mode #wellInfoPanel {
  flex: 0 0 auto;
  padding: 8px 12px;
  background: #111;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

#app.annotated-survey-mode .well-info-grid {
  display: none;
}

#app.annotated-survey-mode .well-info-header {
  margin: 0;
}

#app.annotated-survey-mode .well-info-title {
  color: #ffd700;
  font-family: "Eurostile Extended", "Square 721 Extended", "Segoe UI", sans-serif;
  font-size: clamp(11px, 3.4vw, 28px);
  font-weight: 800;
  letter-spacing: 0.8px;
  overflow: hidden;
  text-overflow: ellipsis;
  text-transform: none;
  white-space: nowrap;
}

.well-info-header {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 14px;
}

.well-info-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: #111827;
  text-align: center;
}

.well-info-logo {
  position: absolute;
  top: 50%;
  right: 0;
  width: 132px;
  max-height: 72px;
  object-fit: contain;
  transform: translateY(-50%);
}

.well-info-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 20px;
}

.well-info-item {
  display: flex;
  gap: 8px;
  min-width: 0;
}

.well-info-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: #374151;
  white-space: nowrap;
}

.well-info-value {
  font-size: 0.85rem;
  color: #111827;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

a.well-info-value {
  color: #075985;
  text-decoration: underline;
  text-underline-offset: 2px;
}

a.well-info-value:hover,
a.well-info-value:focus-visible {
  color: #0c4a6e;
}

.well-info-image-record {
  flex: 0 0 auto;
  white-space: nowrap;
}

/* VIEWPORT (your "well canvas") */
#viewport {
  position: relative;
  width: 100%;
  flex: 1;
  min-height: 0;
  background: #fff;
  border: 2px solid #000;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.08);
}

#app.annotated-survey-mode #viewport {
  border: 0;
  border-radius: 0;
  background: #fff;
  box-shadow: none;
}

/* remove watermark pseudo-elements for now */

#annotatedPage #annotatedDiagramSlot {
  flex-direction: column;
  min-height: 0;
  height: auto;
  padding: 12px;
}

#annotatedLoadWellState {
  display: flex;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
}

#annotatedLoadWellState[hidden] {
  display: none;
}

.annotated-load-well-card {
  display: flex;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
  gap: 8px;
  padding: 8px;
  border: 1px dashed #cbd5e1;
  border-radius: 4px;
  background: #fff;
  color: #111827;
  text-align: left;
  cursor: pointer;
}

.annotated-load-well-preview {
  display: grid;
  flex: 1 1 auto;
  min-height: 0;
  place-items: center;
  background: #f1f4f6;
}

.annotated-load-well-preview span {
  color: #17594a;
  font-size: 48px;
  font-weight: 400;
  line-height: 1;
}

.annotated-load-well-label {
  order: -1;
  padding: 0 4px 4px;
  font-size: 14px;
  font-weight: 700;
  text-align: center;
}

.annotated-load-well-card:hover .annotated-load-well-preview {
  background: #e9eef0;
}

.annotated-well-picker {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  overflow: auto;
  padding: 16px;
  border: 1px solid #d8dee8;
  border-radius: 6px;
  background: #fff;
}

.annotated-well-picker.is-hidden {
  display: none;
}

.annotated-well-picker h2 {
  margin: 0 0 16px;
  font-size: 1.1rem;
  text-align: center;
}

.annotated-well-picker-list {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
}

.annotated-well-picker-option {
  min-height: 52px;
  padding: 12px;
  border: 1px solid #cbd5e1;
  border-radius: 4px;
  background: #f8fafc;
  color: #111827;
  font-weight: 700;
  text-align: center;
  cursor: pointer;
}

.annotated-well-picker-option:hover {
  border-color: #17594a;
  background: #f0f7f5;
}

.annotated-well-picker-empty {
  grid-column: 1 / -1;
  color: #475569;
}

#annotatedPage #mostRecentLabelTabs {
  flex: 0 0 auto;
  width: 100%;
  box-sizing: border-box;
  justify-content: center;
  padding: 6px 0;
  border-top: 0;
}

#annotatedPage #rightPanel {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
}

#annotatedPage #wellInfoPanel {
  flex: 0 0 auto;
  padding: 6px 12px;
  border-radius: 6px;
  box-shadow: none;
}

#annotatedPage .well-info-header {
  margin-bottom: 0;
}

#annotatedPage .well-info-title {
  line-height: 1.25;
}

#annotatedPage .well-info-grid {
  display: none;
}

#annotatedPage #rightPanel[hidden],
#annotatedClearWellBtn[hidden] {
  display: none;
}

#annotatedPage #annotatedDepthPanel {
  display: none;
}

/* hide large page title and toolbar action buttons for now */
.annotated-kicker { display: none !important; }
#annotatedTitle { display: none !important; }
.annotated-toolbar .annotated-actions { display: flex !important; }

/* IMPORTANT: all layers fill viewport */
#borehole,
#casing,
#water,
#features,
#notes {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
}

#borehole { z-index: 0; }
#water { z-index: 1; }
#features { z-index: 2; }
#casing { z-index: 3; }
#notes { z-index: 4; }

body.pdf-exporting {
  background: #fff;
  overflow: hidden;
}

body.pdf-exporting > *:not(#app):not(script) {
  display: none !important;
}

body.pdf-exporting #controls,
body.pdf-exporting #ocrControls {
  display: none !important;
}

body.pdf-exporting #app {
  display: block !important;
  width: 7.8in;
  height: 10.6in;
  margin: 0 auto;
}

body.pdf-exporting #rightPanel {
  width: 100% !important;
  height: 100% !important;
  justify-content: flex-start !important;
  align-items: flex-start !important;
  padding: 0 !important;
  background: #fff;
  box-shadow: none;
}

body.pdf-exporting #wellFrame {
  width: 100% !important;
  height: 100% !important;
  gap: 0 !important;
}

body.pdf-exporting #wellInfoPanel {
  position: relative;
  flex: 0 0 auto !important;
  min-height: 1.15in !important;
  padding: 0.03in 0.08in 0.02in;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  box-sizing: border-box;
}

body.pdf-exporting .well-info-header {
  position: relative;
  display: block;
  min-height: 0.72in;
  margin: 0;
  padding: 0;
}

body.pdf-exporting .well-info-title {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  font-family: Arial, sans-serif;
  font-size: 10.25pt;
  line-height: 1.1;
  padding: 0.04in 0 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
  transform: none;
}

body.pdf-exporting .well-info-logo {
  position: absolute;
  top: 0.285in;
  right: -0.14in;
  width: 2.78in;
  max-height: 1.45in;
  transform: none;
}

body.pdf-exporting .well-info-grid {
  width: 100%;
  grid-template-columns: 1fr;
  gap: 0.05in;
  padding-top: 0.04in;
}

body.pdf-exporting .well-info-item {
  display: grid;
  grid-template-columns: 1.2in minmax(0, 1fr);
  align-items: start;
  column-gap: 0.06in;
  padding-bottom: 0.01in;
}

body.pdf-exporting .well-info-label,
body.pdf-exporting .well-info-value {
  font-family: Arial, sans-serif;
  font-size: 9pt;
  line-height: 1.15;
}

body.pdf-exporting .well-info-value {
  overflow: visible;
  text-overflow: clip;
  white-space: normal;
  justify-self: start;
}

body.pdf-exporting a.well-info-value {
  color: #111827;
  text-decoration: none;
  pointer-events: none;
}

body.pdf-exporting .well-info-label {
  min-width: 0;
}

body.pdf-exporting .well-info-image-record {
  display: none;
}

body.pdf-exporting #viewport {
  flex: 1 1 auto !important;
  width: 100% !important;
  min-height: 0;
  margin-top: 0.5in !important;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  overflow: hidden;
}

body.pdf-exporting .datum-leader-line,
body.pdf-exporting .swl-leader-line,
body.pdf-exporting .dogleg-leader-line,
body.pdf-exporting .break-leader-line,
body.pdf-exporting .hole-leader-line,
body.pdf-exporting .obstruction-leader-line,
body.pdf-exporting .patch-leader-line,
body.pdf-exporting .stuck-pipe-leader-line,
body.pdf-exporting .turbid-water-leader-line,
body.pdf-exporting .note-leader-line,
body.pdf-exporting .geology-leader-line,
body.pdf-exporting .annular-leader-line {
  stroke-width: 0.2 !important;
  stroke-opacity: 0.7 !important;
  vector-effect: non-scaling-stroke;
  stroke-linecap: round;
}

@page {
  size: Letter portrait;
  margin: 0.2in;
}

@media print {
  html,
  body {
    width: 8.5in;
    height: 11in;
    margin: 0;
    background: #fff;
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }
}

.video-sync-overlay {
  position: absolute;
  inset: 0;
  z-index: 10000;
  pointer-events: none;
}

.video-sync-cursor-line {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 0;
  border-top: 2px solid #f97316;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.72);
  transition: transform 180ms linear, opacity 140ms ease;
  will-change: transform;
  pointer-events: auto;
  cursor: ns-resize;
}

.video-sync-cursor-hit {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 18px;
  pointer-events: auto;
  cursor: ns-resize;
  background: transparent;
}

.video-sync-cursor-line.dragging,
.video-sync-cursor-hit.dragging {
  transition: none;
}

#app.annotated-survey-mode .video-sync-cursor-line {
  left: 40%;
  right: 40%;
  border-top: 4px solid #ffd700;
  border-radius: 999px;
  box-shadow: 0 0 10px rgba(255, 215, 0, 0.68);
}

#app.annotated-survey-mode .video-sync-cursor-label {
  border-color: #ffd700;
  background: rgba(17, 17, 17, 0.88);
  color: #ffd700;
}

.video-sync-cursor-label {
  position: absolute;
  top: 0;
  right: 12px;
  border: 1px solid #9a3412;
  border-radius: 999px;
  background: #fff7ed;
  color: #7c2d12;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 6px 9px;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.16);
  transition: transform 180ms linear, opacity 140ms ease;
  will-change: transform;
  pointer-events: auto;
  cursor: ns-resize;
}

.switch-view-tab {
  position: absolute;
  top: 10px;
  left: 16px;
  z-index: 10001;
  border: 1px solid #111827;
  background: #fff;
  color: #111827;
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  pointer-events: auto;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.14);
}

.switch-view-tab:hover {
  background: #111827;
  color: #fff;
}

.datum-label-wrap {
  position: absolute;
  inset: 0;
}

.datum-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.ground-level-line {
  stroke: #9ca3af;
  stroke-width: 1;
  stroke-dasharray: 5 4;
}

.datum-leader-line {
  stroke: #4b5563;
  stroke-width: 0.65;
  stroke-linecap: round;
}

.swl-leader-line {
  stroke: #2f7dd1;
  stroke-width: 0.7;
}

.dogleg-leader-line {
  stroke: #dc2626;
  stroke-width: 0.7;
}

.break-leader-line {
  stroke: #dc2626;
  stroke-width: 0.7;
}

.hole-leader-line {
  stroke: #dc2626;
  stroke-width: 0.7;
}

.obstruction-leader-line {
  stroke: #dc2626;
  stroke-width: 0.7;
}

.patch-leader-line {
  stroke: #6b7280;
  stroke-width: 0.7;
}

.stuck-pipe-leader-line {
  stroke: #dc2626;
  stroke-width: 0.7;
}

.turbid-water-leader-line {
  stroke: #111827;
  stroke-width: 0.7;
}

.note-leader-line {
  stroke: #111827;
  stroke-width: 0.7;
}

.geology-leader-line,
.annular-leader-line {
  stroke-width: 0.7;
}

.datum-label {
  position: absolute;
  transform: translateY(-50%);
  border: none !important;
  background: transparent !important;
  color: #111827;
  border-radius: 0;
  padding: 0;
  font-size: 0.64rem;
  font-weight: 400;
  line-height: 1.08;
  white-space: normal;
  overflow: visible;
  overflow-wrap: anywhere;
  word-break: break-word;
  box-shadow: none !important;
  cursor: pointer;
  z-index: 10;
  box-sizing: border-box;
}

.datum-label.side-left {
  text-align: right;
}

.datum-label.side-right {
  text-align: left;
}

.geology-label {
  font-size: 0.64rem;
  line-height: 1.08;
}

.geology-label.geology-label-compact {
  font-size: 0.48rem;
  line-height: 1;
}

.datum-label-text {
  display: inline;
}

.swl-label {
  background: #e8f3ff;
  border-color: #2f7dd1;
  color: #1254a0;
}

.dogleg-label {
  background: #fff1f2;
  border-color: #dc2626;
  color: #b91c1c;
}

.control-field { position: relative; }
.dwr-lookup-status {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: #2e7d32;
  pointer-events: none;
  opacity: 0.95;
}
.dwr-lookup-status.loading {
  color: #666;
}
.dwr-lookup-status.loading::before{
  content: '';
  width: 14px;
  height: 14px;
  border: 2px solid #cfcfcf;
  border-top-color: #444;
  border-radius: 50%;
  display: inline-block;
  animation: dwr-spin 0.9s linear infinite;
}
@keyframes dwr-spin { to { transform: rotate(360deg); } }
.dwr-lookup-status.notfound { color: #c62828; font-weight: 700; }
.dwr-lookup-status.found { color: #2e7d32; font-weight: 700; }
.break-label {
  background: #fff1f2;
  border-color: #dc2626;
  color: #b91c1c;
}

.hole-label {
  background: #fff1f2;
  border-color: #dc2626;
  color: #b91c1c;
}

.obstruction-label {
  background: #fff1f2;
  border-color: #dc2626;
  color: #b91c1c;
}

.patch-label {
  background: #f3f4f6;
  border-color: #6b7280;
  color: #374151;
}

.stuck-pipe-label {
  background: #fff1f2;
  border-color: #dc2626;
  color: #b91c1c;
}

.turbid-water-label {
  background: #ffffff;
  border-color: #111827;
  color: #111827;
}

.datum-label.is-selected {
  border-color: #f59e0b;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.2), 0 6px 18px rgba(15, 23, 42, 0.12);
}

.datum-label.is-draggable {
  cursor: grab;
}

.datum-label.is-draggable:active {
  cursor: grabbing;
}

.annular-label {
  background: #ffffff;
  border-color: #d1d5db;
  color: #111827;
}

.datum-label.is-left {
  transform: translate(-100%, -50%);
}

.datum-menu {
  position: absolute;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px;
  min-width: 130px;
  border: 1px solid #d1d5db;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 14px 28px rgba(15, 23, 42, 0.16);
  z-index: 20;
}

.datum-menu[hidden] {
  display: none;
}

.datum-menu-item {
  border: 1px solid #e5e7eb;
  background: #f8fafc;
  color: #111827;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 0.82rem;
  text-align: left;
  cursor: pointer;
}

@media (max-width: 900px) {
  .annotated-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .annotated-actions {
    justify-content: flex-start;
  }

  .annotated-workspace {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(260px, 42vh) minmax(420px, 1fr);
  }

  #app {
    flex-direction: column;
    height: auto;
    min-height: 100vh;
  }

  #controls {
    width: 100%;
    border-right: 0;
    border-bottom: 1px solid #ccc;
  }

  #rightPanel {
    padding: 16px;
  }

  #wellFrame {
    min-height: 70vh;
  }

  .well-info-grid {
    grid-template-columns: 1fr;
  }

  #app.annotated-survey-mode {
    display: flex;
    flex-direction: column;
  }

  #app.annotated-survey-mode #rightPanel,
  #app.annotated-survey-mode ~ .video-sync-annotation-workspace {
    position: relative;
    inset: auto;
    width: 100%;
  }

  #app.annotated-survey-mode #rightPanel {
    min-height: 58vh;
  }
}

/* Read-only mode: disable interactive label behavior and menus */
.read-only-active .datum-label {
  pointer-events: none !important;
}
.read-only-active .datum-menu,
.read-only-active .datum-menu-item {
  display: none !important;
}
html.auth-locked body > :not(#homePage),
html.auth-locked #homePage .home-screen > :not(#homeSignInDialog),
html.auth-locked #homePage > :not(.home-screen),
html.auth-locked #homeSignInCancel {
  display: none !important;
}

html.auth-locked #homePage {
  display: block !important;
}

html.auth-locked #homeSignInDialog {
  visibility: visible;
}

html:not(.platform-admin) [data-action="diagrams"],
html:not(.platform-admin) [data-action="data-analysis"],
html:not(.platform-admin) [data-action="map-tools"],
html:not(.platform-admin) [data-add-pump-data],
html:not(.platform-admin) [data-add-operating-record],
html:not(.platform-admin) [data-well-data-add-record],
html:not(.platform-admin) .home-file-delete {
  display: none !important;
}

html:not(.platform-admin) .home-pump-context-menu {
  display: none !important;
}

html.platform-admin .customer-surveys-card {
  display: none;
}
