:root {
    --primary: #2d3748;
    --bg-overlay: rgba(255, 255, 255, 0.95);
    --shadow: 0 4px 20px rgba(0,0,0,0.15);
    --radius: 16px;
}
body { 
    margin: 0; 
    padding: 0; 
    height: 100vh; 
    height: -webkit-fill-available;
    width: 100vw; 
    overflow: hidden; 
    font-family: 'Cairo', sans-serif; 
    background: #e2e8f0; 
    touch-action: pan-x pan-y; /* Disable double-tap zoom and pinch-zoom on non-map elements */
}
html {
    height: -webkit-fill-available;
}
#map { height: 100%; width: 100%; position: absolute; top: 0; right: 0; background: #cbd5e0; }
#mapDrawOverlay {
    position: fixed;
    inset: 0;
    z-index: 4;
    display: none;
    touch-action: none;
    cursor: crosshair;
    background: transparent;
    -webkit-user-select: none;
    user-select: none;
}
#mapDrawOverlay.active {
    display: block;
}
body.drawing-active {
    touch-action: none;
    overscroll-behavior: none;
}
.hud-container { 
    position: absolute; 
    pointer-events: none; 
    top: 0; 
    left: 0; 
    right: 0; 
    bottom: 0; 
    padding: 12px; 
    padding-top: calc(12px + env(safe-area-inset-top));
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
    display: flex; 
    flex-direction: column; 
    justify-content: space-between; 
    z-index: 5; 
}
.stats-bar { display: flex; justify-content: flex-end; align-items: flex-start; pointer-events: auto; }
.active-tool-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-overlay);
    backdrop-filter: blur(10px);
    padding: 12px 20px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    border: 1px solid rgba(255,255,255,0.5);
    pointer-events: auto;
    margin-bottom: 10px;
}
.tool-info {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    color: #2d3748;
}
.tool-info i {
    color: #2b6cb0;
}
.close-tool-btn {
    background: #f7fafc;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #4a5568;
    transition: all 0.2s;
}
.close-tool-btn:hover {
    background: #e53e3e;
    color: white;
}
.card { background: var(--bg-overlay); backdrop-filter: blur(10px); padding: 12px; border-radius: 12px; box-shadow: var(--shadow); border: 1px solid rgba(255,255,255,0.5); transition: transform 0.2s; }
.progress-card { min-width: 140px; padding: 10px; }
.title-row { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.app-title { font-weight: 900; font-size: 12px; color: #1a202c; margin: 0; }
.progress-track { height: 5px; background: #e2e8f0; border-radius: 3px; overflow: hidden; margin: 5px 0; }
.progress-fill { height: 100%; background: linear-gradient(90deg, #48bb78, #38a169); width: 0%; transition: width 1s cubic-bezier(0.4, 0, 0.2, 1); }
.stats-text { display: flex; justify-content: space-between; font-size: 9px; font-weight: 700; color: #4a5568; }
.controls { display: flex; flex-direction: column; align-items: stretch; gap: 6px; }
.controls-row { display: flex; gap: 4px; justify-content: space-between; }
.icon-btn { width: 34px; height: 34px; display: flex; align-items: center; justify-content: center; background: white; border-radius: 8px; box-shadow: var(--shadow); color: #4a5568; text-decoration: none; font-size: 14px; border: none; cursor: pointer; pointer-events: auto; position: relative; overflow: hidden; }
.icon-btn:hover { color: #2b6cb0; background: #f7fafc; }
.icon-btn.primary { background: #2b6cb0; color: white; }
#mapRefreshBtn.is-holding { color: #2b6cb0; background: #ebf8ff; }
#mapRefreshBtn.hard-refresh-ready { color: #c53030; background: #fff5f5; box-shadow: 0 0 0 2px rgba(229, 62, 62, 0.35); }
#mapRefreshBtn.is-holding i { animation: mapRefreshSpin 0.75s linear infinite; }
#mapRefreshBtn.is-refreshing i { animation: mapRefreshSpin 0.55s linear infinite; }
#mapRefreshBtn .refresh-hold-ring {
    position: absolute;
    inset: 3px;
    border-radius: 6px;
    border: 2px solid transparent;
    border-top-color: #e53e3e;
    opacity: 0;
    transform: rotate(0deg);
    pointer-events: none;
}
#mapRefreshBtn.is-holding .refresh-hold-ring {
    opacity: 1;
    animation: mapRefreshRing 0.65s linear forwards;
}
@keyframes mapRefreshSpin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}
@keyframes mapRefreshRing {
    from { transform: rotate(0deg); border-top-color: #4299e1; }
    to { transform: rotate(360deg); border-top-color: #e53e3e; }
}
.staff-select { height: 34px; padding: 0 24px 0 12px; border-radius: 8px; border: none; background: white; box-shadow: var(--shadow); font-family: 'Cairo', sans-serif; font-weight: 700; color: #4a5568; cursor: pointer; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%234a5568' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: left 8px center; font-size: 12px; min-width: 120px; pointer-events: auto; }
.bottom-bar { display: flex; justify-content: center; pointer-events: none; }
.legend { pointer-events: auto; background: var(--bg-overlay); backdrop-filter: blur(10px); padding: 8px 14px; border-radius: 99px; display: flex; gap: 12px; box-shadow: var(--shadow); font-size: 10px; font-weight: 700; }
.legend-item { display: flex; align-items: center; gap: 5px; cursor: pointer; opacity: 0.7; transition: opacity 0.2s; }
.legend-item.active { opacity: 1; }
.dot { width: 8px; height: 8px; border-radius: 50%; }
.custom-iw { padding: 4px; min-width: 140px; text-align: right; }
.custom-iw h3 { margin: 0 0 2px 0; font-size: 11px; color: #2d3748; }
.custom-iw .meta { color: #718096; font-size: 9px; margin-bottom: 4px; }
.custom-iw .btn-action { display: block; text-align: center; background: #2b6cb0; color: white; text-decoration: none; padding: 3px; border-radius: 4px; font-weight: 700; font-size: 9px; border: none; cursor: pointer; font-family: 'Cairo', sans-serif; width: 100%; }
.custom-iw .btn-action:hover { background: #2c5282; }
.custom-iw .btn-drive { background: #38a169; }
.custom-iw .btn-drive:hover { background: #2f855a; }
.custom-iw .meta-row { margin-bottom: 1px; display: flex; align-items: center; gap: 3px; font-size: 9px; color: #4a5568; }
.custom-iw .status-row { margin-top: 1px; font-weight: bold; font-size: 9px; }
.task-panel { position: fixed; bottom: 0; left: 0; right: 0; height: 70vh; background: white; z-index: 2000; border-top-left-radius: 24px; border-top-right-radius: 24px; box-shadow: 0 -4px 20px rgba(0,0,0,0.2); transform: translateY(100%); transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1); display: flex; flex-direction: column; }
.task-panel.open { transform: translateY(0); }
.panel-header { padding: 16px 24px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid #edf2f7; background: #fff; border-top-left-radius: 24px; border-top-right-radius: 24px; }
.panel-title { font-weight: 700; font-size: 16px; color: #2d3748; }
.close-btn { background: #f7fafc; border: none; width: 36px; height: 36px; border-radius: 50%; cursor: pointer; display: flex; align-items: center; justify-content: center; color: #4a5568; font-size: 16px; transition: all 0.2s; }
iframe { flex: 1; border: none; width: 100%; background: #f5f7fb; }
.panel-overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.4); z-index: 1999; opacity: 0; pointer-events: none; transition: opacity 0.3s; backdrop-filter: blur(2px); }
.panel-overlay.open { opacity: 1; pointer-events: auto; }
.marker-label { background: rgba(255, 255, 255, 0.95); padding: 3px 8px; border-radius: 4px; box-shadow: 0 1px 4px rgba(0,0,0,0.25); white-space: normal; max-width: 150px; text-align: center; line-height: 1.3; }
.search-modal { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.5); backdrop-filter: blur(4px); z-index: 2500; display: flex; align-items: flex-start; justify-content: center; padding: 60px 20px; opacity: 0; pointer-events: none; transition: opacity 0.3s ease; }
.search-modal.open { opacity: 1; pointer-events: auto; }
.search-modal-content { background: white; border-radius: 16px; width: 100%; max-width: 500px; max-height: 70vh; box-shadow: 0 10px 40px rgba(0,0,0,0.3); overflow: hidden; transform: translateY(-20px); transition: transform 0.3s ease; }
.search-header { display: flex; align-items: center; gap: 12px; padding: 16px 20px; background: linear-gradient(135deg, #2b6cb0, #3182ce); color: white; }
.search-header input { flex: 1; border: none; background: rgba(255,255,255,0.2); padding: 12px 16px; border-radius: 10px; font-family: 'Cairo', sans-serif; font-size: 16px; color: white; direction: rtl; }
.search-results { max-height: calc(70vh - 80px); overflow-y: auto; }
.search-result-item { display: flex; align-items: center; gap: 12px; padding: 14px 20px; cursor: pointer; border-bottom: 1px solid #edf2f7; transition: background 0.2s; }
.search-result-item:hover { background: #f7fafc; }
.result-dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }
.result-info { flex: 1; min-width: 0; }
.result-name { font-weight: 700; color: #2d3748; font-size: 14px; margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.result-meta { font-size: 12px; color: #718096; display: flex; gap: 12px; }

/* Floating Action Button */
.fab-container {
    position: absolute;
    bottom: 80px;
    right: 24px;
    z-index: 1000;
    pointer-events: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.fab-btn {
    width: 56px;
    height: 56px;
    background: #48bb78;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    border: none;
    cursor: pointer;
    font-size: 24px;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.fab-btn.secondary {
    background: #2b6cb0;
    width: 56px;
    height: 56px;
    font-size: 24px;
}
.fab-btn:hover {
    transform: scale(1.1);
}
.fab-btn:not(.secondary):hover {
    background: #38a169;
}
.fab-btn.secondary:hover {
    background: #2c5282;
}
.fab-btn:active {
    transform: scale(0.9);
}

/* Map Modal for Community Notes */
.map-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 3000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
    pointer-events: auto;
}
.map-modal.active { display: flex; }
.map-modal-content {
    background: white;
    border-radius: 20px;
    padding: 0;
    max-width: 95%;
    width: 90%;
    max-height: 90vh;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    animation: slideUp 0.3s ease;
}
@keyframes slideUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
.map-modal-header {
    padding: 16px 20px;
    border-bottom: 2px solid #e9ecef;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.map-modal-header h3 { margin: 0; font-size: 1.1rem; font-weight: 700; color: #2d3748; }
.map-modal-close {
    background: rgba(220, 53, 69, 0.9);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.map-container-inner { width: 100%; height: 400px; position: relative; overflow: hidden; }
.map-my-location-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: white;
    border: 2px solid #2b6cb0;
    border-radius: 8px;
    box-shadow: none;
    color: #2b6cb0;
    font-size: 0.95rem;
    font-weight: 600;
    font-family: 'Cairo', sans-serif;
    padding: 10px 24px;
    cursor: pointer;
    transition: all 0.2s;
    width: auto;
    height: auto;
}
.map-my-location-btn:hover {
    background: #ebf8ff;
    color: #2c5282;
}
.map-my-location-btn:active {
    transform: scale(0.98);
}
.map-my-location-btn:disabled {
    opacity: 0.7;
    cursor: wait;
}
#locationPickerMap { width: 100%; height: 100%; }
.map-instructions {
    padding: 12px 20px 16px;
    background: #f8f9fa;
    border-top: 1px solid #e9ecef;
    text-align: center;
    color: #495057;
    font-size: 0.9rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}
.map-instructions-text {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    line-height: 1.5;
}
.map-instructions .map-modal-secondary-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    justify-content: center;
    width: 100%;
}
.map-instructions .map-modal-secondary-actions .map-my-location-btn {
    gap: 6px;
    font-size: 0.8rem;
    font-weight: 600;
    padding: 6px 12px;
    border-width: 1.5px;
    border-radius: 6px;
    width: 100%;
    max-width: 260px;
}
.map-instructions .map-modal-secondary-actions .map-my-location-btn i {
    font-size: 0.85rem;
}
.map-modal-actions {
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}
.map-modal-actions-row {
    display: flex;
    gap: 12px;
    justify-content: center;
    width: 100%;
}
.map-save-btn {
    background: #2b6cb0;
    color: white;
    border: none;
    padding: 10px 24px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
}
.map-cancel-btn {
    background: #e2e8f0;
    color: #4a5568;
    border: none;
    padding: 10px 24px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
}

/* Community Note Modal */
.note-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 3100;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
    pointer-events: auto;
}
.note-modal.active { display: flex; }
.note-modal-content {
    background: white;
    border-radius: 20px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    animation: slideUp-note 0.3s ease;
    position: relative;
}
.modal-close-x {
    position: absolute;
    top: 15px;
    left: 15px;
    z-index: 10;
    background: rgba(0,0,0,0.5);
    color: white;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    backdrop-filter: blur(4px);
}
.modal-close-x:hover {
    background: rgba(220, 53, 69, 0.9);
    transform: scale(1.1);
}
@keyframes slideUp-note {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
.note-preview-img {
    width: 100%;
    height: 300px;
    object-fit: cover;
    display: block;
    cursor: pointer;
    margin: 0;
    padding: 0;
}
#note-view-images {
    background: #fff;
    line-height: 0;
    font-size: 0;
}
.note-input-thumbs {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 12px;
    padding: 20px;
    background: #f8fafc;
    border-bottom: 1px solid #eee;
}
.note-input-thumb {
    width: 100%;
    height: 100%;
    border-radius: 12px;
    object-fit: cover;
    border: 2px solid #e2e8f0;
}
.note-input-thumb-wrapper {
    position: relative;
    width: 80px;
    height: 80px;
}
.note-thumb-community {
    position: absolute;
    bottom: 4px;
    left: 4px;
    right: 4px;
    background: rgba(0,0,0,0.6);
    color: white;
    font-size: 9px;
    padding: 2px;
    border-radius: 4px;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    pointer-events: none;
    font-weight: bold;
}
.note-thumb-remove {
    position: absolute;
    top: -6px;
    right: -6px;
    background: #f56565;
    color: white;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    border: 2px solid white;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    z-index: 5;
    transition: transform 0.2s;
}
.note-thumb-remove:hover {
    transform: scale(1.1);
    background: #e53e3e;
}
.note-thumb-upload-status {
    position: absolute;
    inset: 0;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: white;
    z-index: 4;
    pointer-events: none;
}
.note-thumb-upload-status.uploading {
    background: rgba(0, 0, 0, 0.45);
}
.note-thumb-upload-status.done {
    background: rgba(72, 187, 120, 0.85);
}
.note-thumb-upload-status.error {
    background: rgba(245, 101, 101, 0.9);
    pointer-events: auto;
    cursor: pointer;
}
.note-add-btn {
    width: 80px;
    height: 80px;
    border-radius: 12px;
    border: 2px dashed #cbd5e0;
    background: #fff;
    color: #718096;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1.5rem;
    transition: all 0.2s;
}
.note-add-btn:hover {
    border-color: #667eea;
    color: #667eea;
    background: #ebf4ff;
}
.note-images-container {
    display: flex;
    overflow-x: auto;
    gap: 10px;
    padding: 10px;
    background: #f1f5f9;
    position: relative;
}
/* Gradient fade for horizontal scroll */
.note-images-wrapper {
    position: relative;
    background: #f1f5f9;
    border-bottom: 1px solid #eee;
}
.note-images-wrapper::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 40px;
    height: 100%;
    background: linear-gradient(to right, #f1f5f9, transparent);
    pointer-events: none;
    z-index: 2;
    opacity: 0;
    transition: opacity 0.2s;
}
.note-images-wrapper.has-left-scroll::after {
    opacity: 1;
}
.note-images-wrapper::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 40px;
    height: 100%;
    background: linear-gradient(to left, #f1f5f9, transparent);
    pointer-events: none;
    z-index: 2;
    opacity: 0;
    transition: opacity 0.2s;
}
.note-images-wrapper.has-right-scroll::before {
    opacity: 1;
}
.note-thumb-small {
    width: 80px;
    height: 80px;
    object-fit: cover;
    border-radius: 8px;
    cursor: pointer;
    border: 2px solid transparent;
    flex-shrink: 0;
}
.note-thumb-small.active {
    border-color: #667eea;
}
.note-modal-body { padding: 20px; overflow-y: auto; }

.note-view-title { font-weight: 700; font-size: 1.2rem; margin-bottom: 5px; color: #2d3748; }
.note-view-meta { font-size: 0.85rem; color: #718096; margin-bottom: 15px; display: flex; gap: 15px; }
.note-view-text { 
    background: #f7fafc; 
    padding: 15px; 
    border-radius: 12px; 
    font-size: 1rem; 
    color: #4a5568; 
    line-height: 1.6;
    border-right: 4px solid #667eea;
}

.form-group { margin-bottom: 20px; }
.problem-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-weight: 700;
    color: #2d3748;
}
.problem-label-content { display: flex; align-items: center; gap: 8px; }
.problem-label-text { font-size: 0.95rem; }

textarea#community-notes-text {
    width: 100%;
    height: 120px;
    padding: 12px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-family: 'Cairo', sans-serif;
    font-size: 1rem;
    resize: none;
    box-sizing: border-box;
    transition: border-color 0.2s;
}
textarea#community-notes-text:focus {
    outline: none;
    border-color: #667eea;
}

.voice-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #ebf4ff;
    color: #667eea;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}
.voice-btn.recording {
    background: #fff5f5;
    color: #f56565;
    animation: pulse-voice 1.5s infinite;
}
@keyframes pulse-voice {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.voice-status {
    font-size: 0.8rem;
    margin-top: 5px;
    color: #f56565;
    min-height: 1.2em;
}

/* Voice Meter Styles */
.voice-meter {
    height: 10px;
    background: #f1f3f5;
    border-radius: 6px;
    margin-top: 10px;
    overflow: hidden;
    display: none;
    border: 1px solid #e2e8f0;
}
.voice-meter.active { display: block; }
.voice-meter-level {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #6ee7b7, #22c55e, #16a34a);
    transition: width 80ms linear;
    border-radius: 6px;
}

.note-modal-actions {
    padding: 0 20px 20px;
    display: flex;
    gap: 12px;
}
.custom-site-visit-header {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 10px;
    padding: 14px 16px 12px;
    border-bottom: 1px solid #edf2f7;
}
.custom-site-visit-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    text-align: center;
    line-height: 1.4;
    color: #2d3748;
    min-width: 0;
}
#customSiteVisitModal .custom-site-visit-content {
    max-width: 400px;
}
#customSiteVisitModal .custom-site-close-btn {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background: #edf2f7;
    color: #4a5568;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.2s;
}
#customSiteVisitModal .custom-site-close-btn:hover {
    background: #fed7d7;
    color: #c53030;
}
#customSiteVisitModal .note-back-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #edf2f7;
    color: #2d3748;
    border: none;
    padding: 6px 10px;
    border-radius: 8px;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    font-family: 'Cairo', sans-serif;
    flex-shrink: 0;
    white-space: nowrap;
}
#customSiteVisitModal .note-back-btn:hover {
    background: #e2e8f0;
    color: #2b6cb0;
}
#customSiteVisitModal .note-modal-body {
    overflow-x: hidden;
    padding-top: 16px;
}
#customSiteVisitModal .custom-site-form-group {
    margin-top: 0;
    width: 100%;
    min-width: 0;
}
#customSiteVisitModal .custom-site-name-input,
#customSiteVisitModal .custom-site-community-box {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}
#customSiteVisitModal .custom-site-name-input {
    padding: 12px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-family: 'Cairo', sans-serif;
}
#customSiteVisitModal .custom-site-community-box {
    margin-top: 10px;
    font-size: 14px;
    color: #4a5568;
    background: #f7fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 10px 12px;
}
#customSiteVisitModal .custom-site-community-box strong {
    color: #2d3748;
}
#customSiteVisitModal .custom-site-staff-label {
    margin-top: 14px;
}
#customSiteVisitModal .custom-site-assigned-select {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    padding: 12px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-family: 'Cairo', sans-serif;
    font-size: 1rem;
    color: #2d3748;
    background: #fff;
}
.note-save-btn {
    flex: 2;
    background: #48bb78;
    color: white;
    border: none;
    padding: 12px;
    border-radius: 12px;
    font-weight: 700;
    cursor: pointer;
    font-family: 'Cairo', sans-serif;
}
.note-cancel-btn {
    flex: 1;
    background: #e2e8f0;
    color: #4a5568;
    border: none;
    padding: 12px;
    border-radius: 12px;
    font-weight: 700;
    cursor: pointer;
    font-family: 'Cairo', sans-serif;
}

/* Source Selection Modal */
.source-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    z-index: 3200;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(5px);
    pointer-events: auto;
}
.source-modal.active { display: flex; }
.source-modal-content {
    background: white;
    border-radius: 20px;
    width: 90%;
    max-width: 400px;
    padding: 24px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    text-align: center;
    animation: slideUp-note 0.3s ease;
    position: relative;
}
.source-title { font-weight: 700; font-size: 1.2rem; margin-bottom: 20px; color: #2d3748; }
.source-options { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.source-opt-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 24px;
    background: #f7fafc;
    border: 2px solid #e2e8f0;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.2s;
    color: #4a5568;
}
.source-opt-btn:hover {
    border-color: #667eea;
    background: #ebf4ff;
    color: #667eea;
    transform: translateY(-4px);
}
.source-opt-btn i { font-size: 2rem; }
.source-opt-btn span { font-weight: 700; font-size: 0.95rem; }
/* Success Toast Styles */
.toast-container {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    pointer-events: none;
}
.toast {
    background: white;
    padding: 16px 24px;
    border-radius: 16px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    gap: 12px;
    animation: toastSlideIn 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border-right: 4px solid #48bb78;
    pointer-events: auto;
}
.toast.hiding {
    animation: toastSlideOut 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}
.toast-icon {
    width: 32px;
    height: 32px;
    background: #48bb78;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}
.toast-message {
    font-weight: 700;
    color: #2d3748;
    font-size: 1rem;
}
@keyframes toastSlideIn {
    from { transform: translateY(-100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
@keyframes toastSlideOut {
    from { transform: translateY(0); opacity: 1; }
    to { transform: translateY(-100%); opacity: 0; }
}

/* Marker Pulse Animation */
.marker-pulse {
    position: absolute;
    width: 40px;
    height: 40px;
    background: rgba(43, 108, 176, 0.4);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 0;
}
.marker-pulse::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 50%;
    border: 2px solid #2b6cb0;
    animation: pulse-ring 1.5s cubic-bezier(0.215, 0.61, 0.355, 1) infinite;
}
@keyframes pulse-ring {
    0% { transform: scale(0.3); opacity: 1; }
    80%, 100% { transform: scale(2.5); opacity: 0; }
}

/* Marker Label Positioning */
.marker-label-top {
    margin-top: -45px;
    white-space: nowrap;
    background: rgba(255, 255, 255, 0.9);
    padding: 2px 8px;
    border-radius: 4px;
    border: 1px solid #ed8936;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    pointer-events: none;
}

/* Change Order Tool Box Styles */
.tool-box {
    position: fixed;
    bottom: -300px;
    left: 50%;
    transform: translateX(-50%);
    width: 95%;
    max-width: 600px;
    background: white;
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -10px 40px rgba(0,0,0,0.2);
    z-index: 3000;
    transition: bottom 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 20px;
    pointer-events: auto;
}
.tool-box.active {
    bottom: 0;
}
.tool-box-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #edf2f7;
}
.tool-box-header span {
    font-weight: 700;
    font-size: 1.1rem;
    color: #2d3748;
}
.close-tool-box {
    background: #f7fafc;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    color: #4a5568;
}
.tool-box-content {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}
.tool-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 8px;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    color: #4a5568;
    box-shadow: 0 2px 4px rgba(0,0,0,0.02);
    position: relative;
    overflow: hidden;
}
.tool-btn i {
    font-size: 1.2rem;
    color: #4a5568;
    transition: color 0.2s;
}
.tool-btn span {
    font-size: 0.75rem;
    font-weight: 700;
    text-align: center;
}
.tool-btn:hover {
    background: #f8fafc;
    border-color: #cbd5e0;
    transform: translateY(-1px);
}
.tool-btn.active {
    border-color: #3182ce;
    background: #ebf8ff;
    color: #2b6cb0;
    box-shadow: 0 4px 12px rgba(49, 130, 206, 0.15);
}
.tool-btn.active i {
    color: #3182ce;
}
.tool-btn .tool-badge {
    position: absolute;
    top: 4px;
    right: 4px;
    background: #3182ce;
    color: white;
    font-size: 8px;
    padding: 2px 5px;
    border-radius: 10px;
    display: none;
}
.tool-btn.active .tool-badge {
    display: block;
}
.tool-btn.secondary {
    background: #f7fafc;
}
.fab-btn.change-order-btn {
    background: #6b46c1;
}

/* Layer Settings Styles */
.layers-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
}
.layer-item {
    padding: 10px;
    background: #f8fafc;
    border-radius: 12px;
    border: 1px solid #e2e8f0;
}

/* Layer Manager Card */
.layer-manager-card {
    position: absolute;
    top: 100px;
    right: 12px;
    width: 250px;
    background: var(--bg-overlay);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    box-shadow: var(--shadow);
    border: 1px solid rgba(255,255,255,0.5);
    padding: 16px;
    z-index: 10;
    display: none;
    pointer-events: auto;
}

/* Mobile Adjustments */
@media (max-width: 768px) {
    .hud-container {
        padding: 8px;
    }
    
    .stats-bar {
        flex-direction: column;
        gap: 8px;
    }
    
    .progress-card {
        width: 100%;
        box-sizing: border-box;
    }
    
    .controls {
        width: 100%;
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .legend {
        width: 90%;
        justify-content: center;
        overflow-x: auto;
        white-space: nowrap;
        padding: 8px 12px;
    }
    
    .fab-container {
        bottom: 100px;
        right: 16px;
    }
    
    .layer-manager-card {
        top: auto;
        bottom: 80px;
        left: 12px;
        right: 12px;
        width: auto;
        max-width: none;
        z-index: 1100; /* Above FABs */
    }
    
    .map-modal-content {
        width: 95%;
        max-height: 85vh;
    }
    
    .map-container-inner {
        height: 300px;
    }
}

.layer-manager-card.active {
    display: block;
}
.layer-manager-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    font-weight: 900;
    color: #1a202c;
    font-size: 14px;
}
.close-layer-btn {
    background: #f7fafc;
    border: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #4a5568;
    font-size: 12px;
}
.close-layer-btn:hover {
    background: #e2e8f0;
}

.switch-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    width: 100%;
    font-weight: 700;
    color: #2d3748;
}
.switch-label input[type="checkbox"] {
    width: 40px;
    height: 20px;
    appearance: none;
    background: #cbd5e0;
    border-radius: 20px;
    position: relative;
    outline: none;
    cursor: pointer;
    transition: background 0.3s;
}
.switch-label input[type="checkbox"]:checked {
    background: #48bb78;
}
.switch-label input[type="checkbox"]::before {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    background: white;
    border-radius: 50%;
    top: 2px;
    left: 2px;
    transition: transform 0.3s;
}
.switch-label input[type="checkbox"]:checked::before {
    transform: translateX(20px);
}
