<style>

:root{
    --bg: #fff;
    --text: #111;
    --muted: rgba(0,0,0,0.65);
    --card: #ffffff;
    --line: rgba(0,0,0,0.12);
    --shadow: 0 8px 24px rgba(0,0,0,0.18);
    --radius: 14px;
    --pad: 14px;
  }

body{
  margin:0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  touch-action: pan-x pan-y;
  -webkit-user-select: none;
  user-select: none;
}

/* CSS to high google maps additional info */
/* Hide Google Maps UI elements */
.gm-style .gm-style-cc,
.gm-style a[href^="https://maps.google.com/maps"],
.gm-style-mtc,
.gm-bundled-control,
.gmnoprint:not(.gm-svpc),
.gm-control-active[title="Keyboard shortcuts"],
button[title="Toggle fullscreen view"],
button[title="Zoom in"],
button[title="Zoom out"] {
  display: none !important;
}

.gm-svpc {
  display: block !important;
}

/* ONLY documentation modal header */
#docModal .modal-header{
  padding: 0 21px 0 20px !important;
}

/* ============================================
   DOCUMENTATION MODAL STYLES
   ============================================ */

/* Documentation Modal Container */
.doc-modal-container {
  width: 90%;
  max-width: 900px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}

/* Documentation Modal Body */
.doc-modal-body {
  overflow-y: auto;
  padding: 20px;
  flex: 1;
}

/* Documentation Content Wrapper */
.doc-content {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.6;
  color: #333;
}

/* Documentation Header */
.doc-header {
  text-align: center;
  margin-bottom: 30px;
  padding-bottom: 20px;
  border-bottom: 2px solid #1976d2;
}

.doc-header h1 {
  margin: 0 0 10px 0;
  font-size: 28px;
  color: #1976d2;
}

.doc-version {
  margin: 0;
  font-size: 14px;
  color: #666;
  font-style: italic;
}

/* Table of Contents */
.doc-toc {
  background-color: #f5f5f5;
  padding: 20px;
  border-radius: 8px;
  margin-bottom: 30px;
}

.doc-toc h2 {
  margin-top: 0;
  font-size: 20px;
  color: #1976d2;
}

.doc-toc ol {
  margin: 10px 0 0 0;
  padding-left: 25px;
}

.doc-toc li {
  margin: 8px 0;
}

.doc-toc a {
  color: #1976d2;
  text-decoration: none;
  font-weight: 500;
}

.doc-toc a:hover {
  text-decoration: underline;
}

/* Documentation Sections */
.doc-content section {
  margin-bottom: 40px;
}

.doc-content h2 {
  font-size: 24px;
  color: #1976d2;
  margin-top: 30px;
  margin-bottom: 15px;
  padding-bottom: 10px;
  border-bottom: 1px solid #e0e0e0;
}

.doc-content h3 {
  font-size: 20px;
  color: #424242;
  margin-top: 25px;
  margin-bottom: 12px;
}

.doc-content h4 {
  font-size: 16px;
  color: #616161;
  margin-top: 15px;
  margin-bottom: 10px;
  font-weight: 600;
}

/* Paragraphs and Lists */
.doc-content p {
  margin: 12px 0;
}

.doc-content ul,
.doc-content ol {
  margin: 12px 0;
  padding-left: 25px;
}

.doc-content li {
  margin: 8px 0;
}

.doc-content li strong {
  color: #1976d2;
}

/* Nested Lists */
.doc-content ul ul,
.doc-content ol ul,
.doc-content ul ol,
.doc-content ol ol {
  margin: 6px 0;
}

/* Warning/Note Boxes */
.doc-content .warning {
  background-color: #fff3cd;
  border-left: 4px solid #ffc107;
  padding: 12px 15px;
  margin: 15px 0;
  border-radius: 4px;
}

.doc-content .translation-note {
  background-color: #e3f2fd;
  border-left: 4px solid #2196f3;
  padding: 12px 15px;
  margin: 15px 0;
  border-radius: 4px;
  font-style: italic;
}


/*********************
 * Render Attempt Rows and selector styles
 *********************/

 /* Attempt Selector Modal - Narrow Width */
.attempt-select-modal {
  width: min(340px, calc(100vw - 40px)) !important;
  max-width: 340px !important;
}

.attempt-select-modal .modal-header {
  padding: 12px 14px;
}

.attempt-select-modal .modal-title {
  font-size: 15px;
}

/* FAQ Items */
.faq-item {
  margin: 20px 0;
  padding: 15px;
  background-color: #fafafa;
  border-radius: 6px;
  border-left: 3px solid #1976d2;
}

.faq-item h4 {
  margin-top: 0;
  color: #1976d2;
  font-size: 16px;
}

.faq-item p {
  margin: 8px 0 0 0;
}

/* Documentation Footer */
.doc-footer {
  margin-top: 40px;
  padding-top: 20px;
  border-top: 2px solid #1976d2;
  text-align: center;
  font-size: 14px;
}

/* Loading Spinner */
.loading-spinner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  text-align: center;
}

