* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--app-bg-page);
    color: var(--app-text-primary);
    overflow: hidden;
    margin: 0;
    padding: 0;
}

/* Navbar Styles */
.navbar {
    width: 100vw;
    background-color: var(--app-bg-page);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    position: fixed;
    top: 0;
    left: 0;
    z-index: 50000;
}

.navbar-content {
    max-width: 100%;
    padding: 0 1rem;
    height: 4rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--app-text-inverse);
}

.navbar-left {
    display: flex;
    align-items: center;
    flex: 1;
    gap: 0.75rem;
}

.org-selector {
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    background-color: var(--app-bg-surface);
    border: 1px solid var(--app-border);
    color: var(--app-text-primary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s;
    min-width: 200px;
    max-width: 300px;
}

.org-selector:hover:not(:disabled) {
    background-color: var(--app-bg-hover);
    border-color: var(--app-border-strong);
}

.org-selector:focus {
    outline: none;
    border-color: var(--app-accent);
    box-shadow: 0 0 0 2px var(--app-focus-ring);
}

.org-selector:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.org-selector option {
    background-color: var(--app-bg-page);
    color: var(--app-text-primary);
}

.navbar-feedback-button {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1rem;
    border-radius: 0.375rem;
    background-color: var(--app-bg-surface);
    border: 1px solid var(--app-border);
    color: var(--app-text-primary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s, transform 0.1s;
    white-space: nowrap;
}

.navbar-feedback-button:hover {
    background-color: var(--app-bg-hover);
    border-color: var(--app-border-strong);
}

.navbar-feedback-button:active {
    transform: scale(0.98);
}

.navbar-center {
    display: flex;
    justify-content: center;
    align-items: center;
    flex: 1;
}

.navbar-title {
    font-size: 1.5rem;
    font-weight: 600;
    text-align: center;
    flex: 1;
    margin: 0;
}

.navbar-right {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
    position: relative;
    z-index: 2048;
    flex: 1;
}

/* Request Services Button */
.request-services-button {
    padding: 0.5rem 1rem;
    background: var(--app-accent);
    color: var(--app-text-inverse);
    border: none;
    border-radius: 0.375rem;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    margin-right: 0.75rem;
    transition: background-color 0.2s;
}

.request-services-button:hover {
    background: var(--app-accent-hover);
}

/* Address Search Styles */
.address-search-container {
    position: relative;
    width: 300px;
}

.address-input {
    width: 100%;
    padding: 0.4rem 2.5rem 0.4rem 0.75rem;
    background: var(--app-bg-surface);
    border: 1px solid var(--app-border);
    border-radius: 0.375rem;
    color: var(--app-text-inverse);
    font-size: 0.875rem;
    margin-top: 0.125rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.address-input:focus {
    outline: none;
    border-color: var(--app-border-strong);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.5);
}

.address-input::placeholder {
    color: var(--app-text-muted);
}

.location-button {
    position: absolute;
    right: 0.35rem;
    top: 50%;
    transform: translateY(-50%);
    background: var(--app-accent);
    border: none;
    border-radius: 0.25rem;
    color: var(--app-text-inverse);
    cursor: pointer;
    padding: 0.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s, transform 0.1s;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.location-button:hover {
    background: var(--app-accent-hover);
    transform: translateY(-50%) scale(1.05);
}

.location-button:active {
    transform: translateY(-50%) scale(0.95);
}

.location-button:disabled {
    opacity: 0.65;
    cursor: wait;
    transform: translateY(-50%);
}

.location-button:disabled:hover {
    transform: translateY(-50%);
    background: var(--app-accent);
}

.location-loading-indicator {
    display: none;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: var(--app-bg-surface-2);
    border: 1px solid var(--app-border);
    border-radius: 0.375rem;
    font-size: 0.8125rem;
    color: var(--app-text-secondary);
}

.address-search-container > .location-loading-indicator {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 0.25rem;
    z-index: 50000;
}

.location-loading-indicator--mobile {
    width: 100%;
    box-sizing: border-box;
}

.location-loading-spinner {
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-top-color: var(--app-link);
    border-radius: 50%;
    flex-shrink: 0;
    animation: photo-upload-spin 0.8s linear infinite;
}

.address-suggestions {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 0.25rem;
    background-color: var(--app-bg-surface-2);
    border: 1px solid var(--app-bg-muted);
    border-radius: 0.375rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    max-height: 15rem;
    overflow-y: auto;
    z-index: 50001;
    display: none;
}

.address-suggestions.show {
    display: block;
}

.suggestion-item {
    padding: 0.5rem 1rem;
    cursor: pointer;
    color: var(--app-text-inverse);
    transition: background-color 0.2s;
    font-size: 0.875rem;
}

.suggestion-item:not(:last-child) {
    border-bottom: 1px solid var(--app-bg-muted);
}

.suggestion-item:hover {
    background-color: var(--app-bg-surface);
}

/* Profile Menu Styles */
.profile-menu-container {
    position: relative;
}

.profile-menu-button-wrap {
    position: relative;
    display: inline-block;
}

.profile-menu-button-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: var(--app-danger, #c0392b);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
    box-shadow: 0 0 0 2px var(--app-bg-page, #fff);
    pointer-events: none;
}

.profile-menu-button {
    padding: 0.25rem 0.88rem;
    background: var(--app-bg-surface);
    border: 1px solid var(--app-border);
    border-radius: 0.375rem;
    color: var(--app-text-primary);
    cursor: pointer;
    font-size: 1.25rem;
    transition: background-color 0.2s;
}

.profile-menu-button:hover {
    background: var(--app-bg-hover);
}

.profile-dropdown {
    position: absolute;
    right: 0;
    top: 100%;
    margin-top: 0.5rem;
    background: var(--app-bg-page);
    border: 1px solid var(--app-bg-muted);
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    min-width: 160px;
    z-index: 50001;
    display: none;
}

.profile-dropdown.show {
    display: block;
}

.dropdown-greeting {
    padding: 0.75rem 1rem;
    color: var(--app-text-inverse);
    font-weight: 500;
    font-size: 0.9375rem;
    border-top-left-radius: 0.5rem;
    border-top-right-radius: 0.5rem;
    background: linear-gradient(135deg, var(--app-accent) 0%, #1e40af 100%);
}

.dropdown-divider {
    height: 1px;
    background: var(--app-bg-muted);
    margin: 0;
}

.dropdown-item {
    padding: 0.5rem 1rem;
    color: var(--app-text-primary);
    cursor: pointer;
    transition: background-color 0.2s;
}

.dropdown-item:hover {
    background: var(--app-bg-surface-2);
    color: var(--app-text-inverse);
}

.dropdown-item:first-child {
    border-top-left-radius: 0.5rem;
    border-top-right-radius: 0.5rem;
}

.dropdown-item:last-child {
    border-bottom-left-radius: 0.5rem;
    border-bottom-right-radius: 0.5rem;
}

.dropdown-item:not(:last-child) {
    border-bottom: 1px solid var(--app-bg-muted);
}

/* Account menu modal (☰) — replaces sidebar dropdown */
.account-menu-modal {
    overflow: hidden;
}

.account-menu-modal .account-menu-modal-body {
    padding: 0;
}

.account-menu-modal .account-menu-greeting {
    margin: 0;
    border-radius: 0;
}

.account-menu-list {
    display: flex;
    flex-direction: column;
}

.account-menu-item {
    display: block;
    width: 100%;
    padding: 0.75rem 1rem;
    text-align: left;
    background: var(--app-bg-page);
    border: none;
    border-bottom: 1px solid var(--app-bg-muted);
    color: var(--app-text-primary);
    font-size: 0.9375rem;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
    font-family: inherit;
}

.account-menu-item:last-child {
    border-bottom: none;
}

.account-menu-item:hover {
    background: var(--app-bg-surface-2);
    color: var(--app-text-inverse);
}

.account-menu-item--danger {
    color: #f87171;
}

.account-menu-item--danger:hover {
    background: rgba(239, 68, 68, 0.12);
    color: #fca5a5;
}

/* Toast (in-app notification) */
.toast-container {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 70001;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: none;
}
.toast-container .toast {
    pointer-events: auto;
    padding: 0.875rem 1.25rem;
    border-radius: 0.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    max-width: 380px;
    animation: toast-in 0.25s ease-out;
}
.toast-container .toast.toast-success {
    background: #14532d;
    border: 1px solid #166534;
    color: #dcfce7;
}
.toast-container .toast.toast-error {
    background: #450a0a;
    border: 1px solid #7f1d1d;
    color: #fecaca;
}
.toast-container .toast .toast-message {
    flex: 1;
    font-size: 0.9375rem;
    line-height: 1.4;
}
.toast-container .toast .toast-close {
    background: none;
    border: none;
    color: inherit;
    opacity: 0.8;
    font-size: 1.25rem;
    cursor: pointer;
    padding: 0.25rem;
    line-height: 1;
}
.toast-container .toast .toast-close:hover {
    opacity: 1;
}
@keyframes toast-in {
    from {
        opacity: 0;
        transform: translateY(0.5rem);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Photo upload status indicator */
.photo-upload-status {
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 70002;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1.25rem;
    background: #1e3a5f;
    border: 1px solid var(--app-accent);
    border-radius: 0.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    color: #e0e7ff;
    font-size: 0.9375rem;
    max-width: 90vw;
    pointer-events: none;
    animation: photo-upload-status-in 0.25s ease-out;
}
.photo-upload-status.photo-upload-status-success {
    background: #14532d;
    border-color: #166534;
    color: #dcfce7;
}
.photo-upload-status.photo-upload-status-error {
    background: #450a0a;
    border-color: #7f1d1d;
    color: #fecaca;
}
.photo-upload-status-spinner {
    width: 20px;
    height: 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: var(--app-text-inverse);
    border-radius: 50%;
    flex-shrink: 0;
    animation: photo-upload-spin 0.8s linear infinite;
}
.photo-upload-status-success .photo-upload-status-spinner,
.photo-upload-status-error .photo-upload-status-spinner {
    display: none;
}
.photo-upload-status-success::before,
.photo-upload-status-error::before {
    content: '';
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}
.photo-upload-status-success::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23166534' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6L9 17l-5-5'/%3E%3C/svg%3E");
}
.photo-upload-status-error::before {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23dc2626' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='10'/%3E%3Cline x1='15' y1='9' x2='9' y2='15'/%3E%3Cline x1='9' y1='9' x2='15' y2='15'/%3E%3C/svg%3E");
}
.photo-upload-status-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Persistent file inputs for mobile photo picker (hidden but clickable) */
.photo-picker-input {
    position: fixed;
    left: -9999px;
    width: 1px;
    height: 1px;
    opacity: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
}
@keyframes photo-upload-status-in {
    from {
        opacity: 0;
        transform: translate(-50%, 0.5rem);
    }
    to {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}
@keyframes photo-upload-spin {
    to { transform: rotate(360deg); }
}

/* Modal Styles */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 60000;
    align-items: center;
    justify-content: center;
}

.modal-overlay.show {
    display: flex;
}

/* Ticket hub + hub detail sheet use 60001–60002; keep this dialog on top */
#operatorOverrideModal.modal-overlay {
    z-index: 62000;
}

/* Post-login “expiring soon” ticket list — above most app modals */
.expiring-soon-welcome-modal.modal-overlay {
    z-index: 62500;
}

.expiring-soon-welcome-list {
    max-height: min(50vh, 320px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid var(--app-bg-muted);
    border-radius: 0.375rem;
    background: var(--app-bg-page);
}

.expiring-soon-welcome-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.65rem 0.75rem;
    border-bottom: 1px solid var(--app-bg-surface-2);
    font-size: 0.875rem;
    color: var(--app-text-primary);
}

.expiring-soon-welcome-row:last-child {
    border-bottom: none;
}

.expiring-soon-welcome-row-left {
    flex: 1;
    min-width: 0;
}

.expiring-soon-welcome-row-meta {
    font-size: 0.75rem;
    color: #94a3b8;
    margin-top: 0.25rem;
}

.expiring-soon-welcome-row button {
    padding: 0.35rem 0.65rem;
    font-size: 0.75rem;
    border-radius: 0.25rem;
    border: 1px solid var(--app-border);
    background: var(--app-bg-surface);
    color: var(--app-text-primary);
    cursor: pointer;
}

.expiring-soon-welcome-row button:hover {
    background: var(--app-bg-hover);
}

.modal-content {
    background: var(--app-bg-page);
    border: 1px solid var(--app-bg-muted);
    border-radius: 0.5rem;
    max-width: 600px;
    width: 90%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    border-bottom: 1px solid var(--app-bg-muted);
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
    color: var(--app-text-inverse);
}

.modal-close {
    background: none;
    border: none;
    color: var(--app-text-primary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    color: var(--app-text-inverse);
}

.modal-body {
    padding: 1rem;
    overflow-y: auto;
    color: var(--app-text-primary);
}

/* App dialog prompt: type=search reduces password autofill on mobile; strip native search UI */
.app-dialog-input[type="search"] {
    -webkit-appearance: none;
    appearance: none;
}
.app-dialog-input[type="search"]::-webkit-search-cancel-button,
.app-dialog-input[type="search"]::-webkit-search-decoration {
    -webkit-appearance: none;
    appearance: none;
    display: none;
}
.app-dialog-message {
    white-space: pre-wrap;
    word-break: break-word;
}

/* Assignee count opens modal; keep compact in ticket popup and hub */
.ticket-assignee-count-btn,
.ticket-hub-assignee-count-btn {
    background: var(--app-bg-surface);
    border: 1px solid var(--app-border);
    color: #93c5fd;
    border-radius: 0.25rem;
    padding: 0.2rem 0.55rem;
    font-size: 0.875rem;
    cursor: pointer;
    font-variant-numeric: tabular-nums;
    line-height: 1.3;
    white-space: nowrap;
    max-width: 100%;
}

.ticket-assignee-count-btn:hover,
.ticket-hub-assignee-count-btn:hover {
    background: #374151;
    border-color: var(--app-link);
    color: #bfdbfe;
}

.ticket-assignees-checklist {
    max-height: 16rem;
    overflow-y: auto;
    padding: 0.35rem 0.25rem;
    background: var(--app-bg-surface);
    border: 1px solid var(--app-border);
    border-radius: 0.25rem;
}

.ticket-assignee-checkbox-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.5rem;
    margin: 0;
    border-radius: 0.2rem;
    cursor: pointer;
    font-size: 0.875rem;
    color: var(--app-text-primary);
    user-select: none;
}

.ticket-assignee-checkbox-row:hover {
    background: var(--app-bg-muted);
}

.ticket-assignee-checkbox-row input[type='checkbox'] {
    width: 1.05rem;
    height: 1.05rem;
    margin: 0;
    flex-shrink: 0;
    accent-color: var(--app-accent);
    cursor: pointer;
}

.ticket-assignees-readonly .ticket-assignee-checkbox-row {
    cursor: default;
}

.ticket-assignees-readonly .ticket-assignee-checkbox-row input[type='checkbox'] {
    cursor: default;
}

.ticket-assignee-checkbox-label {
    flex: 1;
    min-width: 0;
}

.ticket-assignees-empty {
    padding: 0.5rem 0.5rem;
    font-size: 0.875rem;
    color: var(--app-text-muted);
}

/* Browser Modal Styles (for iframe content) */
.browser-modal {
    max-width: 95vw;
    width: 95vw;
    max-height: 95vh;
    height: 95vh;
}

.browser-modal-body {
    padding: 0;
    overflow: hidden;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

/* Profile Modal Styles */
.profile-section {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.profile-avatar-section {
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    margin-bottom: 0.5rem;
}

.profile-avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--app-accent) 0%, #7c3aed 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    font-weight: 600;
    color: var(--app-text-inverse);
    border: 4px solid var(--app-bg-muted);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.profile-avatar-edit {
    position: absolute;
    bottom: 0;
    right: calc(50% - 50px + 70px);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--app-accent);
    border: 2px solid var(--app-bg-page);
    color: var(--app-text-inverse);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    transition: background-color 0.2s;
}

.profile-avatar-edit:hover {
    background: var(--app-accent-hover);
}

.profile-form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.profile-section-divider {
    height: 1px;
    background: var(--app-bg-muted);
    margin: 0.5rem 0;
}

.profile-section-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--app-text-inverse);
    margin-bottom: 0.5rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--app-text-secondary);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.form-input,
.form-select {
    width: 100%;
    padding: 0.75rem;
    background: var(--app-bg-surface);
    border: 1px solid var(--app-border);
    border-radius: 0.375rem;
    color: var(--app-text-inverse);
    font-size: 0.875rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-input:focus,
.form-select:focus {
    outline: none;
    border-color: var(--app-accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--app-accent) 10%, transparent);
}

.form-select {
    cursor: pointer;
}

.form-checkbox {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--app-accent);
}

.profile-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--app-bg-muted);
}

