/* Field controls sized for touch; browser zoom remains available. */
.cloud-backup h2 { font-size: 20px; font-weight: 800; }
.cloud-backup button { min-height: 48px; padding: 12px 16px; margin: 4px 8px 4px 0; border-radius: 10px; background: #0369a1; color: white; font-weight: 700; }
.cloud-backup label { display: block; margin-top: 10px; }
.cloud-backup input { display: block; width: 100%; min-height: 48px; padding: 10px; border: 1px solid #64748b; border-radius: 8px; background: #020617; color: white; }
.cloud-backup p { overflow-wrap: anywhere; }
.map-choose-button { margin: 12px 12px 0; padding: 14px; min-height: 48px; border-radius: 10px; background: #334155; color: white; font-weight: 700; }
.map-selection-help { padding: 8px 12px 12px; font-size: 13px; color: #cbd5e1; }
#mapSignChooser { width: min(540px, calc(100% - 24px)); max-height: calc(100dvh - 40px); margin: auto; padding: 18px; border: 1px solid #64748b; border-radius: 18px; background: #0f172a; color: #f8fafc; overflow-y: auto; }
#mapSignChooser::backdrop { background: rgba(2,6,23,.8); }
.map-chooser-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.map-chooser-header h2 { font-size: 19px; font-weight: 800; }
.map-chooser-header button { min-height: 48px; padding: 10px 14px; background: #334155; border-radius: 10px; }
#mapSignChooserHint { font-size: 14px; line-height: 1.5; margin: 12px 0; color: #cbd5e1; }
#mapSignChoices { display: grid; gap: 10px; }
.map-sign-choice { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 76px; padding: 12px; border: 1px solid #475569; border-radius: 12px; background: #1e293b; text-align: left; }
.map-sign-choice img { width: 44px; height: 52px; object-fit: contain; background: white; border-radius: 5px; flex-shrink: 0; }
.map-sign-choice strong { display: block; font-size: 15px; overflow-wrap: anywhere; }
.map-sign-choice span span { display: block; color: #cbd5e1; font-size: 13px; margin-top: 5px; }
.map-sign-choice[aria-current] { border: 2px solid #fbbf24; }
button:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
[hidden] { display: none !important; }
.measurement-neutral { padding: 8px 12px; border: 1px solid #64748b; border-radius: 10px; color: #cbd5e1; font-size: 13px; }
.capture-context { padding: 14px; border-left: 3px solid #f59e0b; background: #020617; font-weight: 700; overflow-wrap: anywhere; }
.sign-options { width: 100%; order: 5; }
.sign-options[open] { display: flex; flex-wrap: wrap; gap: 8px; }
.sign-options summary { width: 100%; }
#plannedSignsList > div > button { background: #f59e0b; color: #020617; font-weight: 700; }
.workflow-intro { padding: 16px; background: #0f172a; border-radius: 14px; border: 1px solid #334155; }
.workflow-intro strong { font-size: 20px; }
.workflow-intro p { color: #cbd5e1; margin: 8px 0 12px; }
.workflow-intro a, .workflow-next, #mobileResults a { display: inline-block; padding: 12px 0; color: #67e8f9; font-weight: 700; }
details > summary { cursor: pointer; padding: 14px 0; color: #cbd5e1; font-size: 14px; }
.demo-panel { border-top: 1px solid #334155; font-size: 14px; }
.demo-panel button, .result-card button { padding: 12px 16px; border: 1px solid #64748b; border-radius: 10px; margin: 8px 0; }
#demoBanner { padding: 12px; background: #78350f; color: #fef3c7; }
.demo-mode #captureSignContext::before { content: 'DEMO · '; color: #fbbf24; }
#mobileResults { display: none; }
#fieldNavigation a[aria-current] { background: #334155; box-shadow: inset 0 3px #fbbf24; }
@media (max-width: 767px) {
    main > .grid.grid-cols-4 { display: none; }
    #step2 .grid.grid-cols-3 { grid-template-columns: 1fr; }
    section h2 { text-transform: none !important; font-size: 18px !important; line-height: 1.35; }
    section label, section p, #scanStatus { font-size: 14px !important; line-height: 1.5; }
    #step3 #liveSightBadge { display: block; margin-top: 12px; }
    #step3 div:has(> #liveSightBadge) { display: block; }
    #liveSightBearing { display: block; font-size: 12px; }
    #step4 .overflow-x-auto { display: none; }
    #mobileResults { display: grid; gap: 12px; }
    .result-card { padding: 16px; background: #020617; border: 1px solid #334155; border-radius: 12px; }
    .result-card h3 { font-weight: 700; margin-bottom: 8px; }
    .result-card strong { display: inline-block; margin-bottom: 8px; }
    .result-pass { color: #6ee7b7; }
    .result-review { color: #fda4af; }
    #signGpsStatus, #sightGpsStatus { font-family: inherit; white-space: normal; }
    #step2 > div > div:first-child, #step3 > div > div:first-child { flex-wrap: wrap; gap: 8px; }
}
html { scroll-padding-top: 100px; }
button, a, input, select, textarea { touch-action: manipulation; }
button:focus-visible, a:focus-visible { outline: 3px solid #22d3ee; outline-offset: 3px; }
#fieldNavigation { display: none; }
.drive-upload-dialog { width: min(560px, calc(100% - 24px)); max-height: calc(100dvh - 32px);
    overflow-y: auto; border: 1px solid #475569; border-radius: 16px; padding: 24px;
    background: #0f172a; color: #e2e8f0; margin: auto; }
.drive-upload-dialog::backdrop { background: rgba(2,6,23,.8); }
.drive-upload-dialog h2 { font-size: 20px; font-weight: 800; margin: 0 44px 16px 0; }
.drive-upload-dialog p, .drive-upload-dialog li { font-size: 15px; line-height: 1.6; }
.drive-upload-dialog ul { list-style: disc; padding-left: 22px; margin: 16px 0; }
.drive-upload-dialog li { margin-bottom: 10px; }
.drive-dialog-close { float: right; }
.drive-dialog-close button { min-width: 44px; min-height: 44px; border-radius: 8px; background: #334155; }
.drive-browse-button { width: 100%; min-height: 52px; margin: 20px 0 12px; padding: 12px;
    border-radius: 10px; background: #0369a1; color: white; font-weight: 800; }
.drive-upload-dialog .drive-upload-note { font-size: 12px; color: #94a3b8; }
#workspaceGrid > *, main, section { min-width: 0; }
#selectedSignCoordinates, #selectedSignPlanned, #tgsBadge, #uploadedFileName { overflow-wrap: anywhere; }
@media (max-width: 1023px) {
    body { padding-bottom: calc(90px + env(safe-area-inset-bottom)); }
    button, select, input:not([type=checkbox]):not([type=file]), textarea,
    label:has(input[type=file]) { min-height: 48px; }
    input:not([type=checkbox]):not([type=file]), select, textarea { font-size: 16px !important; max-width: 100%; }
    input[type=checkbox] { width: 24px; height: 24px; flex-shrink: 0; }
    button { white-space: normal; }
    #fieldNavigation { display: grid; grid-template-columns: repeat(5, minmax(0,1fr)); position: fixed;
        bottom: 0; left: 0; right: 0; z-index: 45; background: #0f172a;
        border-top: 1px solid #475569; padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
    #fieldNavigation a { display: flex; flex-direction: column; align-items: center; justify-content: center;
        gap: 3px; min-height: 52px; font-size: 18px; border-radius: 8px; }
    #fieldNavigation a span { font-size: 11px; font-weight: 700; color: #e2e8f0; }
    #fieldNavigation a:active, #fieldNavigation a:focus-visible { background: #334155; }
    #map { height: clamp(320px, 52svh, 560px); }
    #mapPane > div:first-child { flex-wrap: wrap; gap: 8px; }
    #mapPane > div:first-child > div { flex: 1; justify-content: flex-end; }
    #mapPageStatus { flex-basis: 100%; font-size: 13px; }
    #mapPane .leaflet-control-zoom a { width: 44px; height: 44px; line-height: 44px; }
    #selectedSignCard { padding: 14px; }
    #selectedSignCard > div { display: grid; grid-template-columns: 1fr 1fr; }
    #selectedSignCard p { font-size: 13px; line-height: 1.5; }
    #selectedSignCard button { font-weight: 700; }
    #pdfPageControls { gap: 6px; flex-wrap: wrap; }
    #pdfPane > div:first-child { flex-wrap: wrap; gap: 8px; }
    #pdfPageControls button { min-width: 44px; }
    #tgsViewerContainer { min-height: 220px; max-height: 65svh; align-items: flex-start; justify-content: flex-start; }
    /* Preserve drawing geometry; larger boxes would select neighbouring signs. */
    .pdf-sign-target { min-height: 0; min-width: 0; }
    .pdf-sign-target span { font-size: 9px; }
    #toast { bottom: calc(84px + env(safe-area-inset-bottom)); }
    #alignmentGuide { bottom: calc(84px + env(safe-area-inset-bottom)); }
    #plannedSignsList input { width: 100%; min-width: 0; }
    #plannedSignType { flex: 1 1 100%; min-width: 0; }
    table { min-width: 780px; }
    #step4 .overflow-x-auto { overscroll-behavior-x: contain; }
}
@media (min-width: 768px) and (max-width: 1023px) {
    #workspaceGrid.lg\:grid-cols-2 { grid-template-columns: repeat(2, minmax(0,1fr)); }
    #workspaceGrid.grid-cols-1:not(.lg\:grid-cols-2) { grid-template-columns: 1fr; }
    #tgsViewerContainer { min-height: 320px; }
}
@media (max-width: 600px) {
    header > div { padding-top: 8px !important; padding-bottom: 8px !important; flex-wrap: nowrap !important; }
    header h1 { font-size: 14px !important; }
    header p { display: none; }
    header > div > div:last-child { display: none; }
    main { padding-left: 8px !important; padding-right: 8px !important; }
    main > section { padding: 12px !important; }
    main > div:first-child { grid-template-columns: repeat(2,minmax(0,1fr)); }
    main > div:first-child a { display: flex; gap: 8px; align-items: center; text-align: left; }
    #mapPane > div:first-child > span { flex-basis: 100%; }
    #mapPane > div:first-child > div { justify-content: flex-start; }
    #mapPane > div:first-child button { padding-left: 12px; padding-right: 12px; }
    #selectedSignCard > div { grid-template-columns: 1fr; }
    section h2 { letter-spacing: .02em !important; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; }
}
.job-backup { border-top:1px solid #475569; margin-top:1rem; padding-top:1rem; }
.job-backup select { display:block; width:100%; min-height:48px; margin:8px 0; background:#0f172a; color:#e2e8f0; border:1px solid #64748b; border-radius:8px; padding:8px; }
.job-backup h3 { font-weight:800; font-size:1.1rem; }
.jobs-bar { display:flex; align-items:center; justify-content:space-between; gap:12px; }
.jobs-bar h2 { overflow-wrap:anywhere; font-size:1.2rem; font-weight:800; }
.jobs-bar button, #jobsScreen button { min-height:48px; padding:10px 16px; border-radius:8px; background:#036985; color:white; font-weight:700; }
#jobsScreen { width:min(95vw,580px); max-height:90dvh; overflow:auto; padding:20px; border:1px solid #64748b; border-radius:16px; background:#0f172a; color:#e2e8f0; }
#jobsScreen::backdrop { background:#020617cc; }
.jobs-heading { display:flex; justify-content:space-between; align-items:center; gap:12px; }
.jobs-heading h2 { font-size:1.5rem; font-weight:800; }
#jobsScreen p { margin:12px 0; }
#jobsScreen input { display:block; width:100%; min-height:48px; margin:6px 0 12px; padding:10px; background:#1e293b; color:white; border:1px solid #64748b; border-radius:8px; }
#jobsScreen form, #jobsScreen details { margin:16px 0; }
.job-card { padding:14px 0; border-top:1px solid #475569; }
.job-card h3 { font-weight:800; overflow-wrap:anywhere; }
.job-card p { overflow-wrap:anywhere; font-size:.9rem; }
#jobsScreen summary { min-height:48px; padding:12px 0; font-weight:700; color:#7dd3fc; cursor:pointer; }
#jobsScreen button:disabled { opacity:.6; }
.job-filters { display:flex; gap:8px; margin:16px 0; }
#jobsScreen .job-filters button { flex:1; background:#1e293b; border:1px solid #64748b; }
#jobsScreen .job-filters button[aria-pressed="true"] { background:#036985; border-color:#38bdf8; }
#jobsScreen .job-archive-action { margin:8px 0 0 8px; background:#334155; }
.job-progress h2 { font-size:1.2rem; font-weight:800; }
.progress-counts { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:8px; margin:14px 0; }
.progress-counts div { background:#1e293b; border:1px solid #475569; border-radius:10px; padding:12px 6px; text-align:center; }
.progress-counts strong { display:block; font-size:1.5rem; }
.progress-counts span { display:block; font-size:.85rem; }
.progress-help { font-size:.85rem; color:#cbd5e1; }
.job-progress button { min-height:48px; padding:10px 14px; background:#036985; border-radius:8px; font-weight:700; }
.job-progress summary { min-height:48px; padding:12px 0; color:#7dd3fc; font-weight:700; cursor:pointer; }
.job-progress .job-filters button[aria-pressed="true"] { outline:2px solid #38bdf8; }
.job-card-progress { font-weight:700; color:#bae6fd; }
.job-report-actions { display:flex; flex-wrap:wrap; gap:10px; margin-top:10px; }
#jobReportPreview { width:min(96vw,920px); max-width:96vw; height:94dvh; max-height:94dvh; padding:0; margin:auto; border:1px solid #64748b; border-radius:14px; background:#0f172a; color:#f8fafc; }
#jobReportPreview::backdrop { background:rgba(0,0,0,.7); }
.report-preview-shell { display:flex; flex-direction:column; height:100%; padding:12px; gap:8px; box-sizing:border-box; }
#jobReportPreview header { display:flex; justify-content:space-between; align-items:center; gap:10px; }
#jobReportPreview h2 { font-size:1.15rem; font-weight:800; }
#jobReportPreview button, #jobReportPreview select { min-height:44px; border-radius:8px; padding:8px 12px; background:#036985; color:white; font-weight:700; }
#jobReportPreview button:disabled { opacity:.45; }
#reportPreviewName { overflow-wrap:anywhere; font-size:.8rem; color:#cbd5e1; }
#reportPreviewStatus { font-size:.85rem; }
.report-preview-controls { display:flex; flex-wrap:wrap; align-items:center; gap:6px; }
#reportPageNumber { flex:1; text-align:center; font-size:.85rem; }
#reportPreviewViewport { flex:1; min-height:100px; overflow:auto; background:#475569; padding:12px; }
#reportPreviewCanvas { display:block; background:white; max-width:none; }
#reportPreviewCanvas[hidden] { display:none; }
#jobReportPreview details { max-height:25%; overflow:auto; font-size:.85rem; }
#jobReportPreview summary { padding:8px 0; cursor:pointer; }
#reportPreviewText { white-space:pre-wrap; color:#cbd5e1; }
#jobReportPreview footer { display:flex; flex-wrap:wrap; gap:6px; }
@media (max-width:480px) { #jobReportPreview { width:100vw; max-width:100vw; height:100dvh; max-height:100dvh; border-radius:0; } .report-preview-shell { padding:10px 10px max(10px,env(safe-area-inset-bottom)); } #jobReportPreview footer button { flex:1; } }
#jobReportPreview { overflow:hidden; }
#reportPageNumber { white-space:nowrap; min-width:75px; }
.report-preview-controls label { display:flex; align-items:center; gap:8px; }
@media (max-width:480px) { #jobReportPreview { width:100%; max-width:100%; } .report-preview-controls label { flex:1 0 100%; } .report-preview-controls select { flex:1; } }
#reportHistory { width:min(94vw,680px); max-height:92dvh; padding:18px; margin:auto; border:1px solid #64748b; border-radius:14px; background:#0f172a; color:#f8fafc; }
#reportHistory::backdrop { background:rgba(0,0,0,.65); }
#reportHistory header { display:flex; justify-content:space-between; align-items:center; gap:12px; }
#reportHistory h2 { font-size:1.2rem; font-weight:800; }
#reportHistory p { margin:10px 0; }
#reportHistory button { min-height:48px; padding:10px 14px; background:#036985; border-radius:8px; font-weight:700; }
#reportHistory button:disabled { opacity:.5; }
#reportHistoryList { margin-top:14px; }
#reportLabelEditor { width:min(94vw,520px); max-height:92dvh; margin:auto; padding:20px; border:1px solid #64748b; border-radius:14px; background:#0f172a; color:white; }
#reportLabelEditor::backdrop { background:rgba(0,0,0,.7); }
#reportLabelEditor h2 { font-size:1.2rem; font-weight:800; }
#reportLabelEditor label { display:block; margin:12px 0 5px; }
#reportLabelEditor input, #reportLabelEditor textarea, #reportHistory input { width:100%; padding:12px; border:1px solid #64748b; border-radius:8px; background:#1e293b; color:white; }
#reportLabelEditor p { font-size:.9rem; margin:12px 0; }
#reportLabelEditor button { min-height:48px; padding:10px 14px; margin:6px 8px 0 0; border-radius:8px; background:#036985; font-weight:700; }
#reportHistoryList button { margin:4px 8px 4px 0; }
#reportFinalStatus { padding:12px; background:#1e293b; border-radius:8px; }
#reportHistory .final-report-card { border:2px solid #22d3ee; padding:12px; border-radius:10px; }
.final-report-badge { display:inline-block; padding:4px 10px; margin-bottom:8px; border-radius:20px; background:#155e75; color:#cffafe; font-weight:800; }