.spinner {
  border: 4px solid #f3f3f3;
  border-top: 4px solid #1976d2;
  border-radius: 50%;
  width: 50px;
  height: 50px;
  animation: spin 1s linear infinite;
  margin-bottom: 15px;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.loading-spinner p {
  color: #666;
  font-size: 16px;
  margin: 0;
}

/* Error State */
.doc-error {
  text-align: center;
  padding: 40px 20px;
}

.doc-error h2 {
  color: #d32f2f;
  margin-bottom: 15px;
}

.doc-error p {
  color: #666;
  margin-bottom: 20px;
}

.doc-error button {
  padding: 10px 24px;
  background-color: #1976d2;
  color: white;
  border: none;
  border-radius: 4px;
  font-size: 14px;
  cursor: pointer;
  transition: background-color 0.3s;
}

.doc-error button:hover {
  background-color: #1565c0;
}

/* Code/Technical Blocks (if needed in future) */
.doc-content code {
  background-color: #f5f5f5;
  padding: 2px 6px;
  border-radius: 3px;
  font-family: "Courier New", Courier, monospace;
  font-size: 0.9em;
  color: #d32f2f;
}

.doc-content pre {
  background-color: #f5f5f5;
  padding: 15px;
  border-radius: 6px;
  overflow-x: auto;
  border-left: 3px solid #1976d2;
}

.doc-content pre code {
  background-color: transparent;
  padding: 0;
  color: #333;
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .doc-modal-container {
    width: 95%;
    max-width: 95%;
    max-height: 95vh;
  }
  
  .doc-modal-body {
    padding: 15px;
  }
  
  .doc-header h1 {
    font-size: 22px;
  }
  
  .doc-content h2 {
    font-size: 20px;
  }
  
  .doc-content h3 {
    font-size: 18px;
  }
  
  .doc-content h4 {
    font-size: 15px;
  }
  
  .doc-toc {
    padding: 15px;
  }
}

/* Smooth Scrolling for Anchor Links */
html {
  scroll-behavior: smooth;
}

/* Style for documentation links */
.doc-content a {
  color: #1976d2;
  text-decoration: none;
  transition: color 0.2s;
}

.doc-content a:hover {
  color: #1565c0;
  text-decoration: underline;
}

/* Highlight current section when scrolling */
.doc-content section:target {
  animation: highlight 2s ease-in-out;
}

@keyframes highlight {
  0% {
    background-color: #fff9c4;
  }
  100% {
    background-color: transparent;
  }
}


/* Show all territories option styling */
.show-all-option {
  background-color: #f0f7ff !important;
  border-left: 3px solid #1976d2 !important;
  font-weight: 500;
}

.show-all-option:hover {
  background-color: #e3f2fd !important;
}

/* Prevent attempt dropdowns from being too wide */
#Attempt1Select,
#Attempt2Select,
#Attempt3Select {
  max-width: 14ch;
  width: auto;
  background-color: white !important;
}

/* Force white background on attempt dropdowns */
select {
  background-color: white !important;
  color: black !important;
  appearance: auto;
  -webkit-appearance: menulist;
  -moz-appearance: menulist;
}

select option {
  background-color: white !important;
  color: black !important;
}

/* Custom Zoom Scroll Wheel */
.zoom-dial{
  position: fixed;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 4000;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(8px);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 10px 8px;
  box-shadow: var(--shadow);
  user-select: none;
}

.zoom-indicator{
  font-size: 11px;
  font-weight: 700;
  color: #111;
  min-height: 16px;
  text-align: center;
}

.zoom-wheel{
  width: 30px;
  height: 180px;
  background: linear-gradient(to bottom, #f0f0f0 0%, #fff 50%, #f0f0f0 100%);
  border: 1px solid var(--line);
  border-radius: 15px;
  position: relative;
  overflow: hidden;
  cursor: grab;
  touch-action: none;
}

.zoom-wheel:active{
  cursor: grabbing;
}

/* Scroll wheel tick marks - creates visual appearance of a rotary dial
   Multiple evenly-spaced horizontal lines make it look like a physical wheel */
.zoom-wheel-track{
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  
  /* Create tick marks using repeating gradient
     - White lines (ticks) are 1px tall
     - Transparent gaps are 9px
     - Creates 18 evenly-spaced ticks across the 180px height */
  background: repeating-linear-gradient(
    to bottom,
    transparent 0px,
    transparent 4.5px,
    rgba(0,0,0,0.15) 4.5px,
    rgba(0,0,0,0.15) 5.5px,
    transparent 5.5px,
    transparent 10px
  );
}

.zoom-wheel-thumb{
  position: absolute;
  left: 50%;
  width: 28px;
  height: 4px;
  background: #111;
  border-radius: 2px;
  transform: translate(-50%, -50%);
  transition: top 0.1s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,0.3);
  z-index: 2;
}

/*
.zoom-btn:active{
  transform: scale(0.95);
  background: rgba(0,0,0,0.05);
}

.zoom-btn.active{
  background: #111;
  color: #fff;
  border-color: #111;
}
*/

  /* App header */
  .topbar{
    position: sticky;
    top: 0;
    z-index: 5000;
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--line);
  }