.profile-button {
    padding: 0.75rem 1.5rem;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

.profile-button-primary {
    background: var(--app-accent);
    color: var(--app-text-inverse);
}

.profile-button-primary:hover {
    background: var(--app-accent-hover);
}

.profile-button-secondary {
    background: var(--app-bg-muted);
    color: var(--app-text-primary);
    border: 1px solid var(--app-border);
}

.profile-button-secondary:hover {
    background: var(--app-border);
}

.map-app-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    margin-top: 0;
    background: var(--app-bg-page);
}

/* Map Container */
.map-container {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1;
    /* Reserve vertical space so address search sits above the bundled Leaflet top-right toolbar */
    --map-search-above-toolbar-reserve: 56px;
}

/* Push Leaflet top-right controls below the search row; Plus/Max adds --aerial-panel-leaflet-push when the aerial panel is open (desktop) */
.map-container .leaflet-top.leaflet-right {
    top: calc(
        max(12px, env(safe-area-inset-top, 0px)) + var(--map-search-above-toolbar-reserve, 56px) +
            var(--aerial-panel-leaflet-push, 0px)
    ) !important;
}

/* Address search + location control — top row, above map toolbar */
.map-search-overlay {
    position: absolute;
    top: max(12px, env(safe-area-inset-top, 0px));
    right: max(12px, env(safe-area-inset-right, 0px));
    left: auto;
    z-index: 1100;
    width: min(
        360px,
        calc(100% - 12px - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px) - 12px)
    );
    pointer-events: none;
}

.map-search-overlay .address-search-container {
    width: 100%;
    max-width: 360px;
    pointer-events: auto;
}

.map-address-fab {
    position: absolute;
    top: max(12px, env(safe-area-inset-top, 0px));
    right: max(12px, env(safe-area-inset-right, 0px));
    left: auto;
    z-index: 1100;
    border-radius: 0.5rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
}

#map {
    width: 100%;
    height: 100%;
}

/* Time Warp panel (Basic / Enhanced) — desktop: under address search, above Leaflet; mobile: FAB + modal */
.aerial-maps-panel-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1195;
    background: rgba(0, 0, 0, 0.45);
    pointer-events: auto;
}

.aerial-maps-panel-backdrop--visible {
    display: block;
}

.aerial-maps-panel-fab {
    display: none;
    align-items: center;
    justify-content: center;
    position: absolute;
    width: 48px;
    height: 48px;
    padding: 0;
    border-radius: 0.5rem;
    background: rgba(26, 26, 26, 0.96);
    color: #f8fafc;
    box-shadow: 0 2px 14px rgba(0, 0, 0, 0.45);
    border: 2px solid rgba(59, 130, 246, 0.85);
    cursor: pointer;
    z-index: 1190;
    pointer-events: auto;
}

.aerial-maps-panel-fab:hover {
    background: var(--app-bg-surface);
}

.aerial-maps-panel {
    position: absolute;
    top: calc(max(12px, env(safe-area-inset-top, 0px)) + var(--map-search-above-toolbar-reserve, 56px) + 8px);
    right: max(12px, env(safe-area-inset-right, 0px));
    left: auto;
    width: min(360px, calc(100vw - 24px));
    max-height: min(70vh, 560px);
    z-index: 1200;
    background: rgba(26, 26, 26, 0.94);
    border: 1px solid var(--app-border);
    border-radius: 0.5rem;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
    display: flex;
    flex-direction: column;
    font-size: 0.8125rem;
    color: var(--app-text-primary);
    pointer-events: auto;
}

.aerial-maps-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.5rem 0.65rem;
    border-bottom: 1px solid var(--app-bg-muted);
}

.aerial-maps-panel-header-actions {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-shrink: 0;
}

.aerial-maps-panel-toggle {
    background: transparent;
    border: none;
    color: #f5f5f5;
    font-weight: 600;
    cursor: pointer;
    flex: 1;
    text-align: left;
    min-width: 0;
}

.aerial-maps-panel-refresh {
    background: var(--app-accent);
    color: var(--app-text-inverse);
    border: none;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    cursor: pointer;
    font-size: 0.75rem;
}

.aerial-maps-panel-minimize {
    display: none;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    padding: 0;
    border: 1px solid var(--app-border-muted);
    border-radius: 0.25rem;
    background: var(--app-bg-surface);
    color: var(--app-text-primary);
    font-size: 0.65rem;
    line-height: 1;
    cursor: pointer;
}

.aerial-maps-panel-minimize:hover {
    background: var(--app-bg-muted);
}

.aerial-maps-panel-close {
    display: none;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    padding: 0;
    border: none;
    border-radius: 0.25rem;
    background: transparent;
    color: var(--app-text-primary);
    font-size: 1.35rem;
    line-height: 1;
    cursor: pointer;
}

.aerial-maps-panel-close:hover {
    background: rgba(255, 255, 255, 0.08);
}

.aerial-maps-panel-toolbar {
    padding: 0.4rem 0.65rem 0.5rem;
    border-bottom: 1px solid var(--app-bg-muted);
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    flex-shrink: 0;
}

.time-warp-zoom-hint {
    color: #fbbf24;
    font-size: 0.72rem;
    line-height: 1.3;
}

.time-warp-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.time-warp-preset-btn {
    padding: 0.2rem 0.45rem;
    font-size: 0.7rem;
    border-radius: 0.25rem;
    border: 1px solid var(--app-border-muted);
    background: var(--app-bg-surface);
    color: var(--app-text-primary);
    cursor: pointer;
}

.time-warp-preset-btn:hover {
    background: var(--app-bg-muted);
}

.time-warp-datetime-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    align-items: center;
}

.time-warp-datetime-label {
    font-size: 0.7rem;
    color: #94a3b8;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.time-warp-datetime-label input {
    font-size: 0.72rem;
    max-width: 100%;
}

.time-warp-viewport-label {
    font-size: 0.72rem;
    color: #cbd5e1;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    cursor: pointer;
    user-select: none;
}

.time-warp-search {
    width: 100%;
    padding: 0.35rem 0.5rem;
    font-size: 0.8rem;
    border-radius: 0.25rem;
    border: 1px solid var(--app-border);
    background: var(--app-bg-page);
    color: var(--app-text-primary);
}

.aerial-maps-panel-tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--app-bg-muted);
    flex-shrink: 0;
}

.aerial-maps-panel-tab {
    flex: 1;
    padding: 0.45rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 600;
    border: none;
    background: transparent;
    color: #94a3b8;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
}

.aerial-maps-panel-tab:hover {
    color: #e2e8f0;
}

.aerial-maps-panel-tab--active {
    color: #f8fafc;
    border-bottom-color: #3b82f6;
}

.aerial-maps-panel-body {
    padding: 0.5rem 0.65rem;
    overflow: hidden;
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.aerial-maps-panel-body--tabs {
    padding-top: 0.35rem;
}

.aerial-maps-panel-tabpanel {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    min-height: 0;
    flex: 1;
}

/* [hidden] must win over .aerial-maps-panel-tabpanel { display: flex } so only one tab is visible */
.aerial-maps-panel-tabpanel[hidden] {
    display: none !important;
}

.aerial-maps-panel-list-scroll {
    flex: 1 1 auto;
    min-height: 0;
    /* Show ~3 rows; scroll when there are more */
    max-height: calc(3 * 2.55rem);
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}

.aerial-maps-panel-hint {
    color: #94a3b8;
    font-size: 0.75rem;
    line-height: 1.35;
}

.aerial-maps-panel-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.aerial-maps-panel-row {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto auto;
    gap: 0.25rem;
    align-items: center;
    padding: 0.35rem 0;
    border-bottom: 1px solid var(--app-bg-surface);
}

.aerial-maps-panel-row-label {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-shrink: 0;
}

.aerial-maps-panel-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
    cursor: pointer;
}

.aerial-maps-panel-date {
    cursor: pointer;
}

.aerial-maps-panel-fav {
    background: transparent;
    border: none;
    color: #f5f5f5;
    cursor: pointer;
    font-size: 1rem;
    padding: 0 0.25rem;
}

.aerial-maps-panel-timeline-wrap {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    padding-top: 0.35rem;
    border-top: 1px solid var(--app-bg-muted);
}

.aerial-maps-panel-timeline-enable {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.75rem;
    color: #cbd5e1;
    cursor: pointer;
    user-select: none;
}

.aerial-maps-panel-timeline-enable input {
    margin: 0;
    cursor: pointer;
}

.aerial-maps-panel-timeline-label {
    font-size: 0.72rem;
    color: #94a3b8;
}

.aerial-maps-panel-timeline-date {
    font-size: 0.8rem;
    font-weight: 600;
    color: #e2e8f0;
    min-height: 1.25rem;
    line-height: 1.3;
}

.aerial-maps-panel-timeline {
    width: 100%;
}

@media (min-width: 769px) {
    .aerial-maps-panel-fab,
    .aerial-maps-panel-backdrop {
        display: none !important;
    }

    .aerial-maps-panel-close {
        display: none !important;
    }

    .aerial-maps-panel-minimize {
        display: flex;
    }

    .aerial-maps-panel--minimized {
        max-height: none;
        width: auto;
        min-width: 12rem;
        max-width: min(360px, calc(100vw - 24px));
    }

    .aerial-maps-panel--minimized .aerial-maps-panel-toolbar,
    .aerial-maps-panel--minimized .aerial-maps-panel-tabs,
    .aerial-maps-panel--minimized .aerial-maps-panel-body {
        display: none !important;
    }

    .aerial-maps-panel--minimized .aerial-maps-panel-header {
        border-bottom: none;
    }
}

@media (max-width: 768px) {
    /* Address FAB + gap + aerial FAB (~48px); keeps Leaflet controls below both (see .leaflet-top.leaflet-right). */
    .map-container {
        --map-search-above-toolbar-reserve: 112px;
    }

    .aerial-maps-panel-backdrop {
        z-index: 2595;
    }

    .aerial-maps-panel-fab {
        display: flex;
        z-index: 2600;
        top: calc(max(12px, env(safe-area-inset-top, 0px)) + 56px + 8px);
        right: max(12px, env(safe-area-inset-right, 0px));
        left: auto;
        bottom: auto;
        transform: none;
    }

    .aerial-maps-panel:not(.aerial-maps-panel--open) {
        display: none !important;
    }

    .aerial-maps-panel.aerial-maps-panel--open {
        display: flex !important;
        position: fixed;
        left: 50%;
        right: auto;
        top: 50%;
        bottom: auto;
        transform: translate(-50%, -50%);
        width: min(320px, calc(100vw - 24px));
        max-width: calc(100vw - 24px);
        max-height: min(75vh, 560px);
        z-index: 2605;
    }

    .aerial-maps-panel-close {
        display: flex;
    }
}

/* Leaflet attribution: org name (prefix) + map data credits */
.leaflet-container .leaflet-control-attribution {
    background: rgba(26, 26, 26, 0.88) !important;
    color: var(--app-text-secondary);
    font-size: 0.75rem;
    line-height: 1.35;
    max-width: min(100vw - 24px, 560px);
    padding: 4px 8px;
    border-radius: 4px 0 0 0;
    box-shadow: 0 -1px 4px rgba(0, 0, 0, 0.2);
}

.leaflet-container .leaflet-control-attribution a {
    color: #93c5fd;
}

.map-org-attribution-title {
    font-weight: 600;
    color: #f5f5f5;
    margin-right: 0.25rem;
}

/* Mobile live location bar: fixed + high z-index so it isn’t trapped under .map-container (z-index 1) or ticket popup (10000) */
.mobile-live-location-bar {
    display: none;
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    bottom: max(1rem, env(safe-area-inset-bottom, 0px));
    z-index: 10050;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 0.65rem 0.45rem 0.75rem;
    background: rgba(26, 26, 26, 0.94);
    border: 1px solid var(--app-border);
    border-radius: 999px;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
    font-size: 0.8125rem;
    color: var(--app-text-primary);
    pointer-events: auto;
}

.mobile-live-location-bar-label {
    white-space: nowrap;
}

.mobile-live-location-bar-pulse {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--app-success);
    flex-shrink: 0;
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.55);
    animation: mobile-live-location-bar-pulse 2s ease-out infinite;
}

@keyframes mobile-live-location-bar-pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.5);
    }
    70% {
        box-shadow: 0 0 0 10px rgba(34, 197, 94, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(34, 197, 94, 0);
    }
}

.mobile-live-location-stop {
    margin-left: 0.15rem;
    padding: 0.35rem 0.75rem;
    border: none;
    border-radius: 999px;
    background: var(--app-border);
    color: #fafafa;
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
}

.mobile-live-location-stop:active {
    background: var(--app-border-muted);
}

.user-live-location-marker-wrapper {
    background: transparent !important;
    border: none !important;
}

.user-live-location-marker {
    position: relative;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.user-live-location-pulse-ring {
    position: absolute;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid rgba(34, 197, 94, 0.65);
    animation: user-live-location-ring 2.2s ease-out infinite;
}

@keyframes user-live-location-ring {
    0% {
        transform: scale(0.65);
        opacity: 1;
    }
    100% {
        transform: scale(1.15);
        opacity: 0;
    }
}

.user-live-location-dot {
    position: relative;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--app-success);
    border: 3px solid var(--app-text-inverse);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
    z-index: 1;
}

.mobile-live-location-bar.mobile-live-location-bar--visible {
    display: flex;
}

/* Navbar when hosted inside the sidebar (full-width top bar removed) */
.sidebar-navbar-wrap {
    flex-shrink: 0;
    margin: -8px -8px 8px -8px;
    border-bottom: 1px solid var(--app-bg-muted);
    background: var(--app-bg-page);
    /* Above .section (z-index: 2) so profile dropdown isn’t painted under the ticket panel */
    position: relative;
    z-index: 20;
}

.navbar.navbar--in-sidebar {
    position: relative;
    width: 100%;
    top: auto;
    left: auto;
    box-shadow: none;
}

.navbar.navbar--in-sidebar .navbar-content {
    height: auto;
    min-height: auto;
    flex-direction: column;
    align-items: stretch;
    padding: 0.75rem 0.5rem;
    gap: 0.625rem;
}

.navbar.navbar--in-sidebar .navbar-left,
.navbar.navbar--in-sidebar .navbar-right {
    flex: none;
    width: 100%;
}

.navbar.navbar--in-sidebar .navbar-right {
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.navbar.navbar--in-sidebar .request-services-button {
    margin-right: 0;
    flex: 1;
    min-width: 0;
}

.navbar.navbar--in-sidebar .org-selector {
    min-width: 0;
    width: 100%;
    max-width: none;
}

/* Sidebar Styles */
.sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: -175px;
    width: 230px;
    background: var(--app-bg-page);
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.1);
    transition: left 200ms ease-in-out, width 200ms ease-in-out;
    z-index: 1000;
    direction: rtl;
    overflow: visible;
}