.topbar-inner{
  display:flex;
  gap:10px;
  align-items:center;
  justify-content:space-between;
  padding: 10px 12px;
  flex-wrap: nowrap;
}

.title{
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 0.2px;
  line-height: 1.1;
  white-space: nowrap;      /* ADD THIS LINE */
  overflow: hidden;         /* ADD THIS LINE */
  text-overflow: ellipsis;  /* ADD THIS LINE */
  flex-shrink: 1;          /* ADD THIS LINE */
  min-width: 0;            /* ADD THIS LINE */
}

.controls{
  display:flex;
  gap:10px;
  align-items:center;
  justify-content:flex-end;
  flex-wrap: nowrap;  /* CHANGE from wrap to nowrap */
  flex-shrink: 0;     /* ADD THIS LINE */
}

  .chip{
    display:flex;
    align-items:center;
    gap:8px;
    border:1px solid var(--line);
    padding: 7px 10px;
    border-radius: 999px;
    font-size: 13px;
    background: #fff;
    user-select:none;
    white-space:nowrap;
  }
.btn{
  border:1px solid var(--line);
  background:#fff;
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 13px;
  cursor:pointer;
  white-space: nowrap;  /* ADD THIS LINE */
}

  .btn:active{ transform: translateY(1px); }

  /* map */
#map{
  height: calc(100vh - 56px);
  width: 100vw;
  touch-action: none;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

.boot-overlay{
  position: fixed;
  inset: 0;
  z-index: 999999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(6px);
}

.boot-card{
  width: min(480px, calc(100vw - 80px));
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 18px 16px;
  text-align: center;
}

.boot-title{
  font-weight: 700;
  font-size: 18px;
  margin-bottom: 8px;
}

.boot-welcome{
  font-size: 16px;
  font-weight: 600;
  color: rgba(0,0,0,0.75);
  margin-bottom: 12px;
  margin-top: 8px;
}

.boot-welcome span{
  color: #111;
  font-weight: 700;
}

.boot-status{
  font-size: 14px;
  color: var(--muted);
  min-height: 20px;
}

.boot-dots{
  display: inline-flex;
  gap: 6px;
  margin-top: 12px;
}
.boot-dots span{
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: rgba(0,0,0,0.25);
  animation: bootDot 1s infinite ease-in-out;
}
.boot-dots span:nth-child(2){ animation-delay: 0.15s; }
.boot-dots span:nth-child(3){ animation-delay: 0.30s; }

@keyframes bootDot{
  0%, 100%{ transform: translateY(0); opacity: 0.35; }
  50%{ transform: translateY(-3px); opacity: 0.9; }
}

.boot-overlay.is-hidden{
  display: none;
}



  /* toast */
  #toast{
    display:none;
    position:fixed;
    left:50%;
    bottom:18px;
    transform:translateX(-50%);
    background:rgba(0,0,0,0.88);
    color:#fff;
    padding:10px 14px;
    border-radius:999px;
    font-size:14px;
    z-index:20000;
  }

  /* modals */
*{ box-sizing:border-box; }

.overlay{
  display:none;
  position:fixed;
  inset:0;
  background:rgba(0,0,0,0.40);
  z-index:10000;

  padding: 12px;
  align-items:flex-start;
  justify-content:center;

  /* IMPORTANT: overlay itself should NOT be a momentum scroller */
  overflow:hidden;
  -webkit-overflow-scrolling: auto;
  touch-action: auto;
}

.overlay[style*="display: block"]{
  display:flex !important;
}


/* Documentation Modal Overlay (uses flex centering) */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.40);
  z-index: 10000;
  
  /* Flex centering */
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-overlay.show,
.modal-overlay[style*="display: flex"] {
  display: flex !important;
}

/* Modal container for documentation */
.modal-container {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}


/* modal is the scroll container */
.modal{
  background: var(--card);
  width: min(560px, 96vw); /* Changed from 820px to 560px */
  margin: 0;
  padding: 13px;
  border-radius: var(--radius);
  box-shadow: var(--shadow);

  max-height: calc(100dvh - 24px);
  overflow:auto;
  -webkit-overflow-scrolling: touch;

  display:block;
}

.modal.dnc-confirm{
  width: min(480px, calc(100vw - 80px));
}

.modal.delete-confirm{
  width: min(480px, calc(100vw - 80px));
}