.sidebar.ticket-panel-open {
    width: 400px;
    left: -345px;
}

.sidebar.open {
    left: 0;
}

/* Edge strip + arrow when sidebar is closed; hidden when open (use Close on Tickets heading row) */
.sidebar-edge {
    position: absolute;
    right: 0;
    top: 0;
    height: 100%;
    width: 20px;
    z-index: 1001;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.sidebar-edge .sidebar-toggle {
    pointer-events: auto;
}

.sidebar:not(.open) .sidebar-edge {
    width: 30px;
}

.sidebar-toggle {
    position: absolute;
    right: -15px;
    top: 50%;
    transform: translateY(-50%);
    width: 30px;
    height: 40px;
    cursor: pointer;
    border: none;
    background: var(--app-bg-page);
    color: var(--app-text-inverse);
    font-size: 48px;
    line-height: 1;
    padding: 0 7px;
    padding-bottom: 0.5rem;
    padding-top: 0;
    border-radius: 4px 0 0 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1002;
    box-shadow: 2px 0 5px rgba(0, 0, 0, 0.2);
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.sidebar.open .sidebar-edge {
    display: none;
}

.sidebar-content {
    margin-right: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
    background: var(--app-bg-page);
    padding: 8px;
    direction: ltr;
    overflow: hidden;
    overflow-x: hidden;
    width: 100%;
    box-sizing: border-box;
}

.sidebar:not(.open) .sidebar-content {
    margin-right: 0;
    padding: 0;
    overflow: hidden;
    width: 0;
    min-width: 0;
}

/* Section Styles */
.section {
    margin-bottom: 0.5rem;
    padding: 0.5rem;
    background: var(--app-bg-page);
    border: 1px solid var(--app-bg-muted);
    border-radius: 0.5rem;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    min-height: 0;
    position: relative;
    z-index: 2;
    overflow: hidden;
}

.section.ticket-panel-open {
    flex: 1;
    min-height: 0;
}

.section-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--app-text-inverse);
}

.button {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--app-accent);
    color: var(--app-text-inverse);
    border: none;
    border-radius: 0.375rem;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 500;
    transition: background-color 0.2s;
    margin-bottom: 0.5rem;
}

.button:hover {
    background: var(--app-accent-hover);
}

.button:active {
    transform: scale(0.98);
}

.button-collapsed {
    width: 40px;
    height: 40px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.button-collapsed:hover .tooltip {
    display: block;
}

.tooltip {
    display: none;
    position: absolute;
    left: 50px;
    background: var(--app-bg-surface-2);
    color: var(--app-text-primary);
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    white-space: nowrap;
    z-index: 1002;
    font-size: 0.875rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.button-icon {
    width: 24px;
    height: 24px;
}

/* Bottom Section */
.bottom-section {
    margin-top: auto;
    padding-top: 1rem;
    padding-bottom: 1rem;
}

.feedback-button {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 15px;
    border-radius: 8px;
    background-color: var(--app-bg-surface);
    border: 1px solid var(--app-border);
    color: var(--app-text-primary);
    font-size: 0.875rem;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
    width: 100%;
}

.feedback-button:hover {
    background-color: var(--app-bg-hover);
}

.feedback-button:active {
    transform: scale(0.95);
}

/* Hidden when sidebar is closed */
.sidebar:not(.open) .section-content {
    display: none;
}

.sidebar:not(.open) .button-collapsed {
    display: none;
}

.sidebar:not(.open) .section {
    display: none;
}

.sidebar:not(.open) .ticket-list-panel {
    display: none !important;
}

.sidebar:not(.open) .bottom-section {
    display: none;
}

.sidebar.open .button-collapsed {
    display: none;
}

.sidebar:not(.open) .button {
    display: none;
}

.sidebar:not(.open) .sidebar-content {
    overflow: hidden;
}

/* Drawing markers */
.drawing-marker {
    background: transparent !important;
    border: none !important;
}

.annotation-marker {
    background: transparent !important;
    border: none !important;
}

/* Drawing controls */
.drawing-controls {
    background: white;
    border-radius: 4px;
    box-shadow: 0 1px 5px rgba(0,0,0,0.4);
    padding: 0;
}

/* Inside bundled top-right toolbar (dark column) — no extra white card */
.map-toolbar-bundle .drawing-controls {
    background: transparent;
    box-shadow: none;
    border-radius: 0;
}

.draw-btn {
    width: 30px;
    height: 30px;
    border: none;
    background: white;
    color: var(--app-bg-muted);
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    line-height: 1;
    padding: 0;
    border-bottom: 1px solid #ccc;
    transition: background-color 0.2s;
}

.draw-btn:last-child {
    border-bottom: none;
}

.draw-btn:hover {
    background-color: #f3f4f6;
}

.finish-btn:hover {
    background-color: var(--app-success) !important;
}

/* Photo Marker Styles */
.photo-marker {
    background: transparent !important;
    border: none !important;
}

.photo-marker-container {
    position: relative;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.photo-marker-icon {
    width: 32px;
    height: 32px;
    background: var(--app-bg-page);
    border: 2px solid white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.photo-marker-icon:hover {
    transform: scale(1.1);
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.5);
}

/* Cluster: same camera look as single markers + count badge (bottom-right) */
.photo-cluster-marker {
    overflow: visible !important;
}

.photo-cluster-marker-wrap {
    position: relative;
    width: 40px;
    height: 32px;
    overflow: visible;
}

.photo-cluster-marker-wrap .photo-marker-icon {
    position: absolute;
    left: 0;
    top: 0;
}

.photo-cluster-count-badge {
    position: absolute;
    right: -2px;
    bottom: -2px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    box-sizing: border-box;
    background: var(--app-accent);
    color: var(--app-text-inverse);
    border-radius: 999px;
    border: 2px solid var(--app-text-inverse);
    font-size: 10px;
    font-weight: 700;
    line-height: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
    pointer-events: none;
    z-index: 2;
}

.photo-popup {
    text-align: center;
    max-width: 400px;
    min-width: 250px;
    color: #000000;
}

.photo-popup-image-container {
    width: 100%;
    max-height: 400px;
    overflow: hidden;
    border-radius: 4px;
    background: var(--app-bg-page);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
}

.photo-popup-image {
    max-width: 100%;
    max-height: 400px;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
    border-radius: 4px;
}

.photo-popup-info {
    font-size: 0.875rem;
    color: #000000;
    text-align: left;
    padding: 0 4px;
}

.photo-popup-info-row {
    margin-bottom: 8px;
    word-break: break-word;
}

.photo-popup-info-row:last-child {
    margin-bottom: 0;
}

.photo-popup-gps {
    color: #000000;
}

.photo-popup-manual {
    color: #000000;
}

.photo-popup-muted {
    color: var(--app-text-secondary);
    font-weight: normal;
}

.photo-popup-actions--mobile {
    display: none;
    gap: 0.5rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 0.25rem;
}

.photo-popup-actions--mobile .photo-popup-view-info-btn {
    font-size: 0.8125rem;
    padding: 6px 12px;
    cursor: pointer;
    border-radius: 4px;
    border: 1px solid var(--app-bg-muted);
    background: #f3f4f6;
    color: #111827;
}

@media (max-width: 768px) {
    .photo-popup-info--desktop {
        display: none !important;
    }

    .photo-popup-actions--mobile {
        display: flex;
    }

    .photo-popup {
        max-width: min(96vw, 360px);
        min-width: 0;
    }

    .photo-popup-image-container {
        max-height: min(230px, 48vh);
        margin-bottom: 8px;
    }

    .photo-popup-image {
        max-height: min(230px, 48vh);
        width: auto;
        max-width: 100%;
    }

    .leaflet-popup-content-wrapper .photo-popup {
        margin: 0;
    }
}

@media (min-width: 769px) {
    .photo-popup-actions--mobile {
        display: none !important;
    }
}

#photoMapInfoModalBody .photo-popup-info--modal-panel {
    text-align: left;
}

#photoMapInfoModalBody .photo-popup-info-row {
    color: var(--app-text-primary);
}

#photoMapInfoModalBody .photo-popup-info-row strong {
    color: var(--app-text-inverse);
}

#photoMapInfoModalBody .photo-popup-muted {
    color: var(--app-text-secondary);
}

#photoMapInfoModalBody .photo-popup-gps,
#photoMapInfoModalBody .photo-popup-manual {
    color: var(--app-text-primary);
}

/* Photo Viewer Modal — above .ticket-photos-modal (100000) so viewer opens on top from ticket photo list */
.photo-viewer-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.95);
    z-index: 110000;
    align-items: center;
    justify-content: center;
}

.photo-viewer-modal.show {
    display: flex;
}

.photo-viewer-content {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    box-sizing: border-box;
}

.photo-viewer-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(26, 26, 26, 0.9);
    border: 1px solid var(--app-border);
    color: var(--app-text-primary);
    font-size: 2rem;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 110001;
    transition: background-color 0.2s, border-color 0.2s;
}

.photo-viewer-close:hover {
    background: rgba(26, 26, 26, 1);
    border-color: var(--app-text-muted);
    color: var(--app-text-inverse);
}

.photo-viewer-controls {
    position: absolute;
    top: 1rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 0.5rem;
    z-index: 110001;
    background: rgba(26, 26, 26, 0.9);
    padding: 0.5rem;
    border-radius: 0.5rem;
    border: 1px solid var(--app-border);
}

.photo-viewer-btn {
    background: var(--app-bg-surface);
    border: 1px solid var(--app-border);
    color: var(--app-text-primary);
    font-size: 1.25rem;
    width: 40px;
    height: 40px;
    border-radius: 0.375rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s, border-color 0.2s;
    font-weight: 600;
}

.photo-viewer-btn:hover {
    background: var(--app-bg-hover);
    border-color: var(--app-border-strong);
    color: var(--app-text-inverse);
}

.photo-viewer-image-container {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    cursor: grab;
}

.photo-viewer-image-container:active {
    cursor: grabbing;
}

.photo-viewer-image {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    transform-origin: center center;
    transition: transform 0.1s ease-out;
    user-select: none;
    -webkit-user-drag: none;
}

/* Measure display - z-index above sidebar (1000) so it isn't clipped when sidebar is open */
.measure-display {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(26, 26, 26, 0.9);
    border: 1px solid var(--app-bg-muted);
    border-radius: 0.375rem;
    padding: 0.75rem 1.5rem;
    color: var(--app-text-inverse);
    font-size: 0.875rem;
    z-index: 1100;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    display: none;
}

/* Measure display on mobile: stay in map container (avoid body overflow clipping fixed), above sidebar (2000), wrap polygon lines */
@media (max-width: 768px) {
    .measure-display {
        position: absolute;
        bottom: calc(72px + env(safe-area-inset-bottom, 0px));
        left: max(1rem, env(safe-area-inset-left, 0px));
        right: max(1rem, env(safe-area-inset-right, 0px));
        width: auto;
        max-width: none;
        transform: none;
        padding: 0.625rem 0.75rem;
        font-size: 0.8125rem;
        line-height: 1.35;
        overflow-wrap: anywhere;
        word-wrap: break-word;
        hyphens: auto;
        text-align: center;
        /* Above .sidebar on mobile (z-index 2000) so the full-width bar isn’t covered */
        z-index: 2500;
    }
}

.measure-marker {
    background: transparent !important;
    border: none !important;
}

.search-marker {
    background: transparent !important;
    border: none !important;
}

/* Ticket Popup */
.ticket-popup {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translate(-50%, 100%);
    width: 90%;
    max-width: 900px;
    background: var(--app-bg-surface-2);
    border: 1px solid var(--app-bg-muted);
    border-radius: 0.5rem 0.5rem 0 0;
    box-shadow: 0 -4px 6px rgba(0, 0, 0, 0.3);
    z-index: 10000;
    transition: transform 0.3s ease-out;
    height: 85vh;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    user-select: none; /* Prevent text selection during resize */
}

.ticket-popup.resizing {
    transition: none; /* Disable transition during resize */
}

.ticket-popup-resize-handle {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 8px;
    cursor: ns-resize;
    z-index: 10001;
    background: transparent;
    transition: background-color 0.2s;
}

.ticket-popup-resize-handle:hover {
    background: rgba(59, 130, 246, 0.3);
}

.ticket-popup-resize-handle:active {
    background: rgba(59, 130, 246, 0.5);
}

.ticket-popup-resize-handle-vertical {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 8px;
    cursor: ew-resize;
    z-index: 10001;
    background: transparent;
    transition: background-color 0.2s;
}

.ticket-popup-resize-handle-vertical:hover {
    background: rgba(59, 130, 246, 0.3);
}

.ticket-popup-resize-handle-vertical:active {
    background: rgba(59, 130, 246, 0.5);
}

.ticket-popup.show {
    transform: translate(-50%, 0);
}

.ticket-popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--app-bg-muted);
    background: var(--app-bg-page);
    gap: 1rem;
}

.ticket-popup-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.ticket-popup-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--app-text-inverse);
    margin: 0;
}

.ticket-upload-button {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--app-accent);
    color: var(--app-text-inverse);
    border: none;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
    white-space: nowrap;
}

.ticket-upload-button:hover {
    background: var(--app-accent-hover);
}

.ticket-upload-button:active {
    transform: scale(0.98);
}

.ticket-upload-button svg {
    flex-shrink: 0;
}

.ticket-popup-close {
    background: none;
    border: none;
    color: var(--app-text-secondary);
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.25rem;
    transition: background-color 0.2s, color 0.2s;
    flex-shrink: 0;
}

.ticket-popup-close:hover {
    background: var(--app-bg-muted);
    color: var(--app-text-inverse);
}

.ticket-popup-content {
    padding: 1.5rem;
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1;
    min-height: 0; /* flex child: so this pane scrolls as one unit instead of growing past the popup */
}

/* 811 ticket bubble when zoomed out (see TICKET_POLYGON_MIN_ZOOM in tickets.js) */
.leaflet-div-icon.ticket-811-marker-wrap {
    background: transparent !important;
    border: none !important;
    margin-left: 0 !important;
    margin-top: 0 !important;
}

.ticket-811-marker-bubble {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    padding: 5px 10px;
    border-radius: 999px;
    white-space: nowrap;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
    box-sizing: border-box;
    min-width: 2.25rem;
}

/* Stack sections vertically; flex + flex-shrink: 0 avoids grid/flex min-size bugs that add inner scrollbars */
.ticket-popup-grid {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    align-items: stretch;
    min-height: auto;
    height: auto;
}

.ticket-popup-grid > .ticket-popup-section {
    flex: 0 0 auto;
    min-height: min-content;
}

/* Desktop: hide mobile-only expandable "Photos" label (content still visible) */
.ticket-mobile-expandable-section .ticket-mobile-expandable-toggle {
    display: none;
}

/* Mobile Icon Button */
.mobile-icon-button {
    display: none;
    padding: 0.5rem;
    background: var(--app-bg-surface);
    border: 1px solid var(--app-border);
    border-radius: 0.375rem;
    color: var(--app-text-primary);
    cursor: pointer;
    transition: background-color 0.2s, border-color 0.2s;
    min-width: 2.5rem;
    height: 2.5rem;
    align-items: center;
    justify-content: center;
}

.mobile-icon-button:hover {
    background: var(--app-bg-hover);
    border-color: var(--app-border-strong);
}

.mobile-icon-button svg {
    width: 20px;
    height: 20px;
}

/* Mobile Address Search Modal */
.mobile-address-content {
    max-width: 90vw;
    width: 90vw;
}

.mobile-address-search-container {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.mobile-address-buttons {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.mobile-location-button {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--app-bg-surface);
    border: 1px solid var(--app-border);
    border-radius: 0.375rem;
    color: var(--app-text-primary);
    cursor: pointer;
    font-size: 0.875rem;
    transition: background-color 0.2s, border-color 0.2s;
    width: 100%;
}

.mobile-location-button:hover {
    background: var(--app-bg-hover);
    border-color: var(--app-border-strong);
}

.mobile-location-button svg {
    flex-shrink: 0;
}

.mobile-location-button:disabled {
    opacity: 0.65;
    cursor: wait;
}

.mobile-location-button:disabled:hover {
    background: var(--app-bg-surface);
    border-color: var(--app-border);
}

/* Mobile Responsive Styles */
@media (max-width: 768px) {
    /* Hide desktop elements, show mobile */
    .desktop-only {
        display: none !important;
    }
    
    .mobile-only {
        display: flex !important;
    }
    
    /* Adjust navbar layout (sidebar-hosted navbar uses column layout from base .navbar--in-sidebar rules) */
    .navbar:not(.navbar--in-sidebar) .navbar-content {
        padding: 0 0.5rem;
        height: 3.5rem;
        gap: 0.5rem;
    }
    
    .navbar:not(.navbar--in-sidebar) .navbar-left {
        flex: 0 1 auto;
        min-width: 0;
    }
    
    .navbar:not(.navbar--in-sidebar) .org-selector {
        min-width: 120px;
        max-width: 150px;
        font-size: 0.75rem;
        padding: 0.4rem 0.75rem;
    }
    
    .navbar:not(.navbar--in-sidebar) .navbar-right {
        flex: 0 0 auto;
        gap: 0.5rem;
    }
    
    .navbar.navbar--in-sidebar .navbar-content {
        padding: 0.5rem 0.4rem;
    }
    
    .profile-menu-button {
        min-width: 2.5rem;
        height: 2.5rem;
        padding: 0.5rem;
    }
    
    /* Sidebar: open width must fit viewport; toggle was right:-15px past the screen edge on narrow phones */
    .sidebar {
        top: 0;
        /* Above Leaflet map/panes (~400–600) and controls (~1000), below ticket popup (10000) */
        z-index: 2000;
    }
    
    .sidebar.open.ticket-panel-open {
        width: min(400px, 100vw) !important;
    }
    
    /* Keep open arrow tappable inside the peek strip (avoid right:-15px past viewport) */
    .sidebar:not(.open) .sidebar-edge {
        width: 44px;
    }
    
    .sidebar:not(.open) .sidebar-toggle {
        position: relative;
        right: auto;
        top: auto;
        transform: none;
        width: 36px;
        height: 44px;
        min-width: 36px;
        min-height: 44px;
        font-size: 2rem;
        line-height: 1;
        padding: 0;
        border-radius: 0.375rem;
    }
    
    /* Mobile address suggestions */
    .mobile-address-search-container .address-suggestions {
        position: relative;
        top: auto;
        left: auto;
        width: 100%;
        max-height: 200px;
        margin-top: 0.5rem;
    }
    
    /* Ticket Popup Mobile Styles - half screen when opened from ticket list */
    .ticket-popup {
        width: 100vw !important;
        max-width: 100vw !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        border-radius: 0 !important;
        transform: translate(0, 100%) !important;
    }
    
    .ticket-popup.ticket-popup-mobile-halfway {
        height: 50vh !important;
        max-height: 50vh !important;
        top: auto !important;
    }
    
    .ticket-popup.ticket-popup-mobile-halfway.show {
        transform: translate(0, 0) !important;
    }
    
    .ticket-popup.show {
        transform: translate(0, 0) !important;
    }
    
    .ticket-popup-grid {
        display: flex !important;
        flex-direction: column !important;
        gap: 1rem;
        min-width: 0;
        height: auto !important;
        min-height: auto !important;
    }
    
    .ticket-popup-grid > .ticket-popup-section {
        flex: 0 0 auto !important;
    }
    
    .ticket-popup-row {
        grid-template-columns: 1fr !important;
        gap: 0.5rem;
        padding: 0.5rem 0;
    }
    
    .ticket-popup-label {
        font-size: 0.75rem;
        margin-bottom: 0.25rem;
    }
    
    .ticket-popup-value {
        text-align: left !important;
        font-size: 0.875rem;
    }
    
    .ticket-popup-header {
        padding: 0.75rem 1rem;
        flex-wrap: wrap;
    }
    
    .ticket-popup-title {
        font-size: 1rem;
        flex: 1 1 100%;
        margin-bottom: 0.5rem;
    }
    
    .ticket-popup-actions {
        width: 100%;
        justify-content: space-between;
        gap: 0.5rem;
    }
    
    .ticket-popup-actions button {
        font-size: 0.75rem;
        padding: 0.4rem 0.75rem;
        flex: 1;
    }
    
    .ticket-popup-content {
        padding: 1rem;
        overflow-y: auto;
        overflow-x: hidden;
        min-width: 0; /* allow content to shrink; single scroll here, not per section */
    }
    
    .ticket-popup-section {
        padding: 0.75rem;
        min-width: 0;
        max-width: 100%;
        min-height: auto;
        height: auto;
        align-self: start;
    }
    .ticket-popup-section.mobile-expandable {
        flex: none;
    }
    .ticket-mobile-expandable-section {
        min-height: auto;
        height: auto;
        align-self: start;
        width: 100%;
    }
    
    .ticket-section-title {
        font-size: 0.875rem;
        margin-bottom: 0.75rem;
    }

    .ticket-section-header-row {
        margin-bottom: 0.75rem;
    }

    .ticket-section-header-row .ticket-section-title {
        margin-bottom: 0;
    }

    .ticket-posr-portal-btn {
        font-size: 0.6875rem;
        padding: 0.3rem 0.5rem;
    }
    
    /* Mobile expandable sections: Ticket Details, Operator Responses, Photos */
    .ticket-mobile-expandable-section .ticket-mobile-expandable-toggle {
        display: block;
    }
    .ticket-popup-section.mobile-expandable .ticket-section-title,
    .ticket-mobile-expandable-toggle {
        cursor: pointer;
        user-select: none;
        padding-right: 1.5rem;
        position: relative;
    }
    .ticket-popup-section.mobile-expandable .ticket-section-title::after,
    .ticket-mobile-expandable-toggle::after {
        content: '▼';
        position: absolute;
        right: 0;
        font-size: 0.7rem;
        opacity: 0.8;
        transition: transform 0.2s ease;
    }
    .ticket-popup-section.mobile-expandable.collapsed .ticket-section-title::after,
    .ticket-mobile-expandable-section.collapsed .ticket-mobile-expandable-toggle::after {
        transform: rotate(-90deg);
    }
    .ticket-popup-section.mobile-expandable.collapsed .ticket-popup-rows,
    .ticket-popup-section.mobile-expandable.collapsed .ticket-responses-wrapper {
        display: none !important;
    }
    .ticket-mobile-expandable-section.collapsed .ticket-mobile-expandable-body {
        display: none !important;
    }
    
    .ticket-mobile-expandable-section .ticket-mobile-expandable-body {
        min-width: 0;
        max-width: 100%;
        overflow-wrap: break-word;
        word-break: break-word;
    }
    .ticket-photos-inner { min-width: 0; max-width: 100%; }
    .ticket-photos-row { flex-wrap: wrap; gap: 0.5rem; }
    
    /* Photos section: highlight when collapsed so it stands out */
    .ticket-mobile-expandable-section.ticket-mobile-photos.collapsed {
        border-radius: 0.375rem;
        border: 1px solid var(--app-border);
        padding: 0.5rem 0.75rem;
        margin-bottom: 0.5rem;
    }
    .ticket-mobile-expandable-section.ticket-mobile-photos.collapsed[data-photo-status="ACTION_REQUIRED"] {
        background: rgba(250, 204, 21, 0.18);
        border-color: #facc15;
        box-shadow: 0 0 0 1px rgba(250, 204, 21, 0.3);
    }
    .ticket-mobile-expandable-section.ticket-mobile-photos.collapsed[data-photo-status="READY"] {
        background: rgba(34, 197, 94, 0.12);
        border-color: var(--app-success);
        box-shadow: 0 0 0 1px rgba(34, 197, 94, 0.25);
    }
    
    /* Operator Responses in map ticket popup only: show cards on mobile, hide table */
    .ticket-popup .ticket-responses-table-wrap {
        display: none;
    }
    .ticket-popup .ticket-responses-mobile {
        display: flex;
        flex-direction: column;
        gap: 0.5rem;
        /* no max-height/overflow: section expands to full length; panel scrolls */
        min-width: 0;
        max-width: 100%;
    }
    .ticket-response-card {
        background: var(--app-bg-page);
        border: 1px solid var(--app-bg-muted);
        border-radius: 0.375rem;
        padding: 0.5rem 0.75rem;
        font-size: 0.8125rem;
        min-width: 0;
        max-width: 100%;
        overflow-wrap: break-word;
        word-break: break-word;
    }
    .ticket-response-card.outstanding {
        border-color: #f59e0b;
        box-shadow: 0 0 0 1px rgba(245, 158, 11, 0.2);
    }
    .ticket-response-card-header {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        gap: 0.5rem;
        margin-bottom: 0.25rem;
        min-width: 0;
    }
    .ticket-response-card-name {
        font-weight: 600;
        color: var(--app-text-primary);
        flex: 1;
        min-width: 0;
        word-break: break-word;
        overflow-wrap: break-word;
    }
    .ticket-response-card-badge {
        flex-shrink: 0;
        padding: 0.2rem 0.4rem;
        border-radius: 0.25rem;
        font-size: 0.6875rem;
        font-weight: 600;
        white-space: nowrap;
    }
    .ticket-response-card-badge.ready { background: var(--app-success); color: var(--app-text-inverse); }
    .ticket-response-card-badge.not-ready { background: var(--app-danger); color: var(--app-text-inverse); }
    .ticket-response-card-badge.action-required { background: #f59e0b; color: #000; }
    .ticket-response-card-badge.overridden { background: var(--app-success); color: var(--app-text-inverse); font-style: italic; }
    .ticket-response-card-meta {
        font-size: 0.75rem;
        color: var(--app-text-secondary);
        margin-bottom: 0.125rem;
        word-break: break-word;
        overflow-wrap: break-word;
    }
    .ticket-response-card-desc,
    .ticket-response-card-comment {
        font-size: 0.75rem;
        color: #d4d4d4;
        margin-top: 0.25rem;
        word-break: break-word;
        overflow-wrap: break-word;
    }
    .ticket-response-card-override {
        font-size: 0.7rem;
        color: var(--app-success);
        font-style: italic;
        margin-top: 0.25rem;
    }
    .ticket-response-card-btn {
        margin-top: 0.375rem;
        padding: 0.25rem 0.5rem;
        background: var(--app-success);
        color: var(--app-text-inverse);
        border: none;
        border-radius: 0.25rem;
        font-size: 0.75rem;
        cursor: pointer;
        display: inline-block;
    }
    .ticket-response-card-btn.remove {
        background: var(--app-danger);
        margin-left: 0.25rem;
    }
    
    /* Ticket Details: compact layout, full height when expanded (panel scrolls) */
    .ticket-popup-section.mobile-expandable .ticket-popup-rows {
        gap: 0.375rem;
        min-width: 0;
        max-width: 100%;
        min-height: auto;
        flex: none;
        overflow: visible !important;
        padding-right: 0;
    }
    .ticket-popup-section.mobile-expandable .ticket-popup-row {
        display: flex;
        flex-direction: column;
        gap: 0.125rem;
        padding: 0.35rem 0;
        border-bottom: 1px solid var(--app-bg-surface-2);
        align-items: stretch;
        min-width: 0;
        max-width: 100%;
    }
    .ticket-popup-section.mobile-expandable .ticket-popup-row:last-child {
        border-bottom: none;
    }
    .ticket-popup-section.mobile-expandable .ticket-popup-label {
        font-size: 0.6875rem;
        color: var(--app-text-secondary);
        text-transform: uppercase;
        letter-spacing: 0.02em;
        margin-bottom: 0;
    }
    .ticket-popup-section.mobile-expandable .ticket-popup-value {
        font-size: 0.8125rem;
        word-break: break-word;
        overflow-wrap: break-word;
    }
    
    /* No internal scroll in sections: only the panel scrolls */
    .ticket-popup-section.mobile-expandable .ticket-responses-wrapper {
        flex: none;
        min-height: auto;
        overflow: visible !important;
    }
    
    /* Ticket History Table Mobile */
    .ticket-responses-wrapper {
        min-width: 0;
        max-width: 100%;
    }
    
    .ticket-responses-table-wrap .ticket-responses-table {
        font-size: 0.75rem;
        min-width: 800px;
    }
    
    .ticket-responses-table-wrap .ticket-responses-table th,
    .ticket-responses-table-wrap .ticket-responses-table td {
        padding: 0.5rem 0.25rem;
        white-space: nowrap;
    }
    
    /* Hide resize handles on mobile (ticket popup, data window, ticket hub) */
    .ticket-popup-resize-handle,
    .ticket-popup-resize-handle-vertical,
    .data-window-resize-handle,
    .ticket-hub-resize-handle,
    .ticket-hub-split-resizer {
        display: none !important;
    }
    
    /* Data window + ticket hub: fullscreen on small screens */
    .data-window,
    .ticket-hub-window {
        width: 100vw !important;
        max-width: 100vw !important;
        min-width: 0 !important;
        height: 100vh !important;
        max-height: 100vh !important;
        min-height: 100vh !important;
        /* Dynamic viewport — avoids overflow under mobile browser chrome */
        height: 100dvh !important;
        max-height: 100dvh !important;
        min-height: 100dvh !important;
        top: 0 !important;
        left: 0 !important;
        transform: translate(0, 0) !important;
        border-radius: 0 !important;
        box-sizing: border-box !important;
        /* iOS safe area (notch / home indicator) */
        padding: env(safe-area-inset-top, 0) env(safe-area-inset-right, 0) env(safe-area-inset-bottom, 0)
            env(safe-area-inset-left, 0);
    }
    
    /* Data window layout (mobile) */
    .data-window-header {
        padding: 0.75rem 1rem;
        flex-wrap: wrap;
    }
    
    .data-window-title {
        font-size: 1rem;
        flex: 1 1 100%;
        margin-bottom: 0.5rem;
    }
    
    .data-window-actions {
        width: 100%;
        justify-content: flex-end;
    }
    
    .data-window-body {
        overflow-y: auto;
    }
    
    .data-window-toolbar {
        flex-wrap: wrap;
        gap: 0.75rem;
        padding: 0.75rem;
    }
    
    .data-search-container {
        flex: 0 0 auto;
        min-width: 0;
        max-width: none;
    }
    
    .data-bulk-button {
        font-size: 0.75rem;
        padding: 0.5rem 0.75rem;
        flex: 1;
    }
    
    .data-bulk-actions {
        width: 100%;
        flex-wrap: wrap;
    }
    
    .data-table-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .data-table {
        font-size: 0.75rem;
        min-width: 600px;
    }
    
    .data-table th,
    .data-table td {
        padding: 0.5rem 0.25rem;
        white-space: nowrap;
    }

    /* Ensure column shell (display:flex comes from .show) */
    .ticket-hub-window.show {
        flex-direction: column;
        min-height: 0;
    }

    .ticket-hub-window-header {
        padding: 0.5rem 0.75rem;
        flex-wrap: nowrap;
        cursor: default;
        flex-shrink: 0;
        align-items: center;
    }

    .ticket-hub-window-title {
        font-size: 0.95rem;
        flex: 1 1 auto;
        min-width: 0;
        margin-bottom: 0;
        padding-right: 0.5rem;
    }

    .ticket-hub-window-actions {
        width: auto;
        flex-shrink: 0;
        justify-content: flex-end;
    }

    /* Single scroll regions: stats/toolbar fixed height; split fills the rest */
    .ticket-hub-body {
        flex: 1 1 0;
        min-height: 0;
        overflow: hidden;
        display: flex;
        flex-direction: column;
    }

    /* One row, horizontal scroll — keeps vertical space for the table */
    .ticket-hub-stats {
        display: flex;
        flex-wrap: nowrap;
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        padding: 0.35rem 0.5rem;
        gap: 0.35rem;
        flex-shrink: 0;
        position: relative;
        z-index: 1;
    }

    .ticket-hub-stat-card {
        flex: 0 0 auto;
        min-width: 4rem;
        max-width: none;
        box-sizing: border-box;
        padding: 0.25rem 0.5rem;
    }

    .ticket-hub-stat-card.ticket-hub-stat-filtered {
        margin-left: 0;
    }

    .ticket-hub-stat-label {
        font-size: 0.6rem;
    }

    .ticket-hub-stat-value {
        font-size: 0.85rem;
    }

    /* Grid: search full width; assignee below (no tall column of flex-grow items) */
    .ticket-hub-toolbar {
        display: grid;
        grid-template-columns: 1fr;
        align-items: end;
        gap: 0.35rem 0.45rem;
        padding: 0.4rem 0.5rem;
        flex-shrink: 0;
        flex-wrap: unset;
        position: relative;
        z-index: 1;
    }

    .ticket-hub-search-wrap {
        min-width: 0;
        max-width: none;
        flex: unset;
    }

    .ticket-hub-field {
        min-width: 0;
        max-width: none;
        flex: unset;
    }

    .ticket-hub-label {
        margin-bottom: 0.15rem;
        font-size: 0.62rem;
    }

    .ticket-hub-input,
    .ticket-hub-select {
        padding: 0.35rem 0.45rem;
        font-size: 0.75rem;
    }

    .ticket-hub-split {
        flex: 1 1 0;
        flex-direction: column;
        min-height: 0;
        overflow: hidden;
    }

    /* Details open in ticket-hub-detail-modal; keep list full height */
    .ticket-hub-detail-panel {
        display: none !important;
    }

    .ticket-hub-table-panel {
        border-right: none;
        border-bottom: none;
        padding-left: 0;
        padding-right: 0;
        flex: 1 1 auto;
        min-height: 0;
        display: flex;
        flex-direction: column;
    }

    .ticket-hub-table-scroll {
        flex: 1;
        min-height: 0;
        overflow: auto;
        -webkit-overflow-scrolling: touch;
    }

    .ticket-hub-table {
        min-width: 0;
        width: 100%;
        table-layout: fixed;
        font-size: 0.75rem;
    }

    .ticket-hub-table th,
    .ticket-hub-table td {
        padding: 0.4rem 0.35rem;
    }

    /* Mobile hub list is 3 columns (ticket #, status, map) — override desktop 5-col % widths */
    .ticket-hub-table-panel .ticket-hub-table th:first-child,
    .ticket-hub-table-panel .ticket-hub-table td:first-child {
        width: 34%;
        min-width: 0;
    }

    .ticket-hub-table-panel .ticket-hub-table th:nth-child(2),
    .ticket-hub-table-panel .ticket-hub-table td:nth-child(2) {
        width: 46%;
        min-width: 0;
    }

    .ticket-hub-table-panel .ticket-hub-table th:nth-child(3),
    .ticket-hub-table-panel .ticket-hub-table td:nth-child(3) {
        width: 20%;
        min-width: 4.25rem;
        max-width: 5.5rem;
    }

    .ticket-hub-table-panel .ticket-hub-table .ticket-card-status {
        white-space: normal;
        line-height: 1.25;
    }

    .ticket-hub-detail-panel {
        max-width: none;
        flex: 1 1 0;
        min-width: 0;
        min-height: 0;
        overflow-x: hidden;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding: 0.5rem 0.65rem;
    }

    .ticket-hub-detail-header {
        align-items: flex-start;
    }

    .ticket-hub-detail-title {
        font-size: 1rem;
        word-break: break-word;
    }

    .ticket-hub-detail-actions {
        width: 100%;
        justify-content: flex-start;
    }

    .ticket-hub-detail-grid {
        min-width: 0;
    }

    .ticket-hub-kv {
        grid-template-columns: minmax(0, 1fr);
        gap: 0.2rem;
    }

    .ticket-hub-k {
        font-size: 0.65rem;
    }

    .ticket-hub-v {
        word-break: break-word;
        overflow-wrap: anywhere;
    }

    .ticket-hub-operator-section {
        min-width: 0;
    }

    /* Let the hub detail sheet scroll as one column; avoid nested max-height clipping responses */
    .ticket-hub-responses-scroll {
        max-width: 100%;
        max-height: none !important;
        overflow-x: auto;
        overflow-y: visible;
        -webkit-overflow-scrolling: touch;
    }
    
    .data-view-dropdown {
        width: 100%;
        padding: 0.75rem;
        background: var(--app-bg-surface);
        border: 1px solid var(--app-border);
        border-radius: 0.375rem;
        color: var(--app-text-primary);
        font-size: 0.875rem;
        cursor: pointer;
    }
    
    .data-view-dropdown:focus {
        outline: none;
        border-color: var(--app-accent);
        box-shadow: 0 0 0 2px var(--app-focus-ring);
    }
    
    .data-view-dropdown option {
        background: var(--app-bg-page);
        color: var(--app-text-primary);
    }
}

/* Desktop: Hide mobile elements, show table for operator responses */
@media (min-width: 769px) {
    .mobile-only {
        display: none !important;
    }
    
    .desktop-only {
        display: block;
    }
    
    /* Single scrollbar on .ticket-popup-content only — no nested scroll in details / responses */
    .ticket-popup-section,
    .ticket-popup-section.mobile-expandable {
        overflow: visible !important;
        max-height: none !important;
    }
    
    .ticket-popup-section .ticket-popup-rows,
    .ticket-popup-section .ticket-responses-wrapper {
        overflow: visible !important;
        max-height: none !important;
    }
    
    .ticket-responses-table-wrap {
        display: block;
        overflow-x: auto;
        overflow-y: visible;
        max-width: 100%;
        max-height: none !important;
    }
    .ticket-responses-mobile {
        display: none !important;
    }
}

.ticket-popup-section {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    border: 1px solid var(--app-bg-muted);
    border-radius: 0.375rem;
    padding: 1rem;
    background: var(--app-bg-page);
    min-height: auto;
    width: 100%;
    align-self: stretch;
    overflow: visible;
    max-height: none;
}

.ticket-section-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    width: 100%;
    margin-bottom: 0.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--app-bg-muted);
}