/* If your modal footer area gets too close to the home indicator */
.modal-card{
  padding-bottom: calc(var(--pad) + env(safe-area-inset-bottom, 0px));
}

  .modal-header{
    display:flex;
    justify-content:space-between;
    align-items:center;
    gap:8px;
    flex-wrap:wrap;
    padding-bottom: 10px;
    border-bottom: 1px solid var(--line);
    margin-bottom: 10px;
  }
  .modal-title{
    font-weight: 900;
    font-size: 16px;
    margin:0;
  }

  .editor-header-actions{
    display:flex;
    gap:8px;
    flex-wrap:wrap;
    align-items:center;
  }
  .xbtn{
    border:1px solid var(--line);
    background:#fff;
    border-radius:10px;
    padding: 6px 10px;
    cursor:pointer;
    font-size: 14px;
  }

  /* pick list */
  #pick-list{
    margin-top: 10px;
    border:1px solid var(--line);
    border-radius: 12px;
    overflow:hidden;
  }
  .pick-row{
    display:flex;
    justify-content:space-between;
    align-items:center;
    gap:12px;
    padding: 12px 12px;
    cursor:pointer;
    background:#fff;
  }
  .pick-row + .pick-row{ border-top: 1px solid rgba(0,0,0,0.06); }
  .pick-row:hover{ background:#f7f7f7; }
  .pick-left{
    display:flex;
    flex-direction:column;
    gap:3px;
    min-width: 0;
  }
  .pick-title{
    font-weight:800;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
    max-width: 70vw;
  }
  .pick-sub{
    font-size:12px;
    opacity:0.78;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
    max-width: 70vw;
  }
  .chev{
    opacity:0.55;
    font-weight:800;
    flex: 0 0 auto;
  }

/* editor form layout */
form{ margin:0; }

.grid,
.admin-grid{
  display:grid;
  grid-template-columns: auto 1fr;
  gap: 10px 15px;
  align-items:center;
}

.val{ min-width:0; }
.val-inline{
  display:flex;
  align-items:center;
  gap:10px;
  min-width:0;
}

.inp-flex{
  flex: 1 1 auto;
  min-width: 0;
}

/* controls must size to their container (no vw widths) */
.inp,
textarea,
select{
  width:100%;
  max-width:100%;
  font-size:16px; /* iOS: prevents zoom + weird reflow */
  padding: 9px 10px;
  border-radius: 10px;
  border: 1px solid rgba(0,0,0,0.18);
  outline:none;
  background:#fff;
}

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

  .lbl{
    font-weight:800;
    font-size: 13px;
    color: rgba(0,0,0,0.82);
  }

  .val, .val a{
    font-size: 14px;
    color: #111;
  }

  .val a{
    text-decoration: none;
    border-bottom: 1px dashed rgba(0,0,0,0.35);
  }
  .val a:active{ opacity: 0.8; }

  .val-inline{
    display:flex;
    align-items:center;
    gap:10px;
    min-width: 0;
  }

.val-inline-tight{
  align-items: center;
}

.inp-flex{
  width: auto;
  flex: 1 1 auto;
  min-width: 0;
  max-width: 100%;
}

/* sizing sanity + prevent iOS width blowouts */
*, *::before, *::after{ box-sizing:border-box; }

.val, .grid .val, .admin-grid .val{ min-width:0; } /* allow shrink */


.admin-grid .val-inline #CoordsDisplay{
  flex: 1 1 auto;
  min-width: 0;
  overflow-wrap: break-word;
  word-break: break-all;
  padding: 5px 5px 5px 9px !important;
}

.inp, textarea, select{
  width: 100%;          /* fill the grid cell, not the viewport */
  max-width: 100%;      /* fill available space */
  font-size: 14px;
  padding: 9px 10px;
  border-radius: 10px;
  border: 1px solid rgba(0,0,0,0.18);
  outline: none;
  background:#fff;
}

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

  .rowspan{
    grid-column: 1 / -1;
    border-top: 1px solid var(--line);
    margin: 8px 0 6px;
  }

  .actions{
    display:flex;
    gap:8px;
    justify-content:flex-end;
    margin-top: 12px;
  }

/* Editor bottom action bar: 3-column grid */
.editor-actions-bar{
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}
.editor-actions-bar .actions-left{
  justify-self: start;
}
.editor-actions-bar .actions-center{
  justify-self: center;
}
.editor-actions-bar .actions-right{
  justify-self: end;
  display: flex;
  gap: 8px;
}

/* Admin Functions button - greyed out when disabled */
#admin-toggle-btn:disabled{
  opacity: 0.45;
  cursor: default;
}

/* Language button (replaces pill dropdown) */
#lang-btn{
  border: 1px solid var(--line);
  background: #fff;
  padding: 7px 14px;
  border-radius: 10px;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}

  .primary{
    background:#111;
    color:#fff;
    border-color:#111;
  }

  .smallbtn{
    border:1px solid var(--line);
    background:#fff;
    padding: 7px 10px;
    border-radius: 10px;
    font-size: 13px;
    cursor:pointer;
    white-space:nowrap;
  }

  .muted{
    color: var(--muted);
    font-size: 13px;
    margin-top: 6px;
  }

  /* link-like button */
  .linkbtn{
    border: none;
    background: transparent;
    padding: 6px 0;
    font-size: 13px;
    cursor: pointer;
    color: rgba(0,0,0,0.75);
    text-decoration: underline;
    text-decoration-style: dotted;
    text-underline-offset: 3px;
  }
  .linkbtn:active{ opacity: 0.8; }

  /* pill dropdown (language + territory) */
  .pill-select{
    position: relative;
    display: inline-block;
  }