.ticket-section-header-row .ticket-section-title {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
    flex: 1;
    min-width: 0;
}

.ticket-posr-portal-btn {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.65rem;
    background: #0369a1;
    color: var(--app-text-inverse);
    border: none;
    border-radius: 0.25rem;
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
    transition: background-color 0.2s;
}

.ticket-posr-portal-btn:hover {
    background: #0284c7;
}

.ticket-section-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--app-text-primary);
    margin-bottom: 0.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--app-bg-muted);
}

.ticket-popup-rows {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    flex: 0 0 auto;
    min-height: auto;
    overflow: visible;
    max-height: none;
    padding-right: 0;
}

.ticket-popup-row {
    display: grid;
    grid-template-columns: 140px 1fr;
    gap: 1rem;
    align-items: start;
    font-size: 0.8125rem;
    padding: 0.25rem 0;
}

.ticket-popup-label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--app-text-secondary);
}

.ticket-popup-value {
    font-size: 0.8125rem;
    color: var(--app-text-primary);
    word-break: break-word;
    text-align: right;
}

/* Operator Responses Table */
.ticket-responses-wrapper {
    flex: 0 0 auto;
    min-height: auto;
    overflow: visible;
    max-height: none;
}

.leaflet-overlay-pane {
    z-index: 400; /* Default is 400, keep it lower than markers (600) */
}

/* Z-index ordering for map layers (pane level):
   Base Map (tile-pane) ~200
   Aerial Maps (aerialMapPane) 350 — imagery below ticket shapes
   Tickets (ticketPane) 380 — polygon outline + fill above aerial
   Annotations / default vectors (overlay-pane) 400
*/
.leaflet-ticket-pane {
    z-index: 380;
}

.leaflet-aerial-map-pane {
    z-index: 350;
}

.ticket-responses-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.75rem;
}

.ticket-responses-table thead {
    background-color: var(--app-bg-page);
    position: sticky;
    top: 0;
    z-index: 10;
}

.ticket-responses-table th,
.ticket-responses-table td {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--app-bg-muted);
    text-align: left;
    vertical-align: top;
}

.ticket-responses-table th {
    font-weight: 600;
    color: var(--app-text-primary);
    font-size: 0.75rem;
}

.ticket-responses-table td {
    color: var(--app-text-primary);
    font-size: 0.75rem;
}

.ticket-response-card-name--links {
    flex: 1;
    min-width: 0;
    line-height: 1.35;
}

.ticket-response-card-name-sep {
    color: var(--app-text-secondary);
    font-weight: 400;
    text-decoration: none;
    pointer-events: none;
    padding: 0 0.15rem;
}

.ticket-response-outstanding {
    background-color: rgba(239, 68, 68, 0.1);
}

.ticket-response-outstanding td {
    color: #fca5a5;
}

.ticket-response-not-ready {
    background-color: rgba(239, 68, 68, 0.15);
}

.ticket-response-not-ready td {
    color: #fca5a5;
    font-weight: 500;
}

.ticket-response-action-required {
    background-color: rgba(250, 204, 21, 0.15);
}

.ticket-response-action-required td {
    color: #fde047;
}

.ticket-response-overridden {
    background-color: rgba(34, 197, 94, 0.1);
}

.ticket-response-overridden td {
    color: #86efac;
}

.ticket-no-responses {
    text-align: center;
    padding: 2rem;
    color: var(--app-text-muted);
    font-size: 0.875rem;
}

/* Ticket List Panel */
.ticket-list-panel {
    display: none;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    margin-top: 1rem;
    padding-top: 1rem;
    padding-right: 0.5rem;
    padding-bottom: 0.5rem;
    overflow: hidden;
    position: relative;
    z-index: 1;
}

.ticket-list-panel.open {
    display: flex;
}

.ticket-list-panel::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--app-bg-muted);
    z-index: 10;
    pointer-events: none;
}


/* Tickets section title row: label left, Close right (above ticket list header / buttons) */
.ticket-section-heading-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    width: 100%;
    margin-bottom: 0.5rem;
    flex-shrink: 0;
}

.ticket-section-heading {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0;
    color: var(--app-text-inverse);
}

.ticket-section-heading-row .ticket-sidebar-close-button {
    flex-shrink: 0;
    margin-left: auto;
}

/* Ticket refresh active overlay - full-screen with indeterminate progress bar */
.ticket-refresh-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ticket-refresh-overlay-content {
    background: var(--app-bg-surface-2);
    border: 1px solid var(--app-border);
    border-radius: 0.5rem;
    padding: 2rem 2.5rem;
    min-width: 280px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.ticket-refresh-overlay-message {
    margin: 0 0 1.25rem 0;
    color: var(--app-text-primary);
    font-size: 0.9375rem;
    text-align: center;
}

.ticket-refresh-progress-bar {
    height: 6px;
    background: var(--app-bg-muted);
    border-radius: 3px;
    overflow: hidden;
}

.ticket-refresh-progress-fill {
    height: 100%;
    width: 40%;
    background: linear-gradient(90deg, var(--app-accent), #3b82f6);
    border-radius: 3px;
    animation: ticket-refresh-progress-slide 1.4s ease-in-out infinite;
}

@keyframes ticket-refresh-progress-slide {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(350%); }
}

.ticket-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem 0.75rem;
    padding: 0.5rem 0;
    margin-bottom: 0.5rem;
    flex-shrink: 0;
    position: relative;
    z-index: 5;
}

.ticket-list-header-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.ticket-sidebar-close-button {
    padding: 0.25rem 0.65rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--app-text-primary);
    background: var(--app-bg-muted);
    border: 1px solid var(--app-border-muted);
    border-radius: 0.25rem;
    cursor: pointer;
    flex-shrink: 0;
    transition: background-color 0.15s, border-color 0.15s;
}

.ticket-sidebar-close-button:hover {
    background: var(--app-border);
    border-color: var(--app-text-muted);
}

.ticket-sidebar-close-button:active {
    transform: scale(0.98);
}

.ticket-list-title {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--app-text-inverse);
    margin: 0;
}

.ticket-list-title span {
    color: var(--app-text-secondary);
    font-weight: 400;
}

.ticket-list-header-button {
    padding: 0.375rem 0.75rem;
    background: var(--app-accent);
    color: var(--app-text-inverse);
    border: none;
    border-radius: 0.375rem;
    cursor: pointer;
    font-size: 0.75rem;
    font-weight: 500;
    transition: background-color 0.2s;
    white-space: nowrap;
    flex-shrink: 0;
}

.ticket-list-header-button:hover {
    background: var(--app-accent-hover);
}

.ticket-list-header-button:active {
    transform: scale(0.98);
}

.ticket-list-header-button--ticket-hub {
    background: #4f46e5;
    color: var(--app-text-inverse);
    padding: 0.55rem 1.1rem;
    font-size: 0.9rem;
    font-weight: 600;
    border-radius: 0.45rem;
    min-height: 2.25rem;
}

.ticket-list-header-button--ticket-hub:hover {
    background: #4338ca;
}

.ticket-list-filters {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    flex-shrink: 0;
    position: relative;
    z-index: 5;
}

.ticket-search-input {
    width: 100%;
    padding: 0.5rem 0.75rem;
    background: var(--app-bg-surface);
    border: 1px solid var(--app-border);
    border-radius: 0.375rem;
    color: var(--app-text-inverse);
    font-size: 0.875rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.ticket-search-input:focus {
    outline: none;
    border-color: var(--app-border-strong);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.5);
}

.ticket-search-input::placeholder {
    color: var(--app-text-muted);
}

.ticket-status-filter {
    width: 100%;
    padding: 0.5rem 0.75rem;
    background: var(--app-bg-surface);
    border: 1px solid var(--app-border);
    border-radius: 0.375rem;
    color: var(--app-text-inverse);
    font-size: 0.875rem;
    cursor: pointer;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.ticket-status-filter:focus {
    outline: none;
    border-color: var(--app-border-strong);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.5);
}

.ticket-list-scroll-container {
    flex: 1 1 0%;
    min-height: 0;
    max-height: calc(100vh - 20rem);
    position: relative;
    box-sizing: border-box;
    margin-bottom: 1px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}


.ticket-list-content {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding-right: 0.75rem;
    padding-left: 0;
    padding-top: 0.5rem;
    padding-bottom: 8rem;
    margin-top: -1px;
    margin-bottom: 0;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    position: relative;
    z-index: 0;
    box-sizing: border-box;
}

/* Ticket Card */
.ticket-card {
    background: transparent;
    border: 1px solid var(--app-bg-muted);
    border-radius: 0.5rem;
    padding: 0.75rem;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
    position: relative;
    z-index: 0;
    margin-top: 0;
}

.ticket-card:hover {
    background: var(--app-bg-surface-2);
    border-color: var(--app-border);
}

.ticket-card.selected {
    background: var(--app-bg-page);
    border-color: #3b82f6;
    box-shadow: 0 0 0 1px rgba(59, 130, 246, 0.35);
}

.ticket-card-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.ticket-card-number {
    font-weight: 600;
    font-size: 0.9375rem;
    color: var(--app-text-inverse);
}

.ticket-card-rev {
    font-weight: 500;
    font-size: 0.85em;
    color: var(--app-text-secondary);
}

.ticket-card-status {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--app-text-inverse);
}

.ticket-card-status.ready {
    background-color: var(--app-success);
}

.ticket-card-status.not-ready {
    background-color: var(--app-danger);
}

.ticket-card-status.action-required {
    background-color: #facc15;
    color: var(--app-bg-page);
}

.ticket-card-status.expired {
    background-color: #6b7280;
}

.ticket-card-status.expiring-soon {
    background-color: var(--app-danger);
}

.ticket-card-location {
    font-size: 0.8125rem;
    color: #d1d5db;
    margin-bottom: 0.5rem;
    line-height: 1.4;
}

.ticket-card-dates {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    font-size: 0.75rem;
    color: #9ca3af;
    margin-bottom: 0.5rem;
}

.ticket-card-meta {
    display: flex;
    gap: 0.75rem;
    font-size: 0.75rem;
    color: #9ca3af;
}

.ticket-list-empty {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--app-text-muted);
    font-size: 0.875rem;
}

/* Data Window Styles */
.data-window {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 90vw;
    max-width: 1200px;
    min-width: 600px;
    height: 80vh;
    max-height: 800px;
    min-height: 400px;
    background: var(--app-bg-surface-2);
    border: 1px solid var(--app-border);
    border-radius: 0.5rem;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3), 0 10px 10px -5px rgba(0, 0, 0, 0.2);
    z-index: 60000;
    flex-direction: column;
    overflow: hidden;
}

.data-window-resize-handle {
    position: absolute;
    background: transparent;
    z-index: 60001;
}

.data-window-resize-handle-right {
    top: 0;
    right: 0;
    width: 4px;
    height: 100%;
    cursor: ew-resize;
}

.data-window-resize-handle-bottom {
    bottom: 0;
    left: 0;
    width: 100%;
    height: 4px;
    cursor: ns-resize;
}

.data-window-resize-handle-corner {
    bottom: 0;
    right: 0;
    width: 16px;
    height: 16px;
    cursor: nwse-resize;
    background: linear-gradient(-45deg, transparent 40%, var(--app-border-strong) 40%, var(--app-border-strong) 45%, transparent 45%, transparent 55%, var(--app-border-strong) 55%, var(--app-border-strong) 60%, transparent 60%);
}

.data-window-resize-handle:hover {
    background-color: rgba(74, 74, 74, 0.3);
}

.data-window-resize-handle-corner:hover {
    background: linear-gradient(-45deg, transparent 40%, #6a6a6a 40%, #6a6a6a 45%, transparent 45%, transparent 55%, #6a6a6a 55%, #6a6a6a 60%, transparent 60%);
}

.data-window.show {
    display: flex;
}

.data-window.show {
    display: flex;
}

.data-window-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--app-border);
    background: var(--app-bg-page);
    cursor: move;
}

.data-window-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--app-text-inverse);
    margin: 0;
}

.data-window-actions {
    display: flex;
    gap: 0.5rem;
}

.data-window-button {
    background: transparent;
    border: 1px solid var(--app-border);
    color: var(--app-text-primary);
    width: 32px;
    height: 32px;
    border-radius: 0.25rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, border-color 0.2s;
}

.data-window-button:hover {
    background: var(--app-bg-muted);
    border-color: var(--app-border-strong);
}

.data-window-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--app-bg-surface-2);
}

/* Ticket Hub window — same shell as data window */
.ticket-hub-window {
    display: none;
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(96vw, 1720px);
    max-width: 1720px;
    min-width: 960px;
    height: 82vh;
    max-height: 900px;
    min-height: 420px;
    background: var(--app-bg-surface-2);
    border: 1px solid var(--app-border);
    border-radius: 0.5rem;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.3), 0 10px 10px -5px rgba(0, 0, 0, 0.2);
    z-index: 60001;
    flex-direction: column;
    overflow: hidden;
}

.ticket-hub-window.show {
    display: flex;
}

.ticket-list-sync-spinner {
    display: inline-block;
    width: 0.85rem;
    height: 0.85rem;
    margin-left: 0.35rem;
    vertical-align: -0.1em;
    border: 2px solid var(--app-border-strong);
    border-top-color: var(--app-accent);
    border-radius: 50%;
    animation: ticketListPacSpin 0.85s linear infinite;
}

@keyframes ticketListPacSpin {
    to {
        transform: rotate(360deg);
    }
}

.ticket-hub-loading-overlay {
    position: absolute;
    inset: 0;
    z-index: 60050;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.42);
    backdrop-filter: blur(1px);
}

.ticket-hub-loading-inner {
    text-align: center;
    color: var(--app-text-primary);
    padding: 1rem 1.5rem;
    background: var(--app-bg-surface-2);
    border: 1px solid var(--app-border);
    border-radius: 0.5rem;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}

.ticket-hub-loading-spinner {
    width: 2.25rem;
    height: 2.25rem;
    margin: 0 auto 0.65rem;
    border: 3px solid var(--app-border-strong);
    border-top-color: var(--app-accent);
    border-radius: 50%;
    animation: ticketListPacSpin 0.85s linear infinite;
}

.ticket-hub-loading-text {
    margin: 0;
    font-size: 0.9rem;
    color: var(--app-text-secondary);
}

.ticket-hub-resize-handle {
    position: absolute;
    background: transparent;
    z-index: 60002;
}

.ticket-hub-resize-right {
    top: 0;
    right: 0;
    width: 4px;
    height: 100%;
    cursor: ew-resize;
}

.ticket-hub-resize-bottom {
    bottom: 0;
    left: 0;
    width: 100%;
    height: 4px;
    cursor: ns-resize;
}

.ticket-hub-resize-corner {
    bottom: 0;
    right: 0;
    width: 16px;
    height: 16px;
    cursor: nwse-resize;
    background: linear-gradient(-45deg, transparent 40%, var(--app-border-strong) 40%, var(--app-border-strong) 45%, transparent 45%, transparent 55%, var(--app-border-strong) 55%, var(--app-border-strong) 60%, transparent 60%);
}

.ticket-hub-resize-handle:hover {
    background-color: rgba(74, 74, 74, 0.3);
}

.ticket-hub-window-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--app-border);
    background: var(--app-bg-page);
    cursor: move;
    flex-shrink: 0;
}

.ticket-hub-window-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--app-text-inverse);
    margin: 0;
}

.ticket-hub-window-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.ticket-hub-import-btn {
    background: var(--app-accent);
    color: var(--app-text-inverse);
    border: 1px solid var(--app-accent-hover);
    padding: 0.35rem 0.7rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    line-height: 1.2;
    flex-shrink: 0;
}

.ticket-hub-pac-status {
    display: inline-block;
    margin-left: 0.5rem;
    min-width: 2.75rem;
    font-size: 0.85rem;
    font-variant-numeric: tabular-nums;
    color: var(--app-text-secondary, #64748b);
    vertical-align: middle;
}

.ticket-hub-pac-full-sync-btn {
    font-size: 0.7rem !important;
    padding: 0.25rem 0.45rem !important;
    min-width: auto;
}

#ticketHubPacPollRefreshBtn[aria-busy="true"] svg {
    animation: ticketHubPacSpin 0.85s linear infinite;
}

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

.ticket-hub-import-btn:hover {
    background: var(--app-accent-hover);
    border-color: #1e40af;
}

.ticket-hub-create-btn {
    background: var(--app-bg-surface);
    color: var(--app-text-primary);
    border: 1px solid var(--app-border-muted);
    padding: 0.35rem 0.7rem;
    border-radius: 0.25rem;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    line-height: 1.2;
    flex-shrink: 0;
}

.ticket-hub-create-btn:hover {
    background: var(--app-bg-hover);
    border-color: var(--app-text-muted);
}

.create-ticket-wizard-overlay {
    z-index: 62600;
    align-items: center;
    justify-content: center;
}

.create-ticket-wizard-body {
    max-height: min(78vh, 640px);
    overflow-y: auto;
    scroll-behavior: smooth;
}

.create-ticket-wizard-hint {
    font-size: 0.8125rem;
    color: var(--app-text-secondary);
    margin: 0 0 1rem;
}

.create-ticket-wizard-nav-wrap {
    position: sticky;
    top: 0;
    z-index: 2;
    margin: 0 0 1rem;
    padding-bottom: 0.5rem;
    background: linear-gradient(to bottom, var(--app-bg-surface-2) 0%, var(--app-bg-surface-2) 85%, rgba(38, 38, 38, 0.96) 100%);
    border-bottom: 1px solid var(--app-border);
}

.create-ticket-wizard-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.create-ticket-wizard-nav-btn {
    flex: 1 1 30%;
    min-width: 7rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    padding: 0.5rem 0.65rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--app-text-secondary);
    background: var(--app-bg-surface);
    border: 1px solid var(--app-border);
    border-radius: 0.375rem;
    cursor: pointer;
    line-height: 1.2;
    transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.create-ticket-wizard-nav-btn:hover {
    background: #353535;
    border-color: var(--app-border-muted);
    color: var(--app-text-primary);
}

.create-ticket-wizard-nav-btn.is-active {
    background: #1e3a5f;
    border-color: var(--app-accent);
    color: var(--app-text-inverse);
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--app-accent) 35%, transparent);
}

.create-ticket-wizard-nav-num {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.25rem;
    height: 1.25rem;
    font-size: 0.6875rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.1);
}

.create-ticket-wizard-nav-btn.is-active .create-ticket-wizard-nav-num {
    background: rgba(255, 255, 255, 0.2);
}

.create-ticket-wizard-section {
    background: var(--app-bg-surface);
    border: 1px solid var(--app-border);
    border-radius: 0.5rem;
    padding: 1rem 1rem 0.25rem;
    margin-bottom: 1rem;
    outline: none;
}

.create-ticket-wizard-section:focus-visible {
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--app-accent) 45%, transparent);
}

.create-ticket-wizard-section-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--app-text-inverse);
    margin: 0 0 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--app-border);
}

.create-ticket-wizard-section-subtitle {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--app-text-primary);
    margin: 0 0 0.5rem;
}

.create-ticket-field--map-polygon {
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px dashed var(--app-border);
}

.create-ticket-polygon-help {
    font-size: 0.8125rem;
    color: var(--app-text-secondary);
    line-height: 1.45;
    margin: 0 0 0.75rem;
}

.create-ticket-polygon-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.create-ticket-polygon-status {
    font-size: 0.8125rem;
    color: #d4d4d4;
    margin: 0;
    line-height: 1.4;
}

.create-ticket-field--ack {
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid var(--app-border);
}

.create-ticket-ack-legend {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--app-text-primary);
    margin-bottom: 0.65rem;
}

.create-ticket-ack-subtitle {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--app-text-primary);
    margin-bottom: 0.65rem;
}

.create-ticket-ack-row {
    display: flex;
    gap: 0.65rem;
    align-items: flex-start;
}

.create-ticket-ack-row input[type='checkbox'] {
    width: 1.125rem;
    height: 1.125rem;
    min-width: 1.125rem;
    margin-top: 0.15rem;
    flex-shrink: 0;
    cursor: pointer;
    accent-color: var(--app-accent);
}

.create-ticket-ack-label {
    font-size: 0.8125rem;
    color: #d4d4d4;
    line-height: 1.45;
    font-weight: 400;
    cursor: pointer;
}

.create-ticket-field {
    margin-bottom: 1rem;
}

.create-ticket-field label {
    display: block;
    font-size: 0.875rem;
    color: var(--app-text-secondary);
    margin-bottom: 0.35rem;
    font-weight: 500;
}

.create-ticket-field input,
.create-ticket-field select,
.create-ticket-field textarea {
    width: 100%;
    padding: 0.5rem 0.65rem;
    background: var(--app-bg-surface);
    border: 1px solid var(--app-border);
    border-radius: 0.25rem;
    color: var(--app-text-inverse);
    font-size: 0.875rem;
    font-family: inherit;
    box-sizing: border-box;
}

.create-ticket-field textarea {
    resize: vertical;
    min-height: 140px;
}

.create-ticket-field-row {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 0.75rem;
    align-items: end;
}

@media (max-width: 520px) {
    .create-ticket-field-row {
        grid-template-columns: 1fr;
    }
}

.create-ticket-field--narrow {
    min-width: 4.5rem;
}

.create-ticket-field--yesno {
    margin-bottom: 0.45rem;
}

.create-ticket-field--yesno .create-ticket-yesno-option {
    display: inline-flex;
    margin-bottom: 0;
    font-weight: 400;
}

.create-ticket-field--yesno .create-ticket-yesno-inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.25rem 0.75rem;
    row-gap: 0.2rem;
}

.create-ticket-yesno-legend {
    display: block;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--app-text-primary);
    margin: 0;
    padding: 0;
    line-height: 1.35;
    flex: 1 1 auto;
    min-width: min(100%, 12rem);
}

.create-ticket-yesno-row {
    display: flex;
    flex-wrap: nowrap;
    gap: 0.5rem;
    align-items: center;
    flex: 0 0 auto;
}

.create-ticket-yesno-option {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.8125rem;
    color: #d4d4d4;
    cursor: pointer;
    white-space: nowrap;
}

.create-ticket-yesno-option input[type='radio'] {
    width: 0.9375rem;
    height: 0.9375rem;
    margin: 0;
    accent-color: var(--app-accent);
    cursor: pointer;
    flex-shrink: 0;
}

@media (max-width: 480px) {
    .create-ticket-field--yesno .create-ticket-yesno-inner {
        flex-direction: column;
        align-items: flex-start;
    }

    .create-ticket-yesno-row {
        padding-left: 0.1rem;
    }
}

.create-ticket-wizard-footer {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: flex-end;
    padding: 0.75rem 1rem;
    border-top: 1px solid var(--app-bg-muted);
}

.ticket-hub-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
    background: var(--app-bg-surface-2);
}

.ticket-hub-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--app-border);
    background: #1f1f1f;
}

.ticket-hub-stat-card {
    background: var(--app-bg-surface);
    border: 1px solid var(--app-border);
    border-radius: 0.375rem;
    padding: 0.35rem 0.65rem;
    min-width: 4.5rem;
    text-align: center;
}

.ticket-hub-stat-card.ticket-hub-stat-filtered {
    border-color: #4f46e5;
    margin-left: auto;
}

.ticket-hub-stat-clickable {
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.ticket-hub-stat-clickable:hover {
    background: #353535;
    border-color: var(--app-border-muted);
}

.ticket-hub-stat-clickable:active {
    background: var(--app-bg-hover);
}

.ticket-hub-stat-card-active.ticket-hub-stat-clickable {
    border-color: #6366f1;
    box-shadow: 0 0 0 1px rgba(99, 102, 241, 0.45);
    background: #2f2f46;
}

.ticket-hub-stat-card-active.ticket-hub-stat-clickable:hover {
    border-color: #818cf8;
    background: #363652;
}

/* Drawn-area filter chip (matches map polygon accent) */
.ticket-hub-stat-card.ticket-hub-stat-drawn-area.ticket-hub-stat-card-active.ticket-hub-stat-clickable {
    border-color: #a78bfa;
    box-shadow: 0 0 0 1px rgba(167, 139, 250, 0.45);
    background: #2a2538;
}

.ticket-hub-stat-card.ticket-hub-stat-drawn-area.ticket-hub-stat-card-active.ticket-hub-stat-clickable:hover {
    border-color: #c4b5fd;
    background: #312a42;
}

.ticket-hub-stat-label {
    display: block;
    font-size: 0.65rem;
    text-transform: uppercase;
    color: var(--app-text-secondary);
    letter-spacing: 0.02em;
}

.ticket-hub-stat-value {
    font-size: 1rem;
    font-weight: 600;
    color: var(--app-text-inverse);
}

.ticket-hub-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.75rem 1rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--app-border);
    background: var(--app-bg-page);
}

.ticket-hub-label {
    display: block;
    font-size: 0.7rem;
    color: var(--app-text-secondary);
    margin-bottom: 0.25rem;
}

.ticket-hub-search-wrap {
    flex: 1 1 200px;
    min-width: 160px;
}

.ticket-hub-field {
    flex: 0 1 160px;
    min-width: 140px;
}

.ticket-hub-map-area-field {
    flex: 1 1 220px;
    min-width: 180px;
}