/* =========================
 * UI Language picker (topbar)
 * - Uses same pill-menu styling you already have
 * ========================= */

/* Make the UI language button look like your other chips */
.ui-lang-btn{
  display:flex;
  align-items:center;
  gap:8px;
  border:1px solid var(--line);
  padding: 7px 10px;
  border-radius: 999px;
  font-size: 13px;
  background: #fff;
  user-select:none;
  white-space:nowrap;
  cursor:pointer;
}

.ui-lang-label{
  font-weight: 800;
}



/* short field helpers */
.inp-xs{ max-width: 10ch; }
.inp-sm{ max-width: 14ch; }
.inp-md{ max-width: 22ch; }

/* pill buttons should size to content, but not explode */
.pill-btn{
  min-width: 0;
  width: auto;
  max-width: 26ch;
}

/*
  .pill-btn{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap: 10px;
    border:1px solid var(--line);
    background:#fff;
    padding: 7px 10px;
    border-radius: 12px;
    font-size: 13px;
    cursor:pointer;
    min-width: 180px;
  }
*/

  .pill-caret{
    opacity: 0.65;
    font-weight: 800;
  }

/* make dropdown menus scrollable */
/* pill dropdown menus MUST be height-capped + scrollable */
.pill-menu{
  position:absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 280px;  /* CHANGE from 220px to 280px */
  background:#fff;
  border:1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 8px;
  z-index: 25000;

  /* THIS is the missing part */
  max-height: min(50vh, 320px);
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}

/* Centered dropdown menu (used inside modals) */
.pill-menu.centered{
  position: fixed;
  left: 50%;
  right: auto;
  transform: translateX(-50%);
  min-width: min(360px, calc(100vw - 24px));
  max-width: min(420px, calc(100vw - 24px));
}

  .pill-item{
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 12px;
    cursor:pointer;
    font-size: 13px;
    background: #fff;
  }
  .pill-item:hover{
    background: rgba(0,0,0,0.06);
  }

  .pill-item-label{
    font-weight: 700;
  }

  /* Admin section box */
  .admin-box{
    margin-top: 10px;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 12px;
    background: rgba(0,0,0,0.02);
  }



  .checkline{
    display:flex;
    align-items:center;
    gap: 8px;
    user-select:none;
    font-size: 13px;
  }

  .admin-actions{
    grid-column: 1 / -1;
    display:flex;
    justify-content:flex-end;
    gap: 8px;
    margin-top: 6px;
  }


/* =========================
 * Admin geocode (DESKTOP)
 * 2-column: tip on left, buttons stacked on right
 * ========================= */
.admin-geocode{
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr auto; /* text left, buttons right */
  gap: 12px;
  align-items: start;
  margin-top: 8px;
}

.admin-geocode .admin-tip{
  font-size: 13px;
  color: rgba(0,0,0,0.65);
  min-width: 0;               /* allow wrapping */
  overflow-wrap: anywhere;    /* wrap if needed */
}

/* Buttons: right-justified, natural width, no wrapping */
.admin-geocode-actions{
  display: grid;
  grid-auto-flow: row;
  gap: 10px;
  justify-items: end;         /* right align buttons */
  align-content: start;
  width: max-content;         /* shrink to button widths */
}

.admin-geocode-actions .btn{
  width: auto;                /* NOT full width */
  white-space: nowrap;        /* keep labels on one line */
}


  .admin-tip{
    font-size: 13px;
    color: rgba(0,0,0,0.65);
  }

@media (max-width: 520px){
  .grid,
  .admin-grid{
    grid-template-columns: auto 1fr;
    gap: 8px 15px;
  }

  .lbl{
    white-space:nowrap;
    text-align:left;
  }

  /* LEFT-ALIGN all text in inputs, selects, textareas */
  .grid input[type="text"],
  .grid select,
  .grid textarea,
  .admin-grid input[type="text"],
  .admin-grid select {
    text-align: left;
  }

  /* Block row needs special treatment - flex container */
  .grid .lbl + .val {
    min-width: 0; /* Allow shrinking */
  }

  /* The value cell containing Block input + buttons */
  .val > div {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    width: 100%;
  }

  /* Block input should grow to fill available space */
  #BlockEdit {
    flex: 1 1 auto;
    min-width: 8ch;  /* Minimum to show some text */
    max-width: none; /* No upper limit */
    text-align: left;
  }

  /* Buttons should not shrink */
  .val .smallbtn {
    flex: 0 0 auto;
    white-space: nowrap;
  }
}