.ticket-hub-map-area-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    align-items: center;
}

.ticket-hub-tool-btn {
    padding: 0.45rem 0.6rem;
    background: #3730a3;
    color: #e0e7ff;
    border: 1px solid #4f46e5;
    border-radius: 0.375rem;
    font-size: 0.75rem;
    cursor: pointer;
    white-space: nowrap;
}

.ticket-hub-tool-btn:hover:not(:disabled) {
    background: #4f46e5;
    color: var(--app-text-inverse);
}

.ticket-hub-tool-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.ticket-hub-tool-btn-muted {
    background: var(--app-bg-surface);
    border-color: var(--app-border);
    color: var(--app-text-secondary);
}

.ticket-hub-tool-btn-muted:hover:not(:disabled) {
    background: var(--app-border);
    color: var(--app-text-primary);
}

.ticket-hub-search-polygon-layer {
    pointer-events: none;
}

.ticket-hub-input,
.ticket-hub-select {
    width: 100%;
    padding: 0.5rem 0.65rem;
    background: var(--app-bg-surface);
    border: 1px solid var(--app-border);
    border-radius: 0.375rem;
    color: var(--app-text-inverse);
    font-size: 0.8125rem;
    box-sizing: border-box;
}

.ticket-hub-input:focus,
.ticket-hub-select:focus {
    outline: none;
    border-color: #6366f1;
    box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.35);
}

/* Split list/detail uses % flex-basis on the row axis only — scope to desktop so
   mobile column layout does not treat 55% as height (which clipped the table). */
.ticket-hub-split {
    flex: 1;
    display: flex;
    min-height: 0;
    overflow: hidden;
}

@media (min-width: 769px) {
    .ticket-hub-split {
        --ticket-hub-list-pct: 55;
    }

    .ticket-hub-table-panel {
        flex: 0 0 calc(var(--ticket-hub-list-pct, 55) * 1%);
        min-width: 0;
        display: flex;
        flex-direction: column;
        border-right: none;
        padding-left: 0.75rem;
        box-sizing: border-box;
    }

    .ticket-hub-split-resizer {
        flex: 0 0 6px;
        margin: 0;
        padding: 0;
        min-width: 6px;
        align-self: stretch;
        cursor: col-resize;
        background: var(--app-border);
        border: 0;
        border-radius: 0;
        z-index: 3;
        touch-action: none;
    }

    .ticket-hub-split-resizer:hover,
    .ticket-hub-split-resizer:focus-visible {
        background: var(--app-border-strong, #525252);
        outline: none;
    }
}

.ticket-hub-table-scroll {
    flex: 1;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
}

.ticket-hub-table {
    width: 100%;
    table-layout: fixed;
    border-collapse: collapse;
    font-size: 0.8125rem;
    color: var(--app-text-primary);
}

.ticket-hub-table thead {
    position: sticky;
    top: 0;
    background: var(--app-bg-page);
    z-index: 2;
}

.ticket-hub-table th:first-child,
.ticket-hub-table td:first-child {
    width: 14%;
    min-width: 9rem;
}

.ticket-hub-table th:nth-child(2),
.ticket-hub-table td:nth-child(2) {
    width: 9%;
}

/* Assignees */
.ticket-hub-table th:nth-child(3),
.ticket-hub-table td:nth-child(3) {
    width: 12%;
    min-width: 4.5rem;
    white-space: nowrap;
}

/* Address (wide — no separate Operators column) */
.ticket-hub-table th:nth-child(4),
.ticket-hub-table td:nth-child(4) {
    width: 47%;
    min-width: 7rem;
}

.ticket-hub-table-panel .ticket-hub-table {
    min-width: 0;
    max-width: 100%;
}

.ticket-hub-table .ticket-hub-td-ellipsis {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ticket-hub-table th {
    padding: 0.5rem 0.5rem;
    text-align: left;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--app-text-secondary);
    border-bottom: 1px solid var(--app-border);
    white-space: normal;
    line-height: 1.25;
    vertical-align: bottom;
    overflow-wrap: break-word;
    word-break: break-word;
    hyphens: auto;
}

.ticket-hub-table td {
    padding: 0.45rem 0.5rem;
    border-bottom: 1px solid var(--app-bg-muted);
    vertical-align: top;
    overflow-wrap: break-word;
    word-break: break-word;
    hyphens: auto;
    min-width: 0;
}

.ticket-hub-row {
    cursor: pointer;
}

.ticket-hub-row:hover {
    background: var(--app-bg-muted);
}

.ticket-hub-row-selected {
    background: #1e3a5f !important;
}

.ticket-hub-td-num {
    font-weight: 600;
    color: var(--app-text-inverse);
}

@media (min-width: 769px) {
    .ticket-hub-table .ticket-hub-td-num {
        white-space: nowrap;
    }
}

.ticket-hub-td-muted {
    color: var(--app-text-secondary);
}

.ticket-hub-table .ticket-card-status {
    max-width: 100%;
    white-space: normal;
    word-break: break-word;
    overflow-wrap: break-word;
    line-height: 1.2;
}

.ticket-hub-table th:last-child,
.ticket-hub-table td:last-child {
    width: 3.5rem;
    white-space: nowrap;
    overflow-wrap: normal;
    word-break: normal;
    hyphens: manual;
    text-align: center;
    vertical-align: middle;
}

.ticket-hub-td-actions {
    white-space: nowrap;
    overflow-wrap: normal;
    word-break: normal;
}

.ticket-hub-mini-btn {
    padding: 0.2rem 0.45rem;
    margin-right: 0.25rem;
    font-size: 0.7rem;
    border: none;
    border-radius: 0.25rem;
    cursor: pointer;
    background: #374151;
    color: var(--app-text-primary);
}

.ticket-hub-mini-btn:hover {
    background: #4b5563;
}

.ticket-hub-mini-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.75rem;
    margin-top: 0.25rem;
}
.ticket-hub-mini-table th,
.ticket-hub-mini-table td {
    border: 1px solid var(--app-border-subtle, #374151);
    padding: 0.35rem 0.5rem;
    text-align: left;
    vertical-align: top;
}
.ticket-hub-json-snippet {
    font-size: 0.7rem;
    max-height: 240px;
    overflow: auto;
    margin: 0;
    padding: 0.5rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 0.25rem;
    white-space: pre-wrap;
    word-break: break-word;
}
.ticket-hub-async-block {
    font-size: 0.8rem;
}

.ticket-hub-table-empty {
    padding: 2rem 1rem;
    text-align: center;
    color: #888;
    font-size: 0.875rem;
}

.ticket-hub-detail-panel {
    position: relative;
    z-index: 2;
    flex: 1 1 auto;
    min-width: 180px;
    max-width: none;
    overflow-y: auto;
    padding: 1rem;
    background: var(--app-bg-page);
}

.ticket-hub-detail-empty {
    color: #888;
    font-size: 0.875rem;
    padding: 2rem 0.5rem;
    text-align: center;
}

/* Ticket hub — mobile detail sheet (opened by JS when ≤768px) */
.ticket-hub-detail-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 60002;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-end;
    pointer-events: none;
}

.ticket-hub-detail-modal.ticket-hub-detail-modal-open {
    display: flex;
    pointer-events: auto;
}

.ticket-hub-detail-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
}

.ticket-hub-detail-modal-sheet {
    position: relative;
    z-index: 1;
    max-height: 92vh;
    max-height: 92dvh;
    background: var(--app-bg-page);
    border-top: 1px solid var(--app-border);
    border-radius: 0.75rem 0.75rem 0 0;
    display: flex;
    flex-direction: column;
    min-height: 0;
    box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.4);
}

.ticket-hub-detail-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.65rem 0.75rem;
    border-bottom: 1px solid var(--app-border);
    flex-shrink: 0;
    background: var(--app-bg-page);
}

.ticket-hub-detail-modal-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--app-text-inverse);
}

.ticket-hub-detail-modal-close {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.35rem;
    border: none;
    border-radius: 0.25rem;
    background: transparent;
    color: var(--app-text-secondary);
    cursor: pointer;
}

.ticket-hub-detail-modal-close:hover {
    background: var(--app-bg-muted);
    color: var(--app-text-inverse);
}

.ticket-hub-detail-modal-body {
    flex: 1;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 0.65rem 0.75rem 1rem;
    padding-bottom: calc(1rem + env(safe-area-inset-bottom, 0));
}

@media (min-width: 769px) {
    .ticket-hub-detail-modal {
        display: none !important;
        pointer-events: none !important;
    }
}

/* Mobile: operator response row → full detail (above hub detail sheet z-index 60002) */
.ticket-hub-op-detail-overlay {
    position: fixed;
    inset: 0;
    z-index: 60010;
    background: rgba(0, 0, 0, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    box-sizing: border-box;
}

.ticket-hub-op-detail-panel {
    background: var(--app-bg-surface-2);
    border: 1px solid var(--app-border);
    border-radius: 0.5rem;
    max-width: min(96vw, 420px);
    width: 100%;
    max-height: min(85vh, 560px);
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.45);
}

.ticket-hub-op-detail-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.65rem 0.85rem;
    border-bottom: 1px solid var(--app-bg-muted);
    flex-shrink: 0;
}

.ticket-hub-op-detail-title {
    margin: 0;
    font-size: 0.9rem;
    color: #f5f5f5;
}

.ticket-hub-op-detail-close {
    background: transparent;
    border: none;
    color: var(--app-text-secondary);
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    padding: 0 0.25rem;
}

.ticket-hub-op-detail-close:hover {
    color: var(--app-text-inverse);
}

.ticket-hub-op-detail-body {
    overflow-y: auto;
    padding: 0.65rem 0.85rem 0.85rem;
    flex: 1;
    min-height: 0;
}

.ticket-hub-op-detail-dl {
    margin-bottom: 0.5rem;
}

.ticket-hub-op-detail-outstanding {
    margin: 0 0 0.5rem;
    font-size: 0.75rem;
    color: #fbbf24;
}

.ticket-hub-op-detail-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.ticket-hub-op-detail-directory {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--app-bg-muted);
}

.ticket-hub-op-detail-subtitle {
    margin: 0 0 0.4rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--app-text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.ticket-hub-op-detail-dir-dl {
    margin-top: 0.25rem;
}

.ticket-hub-resp-cell-link {
    display: inline;
    max-width: 100%;
    padding: 0;
    margin: 0;
    border: none;
    background: none;
    color: var(--app-accent, #38bdf8);
    font: inherit;
    text-align: inherit;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.ticket-hub-resp-cell-link:hover {
    color: var(--app-accent-hover, #7dd3fc);
}

.ticket-hub-responses-mobile-wrap .ticket-hub-responses-table--mobile {
    min-width: 0;
    width: 100%;
    table-layout: fixed;
}

.ticket-hub-resp-compact-open {
    width: 4.25rem;
    text-align: right;
    white-space: nowrap;
}

.ticket-hub-responses-mobile-wrap .ticket-hub-responses-table--mobile th,
.ticket-hub-responses-mobile-wrap .ticket-hub-responses-table--mobile td {
    white-space: normal;
}

.ticket-hub-detail-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 0.75rem;
}

.ticket-hub-detail-title {
    margin: 0;
    font-size: 1.1rem;
    color: var(--app-text-inverse);
}

.ticket-hub-detail-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.ticket-hub-usan-portal {
    margin-bottom: 1rem;
}

.ticket-hub-pacweb-pdfs {
    margin-bottom: 1rem;
}

.ticket-hub-pacweb-rev-note {
    font-size: 0.7rem;
    color: var(--app-text-secondary);
    margin: 0 0 0.5rem 0;
    line-height: 1.35;
}

.ticket-hub-pacweb-pdf-btns {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.ticket-hub-action-btn {
    padding: 0.4rem 0.75rem;
    font-size: 0.75rem;
    border-radius: 0.25rem;
    border: 1px solid var(--app-border);
    background: var(--app-bg-surface);
    color: var(--app-text-primary);
    cursor: pointer;
}

.ticket-hub-action-btn:hover {
    background: var(--app-bg-hover);
}

.ticket-hub-action-primary {
    background: var(--app-accent);
    border-color: var(--app-accent);
    color: var(--app-text-inverse);
}

.ticket-hub-action-primary:hover {
    background: var(--app-accent-hover);
}

.ticket-hub-action-danger {
    background: #7f1d1d;
    border-color: #b91c1c;
    color: #fecaca;
}

.ticket-hub-action-danger:hover {
    background: #991b1b;
}

.ticket-hub-action-secondary {
    background: #374151;
    border-color: #4b5563;
    color: #e5e7eb;
}

.ticket-hub-action-secondary:hover {
    background: #4b5563;
}

.ticket-hub-tn-base {
    font-weight: 600;
    color: var(--app-text-primary);
}

.ticket-hub-tn-rev {
    font-size: 0.85em;
    color: var(--app-text-secondary);
    font-weight: 400;
}

.ticket-hub-detail-rev {
    font-weight: 500;
    color: var(--app-text-secondary);
    font-size: 0.95em;
}

.ticket-history-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 100050;
    background: rgba(0, 0, 0, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

/* PAC job-pack PDF viewer — above Ticket Hub (60001) and ticket history modal (100050) */
.ticket-hub-pdf-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 100060;
    background: rgba(0, 0, 0, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.ticket-hub-pdf-modal-panel {
    background: var(--app-bg-surface-2);
    border: 1px solid var(--app-border);
    border-radius: 0.5rem;
    width: min(96vw, 1200px);
    height: min(90vh, 900px);
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.45);
    overflow: hidden;
}

.ticket-hub-pdf-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.65rem 1rem;
    border-bottom: 1px solid var(--app-border);
    flex-shrink: 0;
    background: var(--app-bg-page);
}

.ticket-hub-pdf-modal-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: #f3f4f6;
}

.ticket-hub-pdf-modal-close {
    flex-shrink: 0;
    width: 2rem;
    height: 2rem;
    padding: 0;
    border: none;
    border-radius: 0.25rem;
    background: transparent;
    color: var(--app-text-secondary);
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
}

.ticket-hub-pdf-modal-close:hover {
    color: var(--app-text-inverse);
    background: rgba(255, 255, 255, 0.08);
}

.ticket-hub-pdf-modal-iframe {
    flex: 1;
    min-height: 0;
    width: 100%;
    border: 0;
    background: #3f3f46;
}

.ticket-history-modal-panel {
    background: var(--app-bg-surface-2);
    border: 1px solid var(--app-border);
    border-radius: 0.5rem;
    max-width: 640px;
    width: 100%;
    max-height: min(80vh, 560px);
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.45);
}

.ticket-history-modal-panel-wide {
    max-width: min(96vw, 1100px);
    max-height: min(90vh, 800px);
}

.ticket-history-modal-body {
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

.ticket-history-block {
    border-bottom: 1px solid var(--app-bg-surface);
    padding-bottom: 1rem;
    margin-bottom: 0.5rem;
}

.ticket-history-block:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0.25rem;
}

.ticket-history-block-title {
    margin: 0.35rem 1rem 0.15rem;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--app-text-primary);
}

.ticket-history-block .ticket-history-modal-hint {
    padding: 0 1rem 0.5rem;
    margin: 0;
}

.ticket-history-utility-section {
    margin: 0.75rem 0 1.25rem;
    padding: 0 1rem;
}

.ticket-history-utility-heading {
    margin: 0 0 0.25rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: #f3f4f6;
}

.ticket-history-utility-code {
    font-weight: 500;
    color: #93c5fd;
}

.ticket-history-utility-sub {
    margin: 0 0 0.5rem;
    font-size: 0.7rem;
    color: var(--app-text-muted);
}

.ticket-history-subtable-wrap {
    overflow-x: auto;
    border: 1px solid var(--app-bg-muted);
    border-radius: 0.35rem;
    background: #181818;
}

.ticket-history-subtable {
    width: 100%;
    min-width: 880px;
    border-collapse: collapse;
    font-size: 0.75rem;
    color: #d4d4d4;
}

.ticket-history-subtable--mobile {
    min-width: 0;
    width: 100%;
    table-layout: fixed;
}

.ticket-history-col-rev-mobile {
    text-align: center;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
    color: #c4c4c4;
}

.ticket-history-subtable-wrap--mobile {
    overflow-x: visible;
}

.ticket-history-sub-open-cell {
    width: 4.5rem;
    text-align: right;
    white-space: nowrap;
}

.ticket-history-subtable th,
.ticket-history-subtable td {
    padding: 0.35rem 0.45rem;
    text-align: left;
    border-bottom: 1px solid var(--app-bg-surface);
    vertical-align: top;
}

.ticket-history-subtable th {
    color: var(--app-text-secondary);
    font-weight: 600;
    white-space: nowrap;
    background: #222;
}

.ticket-history-subtable tbody tr:last-child td {
    border-bottom: none;
}

.ticket-history-col-desc {
    max-width: 180px;
    word-break: break-word;
}

.ticket-history-col-code-desc,
.ticket-history-col-notes {
    max-width: 200px;
    word-break: break-word;
}

.ticket-history-col-comment {
    max-width: 200px;
    word-break: break-word;
}

.ticket-history-subrow-current {
    background: color-mix(in srgb, var(--app-accent) 12%, transparent);
}

.ticket-history-empty {
    margin: 0.5rem 1rem 0;
    padding: 0.75rem;
    font-size: 0.8125rem;
    color: var(--app-text-secondary);
    border: 1px dashed var(--app-border);
    border-radius: 0.35rem;
}

.ticket-history-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--app-bg-muted);
}

.ticket-history-modal-title {
    margin: 0;
    font-size: 1rem;
    color: #f5f5f5;
}

.ticket-history-modal-close {
    background: transparent;
    border: none;
    color: var(--app-text-secondary);
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    padding: 0 0.25rem;
}

.ticket-history-modal-close:hover {
    color: var(--app-text-inverse);
}

.ticket-history-modal-hint {
    margin: 0;
    padding: 0.5rem 1rem 0;
    font-size: 0.75rem;
    color: #888;
}

.ticket-history-table-wrap {
    overflow: auto;
    padding: 0.75rem 1rem 1rem;
}

.ticket-history-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8125rem;
    color: var(--app-text-primary);
}

.ticket-history-table th,
.ticket-history-table td {
    padding: 0.4rem 0.5rem;
    text-align: left;
    border-bottom: 1px solid var(--app-bg-muted);
}

.ticket-history-table th {
    color: var(--app-text-secondary);
    font-weight: 600;
}

.ticket-history-row-current {
    background: color-mix(in srgb, var(--app-accent) 15%, transparent);
}

/* Utility row detail — stacked above ticket history modal (mobile Open) */
.ticket-history-detail-overlay {
    position: fixed;
    inset: 0;
    z-index: 100060;
    background: rgba(0, 0, 0, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.ticket-history-detail-panel {
    background: var(--app-bg-surface-2);
    border: 1px solid var(--app-border);
    border-radius: 0.5rem;
    max-width: min(96vw, 420px);
    width: 100%;
    max-height: min(85vh, 520px);
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.45);
}

.ticket-history-detail-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.65rem 0.85rem;
    border-bottom: 1px solid var(--app-bg-muted);
    flex-shrink: 0;
}

.ticket-history-detail-title {
    margin: 0;
    font-size: 0.9rem;
    color: #f5f5f5;
}

.ticket-history-detail-close {
    background: transparent;
    border: none;
    color: var(--app-text-secondary);
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    padding: 0 0.25rem;
}

.ticket-history-detail-close:hover {
    color: var(--app-text-inverse);
}

.ticket-history-detail-body {
    overflow-y: auto;
    padding: 0.65rem 0.85rem 0.85rem;
    flex: 1;
    min-height: 0;
}

.ticket-history-detail-dl {
    margin: 0;
    display: grid;
    grid-template-columns: minmax(0, 7.5rem) 1fr;
    gap: 0.35rem 0.65rem;
    font-size: 0.78rem;
    color: #d4d4d4;
}

.ticket-history-detail-dl dt {
    margin: 0;
    color: var(--app-text-secondary);
    font-weight: 600;
}

.ticket-history-detail-dl dd {
    margin: 0;
    word-break: break-word;
}

.ticket-hub-detail-grid {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.ticket-hub-detail-section-h {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--app-border);
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--app-text-secondary);
}

.ticket-hub-detail-section-h:first-child {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}

.ticket-hub-detail-section-h--flush {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}

.ticket-hub-detail-section-details {
    margin-top: 0.75rem;
    padding-top: 0;
    border-top: 1px solid var(--app-border);
}

.ticket-hub-detail-section-summary {
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--app-text-secondary);
    cursor: pointer;
    list-style: none;
    padding: 0.75rem 0 0 0;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.35rem;
    user-select: none;
}

.ticket-hub-detail-section-summary::-webkit-details-marker {
    display: none;
}

.ticket-hub-detail-section-summary::before {
    content: '▶';
    font-size: 0.65em;
    line-height: 1;
    display: inline-block;
    transition: transform 0.15s ease;
    opacity: 0.85;
}

.ticket-hub-detail-section-details[open] .ticket-hub-detail-section-summary::before {
    transform: rotate(90deg);
}

.ticket-hub-detail-section-body {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    padding-top: 0.5rem;
}

.ticket-hub-kv {
    display: grid;
    grid-template-columns: 110px 1fr;
    gap: 0.5rem;
    font-size: 0.8125rem;
    align-items: start;
}

.ticket-hub-kv-full {
    grid-column: 1 / -1;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.ticket-hub-k {
    color: var(--app-text-secondary);
}

.ticket-hub-v {
    color: var(--app-text-primary);
    word-break: break-word;
}

.ticket-hub-detail-select {
    max-width: 100%;
    padding: 0.35rem 0.5rem;
    background: var(--app-bg-surface);
    border: 1px solid var(--app-border);
    border-radius: 0.25rem;
    color: var(--app-text-primary);
    font-size: 0.8125rem;
}

.ticket-hub-operator-section {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--app-bg-muted);
}

.ticket-hub-section-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--app-text-primary);
    margin: 0 0 0.5rem 0;
}

.ticket-hub-responses-scroll {
    max-height: min(380px, 42vh);
    overflow: auto;
}

.ticket-hub-override-note {
    margin-top: 0.25rem;
    font-size: 0.7rem;
    color: var(--app-success);
    font-style: italic;
}

.ticket-hub-ngen-latest-notes {
    margin-top: 0.35rem;
    font-size: 0.78rem;
    line-height: 1.35;
    word-break: break-word;
}

.ticket-hub-response-action {
    display: inline-block;
    position: relative;
    z-index: 2;
    margin-top: 0.35rem;
    margin-right: 0.35rem;
    padding: 0.25rem 0.5rem;
    border: none;
    border-radius: 0.25rem;
    font-size: 0.72rem;
    cursor: pointer;
    color: var(--app-text-inverse);
    touch-action: manipulation;
}

.ticket-hub-response-action-override {
    background: var(--app-success);
}

.ticket-hub-response-action-override:hover {
    background: #15803d;
}

.ticket-hub-response-action-usan {
    background: var(--app-accent);
}

.ticket-hub-response-action-usan:hover {
    background: var(--app-accent-hover);
}

.ticket-hub-response-action-remove {
    background: var(--app-danger);
}

.ticket-hub-response-action-remove:hover {
    background: #b91c1c;
}

.data-window-toolbar {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--app-border);
    background: var(--app-bg-page);
}

.data-bulk-actions {
    display: flex;
    gap: 0.5rem;
    margin-left: auto;
    align-items: center;
}

.data-bulk-button {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 0.25rem;
    cursor: pointer;
    font-size: 0.875rem;
    transition: background-color 0.2s, opacity 0.2s;
}

.data-bulk-button:hover {
    opacity: 0.9;
}

.data-bulk-button:active {
    opacity: 0.8;
}

.data-search-container {
    position: relative;
    flex: 1;
    max-width: 400px;
    display: flex;
    align-items: center;
    min-width: 0;
}

/* Global rules above load after the main mobile @media block — re-apply Manage Data toolbar search on small screens */
@media (max-width: 768px) {
    .data-window-toolbar .data-search-container {
        flex: 0 0 auto !important;
        max-width: none !important;
        position: relative;
        z-index: 50;
    }

    /* Ensure hidden desktop field never intercepts taps; keep icon button above siblings */
    .data-window .data-search-inline.desktop-only {
        display: none !important;
        pointer-events: none !important;
        visibility: hidden !important;
    }

    .data-search-mobile-open {
        position: relative;
        z-index: 51;
        pointer-events: auto !important;
        touch-action: manipulation;
        cursor: pointer;
        -webkit-tap-highlight-color: rgba(255, 255, 255, 0.08);
    }
}

.data-search-inline {
    position: relative;
    flex: 1;
    width: 100%;
    min-width: 0;
}

.data-search-input {
    width: 100%;
    padding: 0.5rem 0.75rem 0.5rem 2.5rem;
    background: var(--app-bg-surface);
    border: 1px solid var(--app-border);
    border-radius: 0.375rem;
    color: var(--app-text-inverse);
    font-size: 0.875rem;
}

.data-search-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.5);
}

.data-search-icon {
    position: absolute;
    left: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--app-text-muted);
    pointer-events: none;
}

.data-search-mobile-open {
    display: none;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 1px solid var(--app-border);
    border-radius: 0.375rem;
    background: var(--app-bg-surface);
    color: var(--app-text-primary);
    cursor: pointer;
    flex-shrink: 0;
}

.data-search-mobile-open:hover {
    background: var(--app-bg-muted);
    border-color: var(--app-border-muted);
}

.data-search-mobile-open:active {
    opacity: 0.9;
}

.data-search-mobile-open svg {
    pointer-events: none;
}

/* Manage Data — mobile search popup (above data window z-index 60000) */
.data-search-modal-overlay {
    display: none;
    pointer-events: none;
    position: fixed;
    inset: 0;
    z-index: 61000;
    background: rgba(0, 0, 0, 0.55);
    align-items: center;
    justify-content: center;
    padding: 1rem;
    padding-bottom: max(1rem, env(safe-area-inset-bottom, 0));
    box-sizing: border-box;
}

.data-search-modal-overlay.is-open {
    display: flex;
    pointer-events: auto;
}

.data-search-modal-panel {
    width: 100%;
    max-width: 420px;
    background: var(--app-bg-page);
    border: 1px solid var(--app-border);
    border-radius: 0.5rem;
    padding: 1rem 1.25rem 1.25rem;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.4);
}

.data-search-modal-title {
    margin: 0 0 0.75rem;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--app-text-inverse);
}

.data-search-modal-input {
    width: 100%;
    box-sizing: border-box;
    padding: 0.65rem 0.75rem;
    background: var(--app-bg-surface);
    border: 1px solid var(--app-border);
    border-radius: 0.375rem;
    color: var(--app-text-inverse);
    font-size: 1rem;
}

.data-search-modal-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.45);
}

.data-search-modal-input[type='search']::-webkit-search-cancel-button,
.data-search-modal-input[type='search']::-webkit-search-decoration {
    -webkit-appearance: none;
    appearance: none;
}

.data-search-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 1rem;
}

.data-search-modal-btn {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    cursor: pointer;
}

.data-search-modal-btn-primary {
    background: var(--app-accent);
    color: var(--app-text-inverse);
}

.data-search-modal-btn-primary:hover {
    background: var(--app-accent-hover);
}

.data-search-modal-btn-secondary {
    background: var(--app-border);
    color: var(--app-text-primary);
}

.data-search-modal-btn-secondary:hover {
    background: var(--app-border-muted);
}

@media (min-width: 769px) {
    .data-search-modal-overlay {
        display: none !important;
        pointer-events: none;
    }
}

.data-filter-container {
    min-width: 150px;
}

.data-filter-select {
    width: 100%;
    padding: 0.5rem 0.75rem;
    background: var(--app-bg-surface);
    border: 1px solid var(--app-border);
    border-radius: 0.375rem;
    color: var(--app-text-inverse);
    font-size: 0.875rem;
    cursor: pointer;
}

.data-filter-select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.5);
}

.data-table-container {
    flex: 1;
    overflow-y: auto;
    overflow-x: auto;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    color: var(--app-text-primary);
}

.data-table thead {
    position: sticky;
    top: 0;
    background: var(--app-bg-page);
    z-index: 10;
}

.data-table th {
    padding: 0.75rem 1rem;
    text-align: left;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--app-text-secondary);
    border-bottom: 1px solid var(--app-border);
    white-space: nowrap;
}

.data-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--app-bg-muted);
    font-size: 0.875rem;
}

.data-table tbody tr {
    transition: background 0.2s;
}

.data-table tbody tr:hover {
    background: var(--app-bg-muted);
}

.data-table tbody tr.selected {
    background: #1e3a5f;
}

/* Data window user groups */
.data-group-row {
    background: var(--app-bg-surface);
    font-weight: 600;
}
.data-group-row:hover {
    background: var(--app-bg-muted);
}
.data-group-toggle {
    cursor: pointer;
    user-select: none;
    margin-right: 0.5rem;
    display: inline-block;
    min-width: 1rem;
    color: var(--app-text-secondary);
}
.data-group-name {
    color: var(--app-text-primary);
}
.data-group-child .data-table-name {
    padding-left: 1.5rem;
}

.data-table-checkbox {
    width: 40px;
    text-align: center;
}

.data-table-checkbox input[type="checkbox"] {
    cursor: pointer;
}

.data-table-name {
    min-width: 200px;
    font-weight: 500;
    color: var(--app-text-inverse);
}

.data-table th[data-sortable] {
    position: relative;
    transition: background-color 0.2s;
}

.data-table th[data-sortable]:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

.data-table th[data-sortable].sorted {
    background-color: color-mix(in srgb, var(--app-accent) 10%, transparent);
}

.sort-indicator {
    display: inline-block;
    margin-left: 0.25rem;
    font-size: 0.75rem;
    transition: opacity 0.2s;
}

.data-table-type {
    min-width: 100px;
    text-transform: capitalize;
}

.data-table-color {
    min-width: 80px;
}

.data-color-indicator {
    display: inline-block;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid var(--app-border);
    vertical-align: middle;
}

.data-table-created {
    min-width: 150px;
    color: var(--app-text-secondary);
    font-size: 0.8125rem;
}

.data-table-actions {
    min-width: 100px;
}

.data-action-button {
    background: transparent;
    border: 1px solid var(--app-border);
    color: var(--app-text-primary);
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    cursor: pointer;
    font-size: 0.75rem;
    transition: background 0.2s, border-color 0.2s;
    margin-right: 0.25rem;
}

.data-action-button:hover {
    background: var(--app-bg-muted);
    border-color: var(--app-border-strong);
}

.data-action-button.delete {
    color: var(--app-danger);
    border-color: #7f1d1d;
}

.data-action-button.delete:hover {
    background: #7f1d1d;
    border-color: #991b1b;
}

.data-action-button.zoom-pin-button {
    font-size: 1rem;
    line-height: 1;
    padding: 0.25rem 0.4rem;
}

.data-table-empty {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--app-text-muted);
    font-size: 0.875rem;
}

/* Aerial map tile layer styles - prevent green tint */
.aerial-map-tile-layer img,
.leaflet-tile-container .aerial-map-tile-layer img {
    filter: none !important;
    -webkit-filter: none !important;
    image-rendering: -webkit-optimize-contrast;
    image-rendering: crisp-edges;
}

/* Ensure aerial map tiles render correctly without color filters */
.leaflet-layer .aerial-map-tile-layer {
    filter: none !important;
    -webkit-filter: none !important;
}