/* === Narrow viewport (375px and below) === */
@media (max-width: 375px){
  /* Block row: wrap buttons below the input */
  #BlockEdit {
    flex: 1 1 100% !important;
    width: 100% !important;
  }
  /* Allow the block flex container to wrap */
  .grid .val > div {
    flex-wrap: wrap !important;
  }

  /* Bottom action bar: allow wrapping */
  .editor-actions-bar {
    display: flex !important;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
  }
  .editor-actions-bar .actions-left {
    flex: 0 0 auto;
  }
  .editor-actions-bar .actions-center {
    flex: 0 0 auto;
  }
  .editor-actions-bar .actions-right {
    flex: 1 1 auto;
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    flex-wrap: wrap;
  }
}

  /* Address row is already perfect - keep it */
  .val-inline .smallbtn{
    flex: 0 0 auto;
  }

  /* Building and Name inputs - fill available space */
  #Building,
  #HouseHolderName {
    max-width: none;
    width: 100%;
    text-align: left;
  }

  /* Attempt dropdowns - fill available space */
  #Attempt1Select,
  #Attempt2Select,
  #Attempt3Select {
    max-width: none;
    width: 100%;
    text-align: left;
  }

  /* coords can wrap cleanly */
  #CoordsDisplay {
    overflow-wrap:anywhere;
    word-break:break-word;
    padding: 5px 5px 5px 9px !important;
  }

  /* geocode buttons should never force width */
  .admin-geocode{
    display:flex;
    flex-direction:column;
    gap: 10px;
    text-align: right !important;
  }
  
  /* iOS-safe: bottom admin action buttons */
  .admin-geocode-actions{
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    width: 100%;
    align-items: stretch;
  }

  /* Make each button behave nicely on iOS */
  .admin-geocode-actions .btn{
    flex: 1 1 240px;
    min-width: 0;
    white-space: nowrap;
  }








/* ============================================
   ADJUST PIN MODE (Record Editor -> Map)
   - Slides editor left, lets user drag the map while a fixed crosshair "pin"
     stays centered on screen.
   - Arrow button returns editor and commits new LatLng into the editor working copy.
   ============================================ */

#editor-overlay.adjust-pin{
  background: transparent !important; /* Remove gray overlay in adjust-pin mode */
  pointer-events: none;         /* allow map interaction EXCEPT for the modal itself */
}


#editor-overlay.adjust-pin .modal{
  pointer-events: auto;
  transform: translateX(-90%); /* Slide further left */
  transition: transform 260ms ease;
}

#editor-overlay .modal{
  transition: transform 260ms ease;
}

/* Return arrow - positioned to cover Save/Cancel buttons area */
#pinAdjustReturn{
  display:none;
  position: fixed;
  left: calc(10vw - 24px); /* Centered on editor's right edge */
  /* Position at bottom where Save/Cancel buttons are */
  bottom: 60px; /* Cover the button area */
  transform: translateX(0);
  z-index: 10050;
  width: 56px;
  height: 56px;
  border-radius: 999px;
  border: 3px solid var(--line);
  background: rgba(255,255,255,0.98);
  box-shadow: 0 6px 18px rgba(0,0,0,0.3);
  font-size: 28px;
  line-height: 56px;
  text-align: center;
  cursor: pointer;
  pointer-events: auto;
  /* Pulsing animation to draw attention */
  animation: pulseArrow 2s ease-in-out infinite;
}

@keyframes pulseArrow {
  0%, 100% { 
    transform: translateX(0) scale(1);
    box-shadow: 0 6px 18px rgba(0,0,0,0.3);
  }
  50% { 
    transform: translateX(0) scale(1.1);
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  }
}

#pinAdjustReturn:hover{
  background: rgba(255,255,255,1);
  border-color: var(--accent);
  transform: translateX(0) scale(1.15);
}


/* Bouncing shadow - creates illusion of pin lifting and dropping */
@keyframes bounceShadow {
  0%   { 
    transform: translateY(0);
    filter: drop-shadow(0 2px 1px rgba(0,0,0,0.8));
  }
  50%  { 
    transform: translateY(-18px);
    filter: drop-shadow(0 25px 20px rgba(0,0,0,0.15));
  }
  100% { 
    transform: translateY(0);
    filter: drop-shadow(0 2px 1px rgba(0,0,0,0.8));
  }
}

/* Simple rotating X crosshair - marks exact screen center where coordinates are read */
#pinAdjustCrosshair {
  position: absolute;
  top: 50%;
  left: 50%;
  /* Position the crosshair 10px down from screen center */
  margin-top: 10px;
  margin-left: -20px; /* Half of width (40px / 2) */
  margin-top: calc(10px - 20px); /* 10px down, minus half height */
  width: 40px;
  height: 40px;
  pointer-events: none;
  z-index: 1001;
  display: none;
  /* Rotate around the center of the crosshair itself */
  transform-origin: center center;
}

#pinAdjustCrosshair.bounce {
  animation: spin360 0.6s ease-in-out;
}

@keyframes spin360 {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}


/* OPTIONAL: Add a subtle center crosshair to show exact screen center */
/* Rotated crosshair at pin tip (45 degrees) - X marks the spot */
/*
#pinAdjustCrosshair::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 57px;
  width: 2px;
  height: 24px;
  background: rgba(255, 0, 0, 0.5);
  transform: translate(-50%, -50%) rotate(45deg);
  pointer-events: none;
}

#pinAdjustCrosshair::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 57px;
  width: 2px;
  height: 24px;
  background: rgba(255, 0, 0, 0.5);
  transform: translate(-50%, -50%) rotate(-45deg);
  pointer-events: none;
}
*/



/* Snap-to-pin: enlarge animation on target pin during Adjust PIN mode */
@keyframes snapPulse {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.5); }
  100% { transform: scale(1.4); }
}
.snap-target-marker img,
.snap-target-marker [style*="background"] {
  filter: drop-shadow(0 0 8px rgba(255, 100, 0, 0.7));
}

@keyframes pinBounce{
  0%   { transform: translate(-50%, -100%) translateY(0); }
  50%  { transform: translate(-50%, -100%) translateY(-10px); }
  100% { transform: translate(-50%, -100%) translateY(0); }
}

/* Hint message - positioned at top 25% of viewport, fully visible */

#pinAdjustHint{
  /* Full-screen hint overlay that works on all screen sizes */
  position: fixed;
  inset: 0;
  z-index: 10050;
  display: none;

  /* Center contents */
  align-items: center;
  justify-content: center;

  /* Dim background so user focuses on instructions */
  background: rgba(0,0,0,0.35);

  /* Allow taps/clicks inside */
  pointer-events: auto;

  /* Respect iOS safe areas */
  padding: calc(14px + env(safe-area-inset-top)) 14px calc(14px + env(safe-area-inset-bottom)) 14px;
  box-sizing: border-box;
}

#pinAdjustHint .pin-adjust-hint-card{
  background: rgba(255,255,255,0.98);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 10px 28px rgba(0,0,0,0.22);
  width: min(420px, 92vw);
  max-height: min(70vh, 520px);
  overflow: auto;
  padding: 16px 16px 12px 16px;
  box-sizing: border-box;
}

#pinAdjustHint .pin-adjust-hint-actions{
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 12px;
}

#pinAdjustHint .pin-adjust-hint-ok{
  appearance: none;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0,0,0,0.12);
}

#pinAdjustHint .pin-adjust-hint-ok:active{
  transform: translateY(1px);
}


#pinAdjustHint ol {

  margin: 0;
  padding-left: 20px;
  list-style-type: decimal;
  text-align: left; /* Ensure left alignment */
}

#pinAdjustHint li {
  margin: 8px 0;
  line-height: 1.5;
  white-space: normal; /* CRITICAL - allow line wrapping */
}

/* ============================================
   LARGE FONT / ACCESSIBILITY MODE
   ============================================
   HOW THIS WORKS:
   - When the user enables "Large Font" in the hamburger menu,
     the CSS class "large-font" is added to the <body> tag.
   - All the rules below ONLY apply when that class is present.
   - This means normal mode is completely unchanged.
   - Font sizes are increased ~30% from their normal values.
   - Layout widths (grid columns, pill menus, modals) are adjusted
     so that the larger text does not overflow or break the layout.
   ============================================ */

/* --- Boot / Loading Screen --- */
body.large-font .boot-title {
  font-size: 23px;    /* normal: 18px */
}
body.large-font .boot-welcome {
  font-size: 21px;    /* normal: 16px */
}
body.large-font .boot-status {
  font-size: 18px;    /* normal: 14px */
}

/* --- Top Bar --- */
body.large-font .title {
  font-size: 18px;    /* normal: 14px */
}
body.large-font .chip {
  font-size: 17px;    /* normal: 13px */
  padding: 9px 12px;  /* slightly more padding for larger tap target */
}
body.large-font .btn {
  font-size: 17px;    /* normal: 13px */
  padding: 10px 14px;
}

/* --- Toast Messages --- */
body.large-font #toast {
  font-size: 18px;    /* normal: 14px */
}

/* --- Modal Titles and Close Buttons --- */
body.large-font .modal-title {
  font-size: 21px;    /* normal: 16px */
}
body.large-font .xbtn {
  font-size: 18px;    /* normal: 14px */
}

/* --- Record Editor: Labels and Values --- */
body.large-font .lbl {
  font-size: 17px;    /* normal: 13px */
}
body.large-font .val,
body.large-font .val a {
  font-size: 18px;    /* normal: 14px */
}

/* --- Record Editor: Input Fields, Textareas, Selects --- */
body.large-font .inp,
body.large-font textarea,
body.large-font select {
  font-size: 18px;    /* normal: 14px */
  padding: 11px 12px; /* slightly more padding */
}

/* --- Record Editor: Grid Column (widen label column for larger text) --- */
body.large-font .grid,
body.large-font .admin-grid {
  grid-template-columns: auto 1fr;  /* normal: auto 1fr */
}

/* --- Mobile: Widen the label column slightly for large font --- */
@media (max-width: 520px) {
  body.large-font .grid,
  body.large-font .admin-grid {
    grid-template-columns: auto 1fr;  /* normal mobile: auto 1fr */
  }
}

/* --- Small Buttons (Directions, Get Link, Adjust PIN, Copy) --- */
body.large-font .smallbtn {
  font-size: 17px;    /* normal: 13px */
  padding: 9px 12px;
}

/* --- Link Buttons (Admin Functions toggle) --- */
body.large-font .linkbtn {
  font-size: 17px;    /* normal: 13px */
}

/* --- Primary Buttons (Save/Cancel) --- */
body.large-font .primary {
  font-size: 17px;    /* inherits from .btn but restate for clarity */
}

/* --- Pick List (record picker modal) --- */
body.large-font .pick-title {
  font-size: 17px;    /* normal: ~14px inherited */
}
body.large-font .pick-sub {
  font-size: 16px;    /* normal: 12px */
}
body.large-font .pick-row {
  padding: 14px 12px; /* slightly more vertical padding */
}

/* --- Pill Menus (hamburger, territory, language dropdowns) --- */
body.large-font .pill-item {
  font-size: 17px;    /* normal: 13px */
  padding: 10px 12px;
}
body.large-font .pill-item-label {
  font-size: 17px;    /* matches pill-item */
}

/* --- Checkbox Lines (Do Not Call, Borders, etc.) --- */
body.large-font .checkline {
  font-size: 17px;    /* normal: 13px */
}

/* --- Admin Section --- */
body.large-font .admin-tip {
  font-size: 17px;    /* normal: 13px */
}
body.large-font .admin-geocode .admin-tip {
  font-size: 17px;    /* normal: 13px */
}

/* --- Muted / Status Text --- */
body.large-font .muted {
  font-size: 17px;    /* normal: 13px */
}

/* --- Help Modal Content --- */
body.large-font #help-overlay span {
  font-size: 17px;    /* legend descriptions */
}
body.large-font #help-overlay h5 {
  font-size: 18px;    /* section headers in legend */
}

/* --- Documentation Modal --- */
body.large-font .doc-content {
  font-size: 18px;    /* normal: ~16px inherited */
}
body.large-font .doc-content h2 {
  font-size: 28px;    /* normal: 24px */
}
body.large-font .doc-content h3 {
  font-size: 24px;    /* normal: 20px */
}
body.large-font .doc-header h1 {
  font-size: 32px;    /* normal: 28px */
}

/* --- Change PIN Modal Labels --- */
body.large-font #change-pin-overlay label,
body.large-font #change-pin-overlay .modal-title {
  font-size: 18px;
}
body.large-font #change-pin-overlay input {
  font-size: 18px;
  padding: 12px;
}

/* --- Pin Adjust Hint Steps --- */
body.large-font #pinAdjustHint {
  font-size: 18px;    /* normal: 14px */
}

/* --- Login Box (boot screen) --- */
body.large-font #loginBox label {
  font-size: 17px !important;  /* normal: 13px */
}
body.large-font #loginBox .inp {
  font-size: 18px;
}

/* --- Attempt Select Dropdowns --- */
body.large-font #Attempt1Select,
body.large-font #Attempt2Select,
body.large-font #Attempt3Select {
  font-size: 18px;
}

/* --- Hamburger Menu: Accessibility Sub-header --- */
body.large-font .hamburger-section-label {
  font-size: 14px;    /* normal: 11px */
}

/* --- Calls List Modal --- */
body.large-font #calls-list .pick-row {
  padding: 14px 12px;
}
body.large-font #calls-list .pick-title {
  font-size: 17px;
}
body.large-font #calls-list .pick-sub {
  font-size: 16px;
}



/****************
 * Territory Selector Modal (centered overlay, independent of .pill-menu)
 ****************/
.territory-modal {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(88vw, 500px);
  min-width: 330px;
  max-width: 500px;
  max-height: min(75vh, 600px);
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  z-index: 30000;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 8px;
}

/* ID Search modal — own ID-based styles, not shared with territory-modal */
#id-search-modal {
  display: none;
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(80vw, 320px);
  min-width: 260px;
  z-index: 30000;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 20px;
}

@media (max-width: 375px) {
  .territory-modal {
    min-width: calc(100vw - 40px);
  }
}

/* ============================================
   BACKGROUND REFRESH STATUS BAR
   Bottom-right corner notification showing background data refresh progress.
   Only appears when loading from cache + refreshing in background.
   ============================================ */
#bg-status-bar {
  position: fixed;
  bottom: 16px;
  right: 16px;
  z-index: 9000;
  background: rgba(0,0,0,0.82);
  color: #fff;
  font-size: 12px;
  font-family: system-ui, -apple-system, sans-serif;
  padding: 8px 14px;
  border-radius: 10px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
  display: none;               /* hidden by default */
  max-width: 260px;
  pointer-events: none;        /* don't block map interaction */
  transition: opacity 0.4s ease;
  line-height: 1.4;
}

#bg-status-bar.visible {
  display: block;
}

#bg-status-bar.fade-out {
  opacity: 0;
}

/* Large font mode support */
body.large-font #bg-status-bar {
  font-size: 15px;
  padding: 10px 16px;
  max-width: 300px;
}

.doc-scroll {
  max-width: 900px;
  max-height: 80vh;
  overflow-y: auto;
  margin: 0 auto;
}


</style>
