/* ===== MODAL ===== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    backdrop-filter: blur(4px);
}

/* Dla dynamicznie tworzonych modali - domyślnie widoczne */
#route-calc-modal,
#hotel-assign-modal {
    display: flex;
}

/* Dla statycznych modali w HTML - wymagają .active */
#import-modal {
    display: none;
}

#import-modal.active {
    display: flex;
}

#sugar-upload-modal {
    display: none;
}

#sugar-upload-modal.active {
    display: flex;
}

/* .modal-content removed — identical to .modal, unused in HTML */

.modal {
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
    position: relative;
    z-index: 10001;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 20px;
    min-height: 56px;
    background: var(--bg-surface);
    border-bottom: 1px solid var(--gray-200);
}

.modal-header h2 {
    font-size: var(--text-lg);
    font-weight: 600;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--gray-900);
}

.modal-header h2 i {
    color: var(--primary);
}

.modal-header h3 {
    font-size: var(--text-lg);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0;
    color: var(--gray-900);
}

.modal-header h3 i {
    color: var(--primary);
}

/* Standard close X — used across modals */
.modal-close-x {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: var(--gray-500);
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: var(--text-base);
    transition: background var(--transition-fast), color var(--transition-fast);
}

.modal-close-x:hover {
    background: var(--gray-100);
    color: var(--gray-900);
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
}

/* Standard form-group: label on top, gap 6px between label and input, 16px between groups */
.modal .form-group,
.modal-body .form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px;
}

.modal .form-group:last-child,
.modal-body .form-group:last-child {
    margin-bottom: 0;
}

.modal .form-group > label,
.modal-body .form-group > label {
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--gray-600);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.instructions {
    margin-bottom: 20px;
}

.instructions h3 {
    font-size: var(--text-md);
    margin-bottom: 12px;
    color: var(--gray-700);
}

.instructions ol {
    padding-left: 20px;
}

.instructions li {
    margin-bottom: 10px;
    font-size: var(--text-base);
    line-height: 1.6;
}

.instructions li i {
    margin-right: 8px;
    color: var(--primary);
    width: 16px;
}

.instructions code {
    background: var(--gray-100);
    padding: 2px 6px;
    border-radius: var(--radius-sm);
    font-size: var(--text-sm);
}

.instructions a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

.instructions a:hover {
    text-decoration: underline;
}

/* ===== UPLOAD AREA ===== */
.upload-area {
    border: 2px dashed var(--gray-300);
    border-radius: var(--radius-lg);
    padding: 40px 20px;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-normal);
}

.upload-area:hover {
    border-color: var(--primary);
    background: var(--gray-50);
}

.upload-area.dragover {
    border-color: var(--primary);
    background: rgba(79, 70, 229, 0.05);
}

.upload-area i {
    font-size: 48px;
    color: var(--gray-400);
    margin-bottom: 16px;
}

.upload-area p {
    font-size: var(--text-md);
    color: var(--gray-600);
    margin-bottom: 8px;
}

.upload-hint {
    font-size: var(--text-sm);
    color: var(--gray-400);
}

/* ===== CONTEXT MENU ===== */
.context-menu {
    position: fixed;
    background: var(--bg-surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    min-width: 180px;
    padding: 6px 0;
    z-index: 10000;
    display: none;
}

.context-menu.active {
    display: block;
}

.context-menu-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    cursor: pointer;
    font-size: var(--text-base);
    transition: background var(--transition-normal);
}

.context-menu-item:hover {
    background: var(--gray-50);
}

.context-menu-item i {
    width: 16px;
    color: var(--gray-400);
}

.context-menu-item.danger {
    color: var(--danger);
}

.context-menu-item.danger i {
    color: var(--danger);
}

.context-menu-separator {
    height: 1px;
    background: var(--gray-200);
    margin: 6px 0;
}

.context-menu-header {
    padding: 8px 12px;
    font-weight: 600;
    font-size: var(--text-sm);
    color: var(--gray-500);
    background: var(--gray-50);
    border-bottom: 1px solid var(--gray-200);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ===== TOAST NOTIFICATIONS ===== */
.toast-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 10001;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    background: var(--gray-900);
    color: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    font-size: var(--text-base);
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

.toast.success {
    background: var(--success);
}

.toast.error {
    background: var(--danger);
}

.toast.warning {
    background: var(--warning);
    color: var(--gray-900);
}

.toast i {
    font-size: var(--text-xl);
}

/* ===== EDIT COORDS MODAL ===== */
.edit-coords-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow-lg);
    z-index: 10001;
    min-width: 400px;
}

.edit-coords-modal h3 {
    margin-bottom: 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.edit-coords-modal .form-row {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
    align-items: center;
}

.edit-coords-modal .form-row label {
    min-width: 80px;
    font-weight: 500;
    font-size: var(--text-base);
}

.edit-coords-modal .form-row input {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    font-size: var(--text-base);
}

.edit-coords-modal .buttons {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 20px;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 10000;
}


/* ===== ROUTE CALCULATION MODAL ===== */
.route-calc-modal {
    background: var(--bg-surface);
    border-radius: var(--radius-lg);
    max-width: 500px;
    width: 95%;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: var(--shadow-lg);
}

.route-calc-section {
    margin-bottom: 20px;
}

.route-calc-section:last-child {
    margin-bottom: 0;
}

.route-calc-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--gray-200);
}

.route-calc-section-header .section-title {
    font-weight: 600;
    font-size: var(--text-md);
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ===== JPG EXPORT MODAL ===== */
#jpg-export-modal {
    display: none;
}

#jpg-export-modal.active {
    display: flex;
}

.jpg-export-modal {
    max-width: 640px;
}

.jpg-export-hint {
    margin-bottom: 14px;
    color: var(--gray-600);
}

.jpg-export-quick-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 14px;
}

.jpg-export-list {
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    max-height: 340px;
    overflow: auto;
}

.jpg-export-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--gray-100);
    cursor: pointer;
}

.jpg-export-item:last-child {
    border-bottom: none;
}

.jpg-export-name {
    font-weight: 600;
}

.jpg-export-meta {
    margin-left: auto;
    font-size: var(--text-sm);
    color: var(--gray-500);
}

.jpg-export-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 16px;
}

.jpg-export-map-holder {
    position: fixed;
    left: -99999px;
    top: -99999px;
    pointer-events: none;
    opacity: 0;
}

.route-calc-section-header .section-title i {
    color: var(--primary);
}

.disabled-section .section-title i {
    color: var(--warning);
}

.route-calc-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 300px;
    overflow-y: auto;
}

.route-calc-list.muted {
    opacity: 0.6;
}

.route-calc-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: var(--gray-50);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all var(--transition-normal);
}

.route-calc-item:hover {
    background: var(--gray-100);
}

.route-calc-item.disabled {
    cursor: not-allowed;
    opacity: 0.7;
}

.route-calc-item input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}

.route-calc-item .tech-color-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

.route-calc-item .tech-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.route-calc-item .tech-name {
    font-weight: 500;
    font-size: var(--text-base);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.route-calc-item .tech-hotel {
    font-size: var(--text-xs);
    color: var(--gray-500);
    display: flex;
    align-items: center;
    gap: 4px;
}

.route-calc-item .tech-hotel i {
    font-size: var(--text-2xs);
    color: var(--success);
}

.route-calc-item .tech-task-count {
    font-size: var(--text-xs);
    color: var(--gray-500);
    background: var(--gray-200);
    padding: 2px 8px;
    border-radius: 10px;
    flex-shrink: 0;
}

.route-calc-item .no-hotel-badge {
    font-size: var(--text-2xs);
    color: var(--warning);
    background: rgba(245, 158, 11, 0.1);
    padding: 2px 8px;
    border-radius: 10px;
    flex-shrink: 0;
}

.more-techs {
    text-align: center;
    font-size: var(--text-sm);
    color: var(--gray-500);
    padding: 8px;
    font-style: italic;
}

/* ===== ROUTE PROGRESS VIEW ===== */
.route-progress-view {
    padding: 4px 0;
}

.route-progress-overall {
    margin-bottom: 20px;
}

.route-progress-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: var(--text-sm);
    font-weight: 600;
    color: var(--text-color);
}

.route-progress-label #rp-counter {
    font-variant-numeric: tabular-nums;
    color: var(--gray-500);
}

.route-progress-bar-lg {
    height: 12px !important;
    border-radius: var(--radius) !important;
}

.route-progress-bar-lg .progress-fill {
    border-radius: var(--radius);
    background: linear-gradient(90deg, var(--primary), var(--success));
    transition: width 0.4s ease;
}

.route-progress-techs {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 320px;
    overflow-y: auto;
}

.route-progress-tech {
    display: grid;
    grid-template-columns: 14px 1fr auto;
    grid-template-rows: auto auto;
    column-gap: 10px;
    row-gap: 4px;
    align-items: center;
    padding: 10px 12px;
    background: var(--gray-50);
    border-radius: var(--radius);
    border-left: 3px solid transparent;
    transition: all 0.3s ease;
}

.route-progress-tech .tech-color-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    grid-row: 1;
    grid-column: 1;
}

.route-progress-tech .rp-tech-name {
    grid-row: 1;
    grid-column: 2;
    font-weight: 500;
    font-size: var(--text-base);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.route-progress-tech .rp-tech-status {
    grid-row: 1;
    grid-column: 3;
    font-size: var(--text-xs);
    color: var(--gray-500);
    white-space: nowrap;
}

.route-progress-tech .rp-tech-bar {
    grid-row: 2;
    grid-column: 1 / -1;
    height: 6px !important;
}

.route-progress-tech .rp-tech-bar .progress-fill {
    transition: width 0.3s ease;
}

.route-progress-tech.rp-active {
    border-left-color: var(--primary);
    background: var(--blue-50, rgba(59, 130, 246, 0.06));
}

.route-progress-tech.rp-active .rp-tech-name {
    color: var(--primary);
}

.route-progress-tech.rp-active .rp-tech-status {
    color: var(--primary);
}

.route-progress-tech.rp-done {
    opacity: 0.7;
}

.route-progress-tech.rp-done .rp-tech-bar .progress-fill {
    background: var(--success);
}

/* ===== CUSTOM CONFIRM DIALOG ===== */
.app-confirm-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 99999;
    justify-content: center;
    align-items: center;
}
.app-confirm-overlay.active {
    display: flex;
}
.app-confirm-box {
    background: var(--bg-surface, #fff);
    border-radius: var(--radius-lg, 12px);
    padding: 24px 28px;
    min-width: 320px;
    max-width: 460px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.25);
}
.app-confirm-msg {
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-color, #1f2937);
    margin-bottom: 20px;
    white-space: pre-wrap;
    max-height: 60vh;
    overflow-y: auto;
}
.app-confirm-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

/* ===== ESTIMATION CONFIRM DIALOG ===== */
.estimation-confirm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 99998;
    display: flex;
    justify-content: center;
    align-items: center;
    opacity: 0;
    transition: opacity 0.2s;
}
.estimation-confirm-overlay.visible {
    opacity: 1;
}
.estimation-confirm-box {
    background: var(--bg-surface, #fff);
    border-radius: var(--radius-lg, 12px);
    box-shadow: 0 8px 32px rgba(0,0,0,0.3);
    min-width: 500px;
    max-width: 90vw;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.estimation-confirm-header {
    padding: 16px 20px;
    font-size: 15px;
    font-weight: 600;
    background: var(--primary, #3b82f6);
    color: #fff;
    display: flex;
    align-items: center;
    gap: 8px;
}
.estimation-confirm-body {
    padding: 16px 20px;
    overflow-y: auto;
    flex: 1;
}
.estimation-confirm-body p {
    margin: 0 0 12px;
    font-size: 13px;
    color: var(--text-secondary, #6b7280);
}
.estimation-confirm-table-wrap {
    overflow-x: auto;
}
.estimation-confirm-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}
.estimation-confirm-table th {
    text-align: left;
    padding: 6px 8px;
    border-bottom: 2px solid var(--border, #e5e7eb);
    font-weight: 600;
    color: var(--text-secondary, #6b7280);
    white-space: nowrap;
}
.estimation-confirm-table td {
    padding: 5px 8px;
    border-bottom: 1px solid var(--border-light, #f3f4f6);
}
.estimation-confirm-table tr:hover td {
    background: var(--bg-hover, #f9fafb);
}
.estimation-confirm-actions {
    padding: 14px 20px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    border-top: 1px solid var(--border, #e5e7eb);
}

/* ===== IMPORT TECHNICIAN FILTER DIALOG ===== */
.import-tech-filter-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99998;
    display: flex;
    justify-content: center;
    align-items: center;
}

.import-tech-filter-box {
    background: var(--bg-surface, #fff);
    border-radius: var(--radius-lg, 12px);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    width: min(960px, 96vw);
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.import-tech-filter-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border, #e5e7eb);
}

.import-tech-filter-header h3 {
    margin: 0;
    font-size: 16px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.import-tech-filter-header i {
    color: var(--primary, #3b82f6);
}

.import-tech-filter-body {
    padding: 16px 20px;
    overflow: auto;
    flex: 1;
}

.import-tech-filter-subtitle {
    margin: 0 0 12px;
    color: var(--text-secondary, #6b7280);
    font-size: 13px;
}

.import-tech-filter-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}

.import-tech-filter-selected {
    margin-left: auto;
    font-size: 12px;
    color: var(--text-secondary, #6b7280);
}

.import-tech-filter-table-wrap {
    border: 1px solid var(--border, #e5e7eb);
    border-radius: 8px;
    overflow: auto;
    max-height: 50vh;
}

.import-tech-filter-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.import-tech-filter-table th,
.import-tech-filter-table td {
    padding: 8px 10px;
    border-bottom: 1px solid var(--border-light, #f3f4f6);
    text-align: left;
    vertical-align: top;
}

.import-tech-filter-table th {
    background: var(--gray-50, #f9fafb);
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 1;
}

.import-tech-filter-check {
    display: inline-flex;
    align-items: flex-start;
    gap: 8px;
    cursor: pointer;
}

.import-tech-filter-check input[type="checkbox"] {
    margin-top: 2px;
}

.import-tech-filter-actions {
    padding: 14px 20px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    border-top: 1px solid var(--border, #e5e7eb);
}

/* ===== PERMIT CHECK MODAL ===== */
.mapa-permit-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(11, 30, 61, 0.55);
    backdrop-filter: blur(5px);
    z-index: 11000;
}

.mapa-permit-card {
    width: min(580px, calc(100vw - 32px));
    max-height: min(85vh, calc(100vh - 32px));
    display: flex;
    flex-direction: column;
    background: var(--bg-surface, #ffffff);
    border: 1px solid var(--border, #e5e7eb);
    border-radius: var(--radius-lg, 12px);
    box-shadow: var(--shadow-xl, 0 20px 60px rgba(0,0,0,0.25));
    overflow: hidden;
}

.mapa-permit-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border, #e5e7eb);
    background: linear-gradient(180deg, var(--bg-muted, #f9fafb) 0%, var(--bg-surface, #ffffff) 100%);
}

.mapa-permit-logo {
    font-size: 2rem;
    line-height: 1;
}

.mapa-permit-title {
    font-weight: 700;
    font-size: 1.2rem;
    color: var(--text-primary, #111827);
    text-align: center;
    margin: 0;
}

.mapa-permit-subtitle {
    font-size: 0.88rem;
    color: var(--text-muted, #6b7280);
    text-align: center;
    margin: 0;
}

.mapa-permit-body {
    flex: 1;
    overflow: auto;
    padding: 20px 24px;
}

.mapa-permit-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border, #e5e7eb);
    background: var(--bg-muted, #f9fafb);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.mapa-permit-btn {
    height: 40px;
    padding: 0 24px;
    font-size: 0.95rem;
    font-weight: 600;
    border-radius: var(--radius, 8px);
    border: none;
    background: var(--primary, #2563eb);
    color: #ffffff;
    cursor: pointer;
    transition: all 0.15s ease;
}

.mapa-permit-btn:hover {
    background: var(--primary-hover, #1d4ed8);
}

.mapa-permit-config {
    color: var(--text-muted, #6b7280);
    font-size: 0.8rem;
    text-align: center;
}

.mapa-permit-config a {
    color: var(--primary, #2563eb);
    text-decoration: underline;
}

.mapa-permit-summary {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    border-radius: var(--radius, 8px);
    margin-bottom: 16px;
}

.mapa-permit-ok {
    background: #dcfce7;
    border: 1px solid #86efac;
}

.mapa-permit-warning {
    background: #fef3c7;
    border: 1px solid #fcd34d;
}

.mapa-permit-icon {
    font-size: 1.5rem;
    line-height: 1;
}

.mapa-permit-message {
    font-size: 0.92rem;
    color: var(--text-primary, #111827);
    line-height: 1.5;
}

.mapa-permit-details {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.mapa-permit-section {
    border: 1px solid var(--border, #e5e7eb);
    border-radius: var(--radius, 8px);
    background: var(--bg-muted, #f9fafb);
    overflow: hidden;
}

.mapa-permit-section-title {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    background: var(--bg-surface, #ffffff);
    border-bottom: 1px solid var(--border, #e5e7eb);
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-primary, #111827);
    margin: 0;
}

.mapa-permit-list {
    list-style: none;
    margin: 0;
    padding: 8px;
    max-height: 220px;
    overflow: auto;
}

.mapa-permit-item {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 12px;
    padding: 8px 10px;
    border-bottom: 1px solid var(--border-light, #f3f4f6);
    font-size: 0.85rem;
}

.mapa-permit-item:last-child {
    border-bottom: none;
}

.mapa-permit-addr {
    font-weight: 600;
    color: var(--text-primary, #111827);
    flex: 1 1 100%;
}

.mapa-permit-city {
    color: var(--text-muted, #6b7280);
    font-size: 0.78rem;
}

.mapa-permit-status,
.mapa-permit-date {
    font-size: 0.78rem;
    color: #7f1d1d;
    background: #fee2e2;
    border: 1px solid #fecaca;
    border-radius: 999px;
    padding: 2px 10px;
    white-space: nowrap;
}

.mapa-permit-item.mapa-permit-invalid {
    background: #fef2f2;
}

.mapa-permit-item.mapa-permit-expiring {
    background: #fffbeb;
}

.mapa-permit-item.mapa-permit-unknown {
    background: #f3f4f6;
}

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 20px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 700;
    color: #ffffff;
    padding: 0 8px;
}

.badge-missing {
    background: #ef4444;
}

.badge-expired {
    background: #dc2626;
}

.badge-expiring {
    background: #f59e0b;
}

/* ===== PERMITS SIDEBAR PANEL ===== */
.permits-list {
    padding: 0;
    overflow-y: auto;
    max-height: calc(100vh - 200px);
}

.permit-group {
    margin-bottom: 16px;
    border-radius: var(--radius, 8px);
    background: var(--bg-surface, #ffffff);
    border: 1px solid var(--border, #e5e7eb);
    overflow: hidden;
}

.permit-group-title {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: var(--bg-muted, #f9fafb);
    border-bottom: 1px solid var(--border, #e5e7eb);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary, #111827);
    margin: 0;
}

.permit-items {
    list-style: none;
    margin: 0;
    padding: 0;
}

.permit-item {
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-light, #f3f4f6);
    cursor: pointer;
    transition: background 0.15s ease;
}

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

.permit-item:hover {
    background: var(--bg-muted, #f9fafb);
}

.permit-item-addr {
    font-weight: 500;
    font-size: 0.85rem;
    color: var(--text-primary, #111827);
    margin-bottom: 2px;
}

.permit-item-city {
    font-size: 0.75rem;
    color: var(--text-muted, #6b7280);
}

.permit-item-status {
    font-size: 0.75rem;
    color: #dc2626;
    margin-top: 4px;
    font-weight: 500;
}

.permit-item-invalid {
    background: #fef2f2;
}

.permit-item-invalid:hover {
    background: #fee2e2;
}

.permit-item-expiring {
    background: #fffbeb;
}

.permit-item-expiring:hover {
    background: #fef3c7;
}

/* ===== POM MODAL ===== */
/* Dynamicznie dodawane do body (obok .modal-backdrop) — jak .edit-coords-modal */
.pom-modal,
.pom-file-modal,
.pom-scraper-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10001;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.pom-modal {
    max-width: min(920px, 96vw);
    width: 100%;
}

.pom-modal-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.pom-modal-meta {
    font-size: var(--text-sm);
    color: var(--gray-600);
    margin: 0;
}

.pom-aggregate {
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
}

.pom-aggregate-open { background: #c6efce; color: #1b5e20; }
.pom-aggregate-cancelled { background: #ffc7ce; color: #9c0006; }
.pom-aggregate-hold { background: #fff59d; color: #7a6000; }
.pom-aggregate-mixed { background: #ffe0b2; color: #e65100; }

.pom-table-wrap {
    overflow: auto;
    max-height: 50vh;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
}

.pom-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--text-sm);
}

.pom-table th,
.pom-table td {
    padding: 8px 10px;
    text-align: left;
    border-bottom: 1px solid var(--gray-100);
}

.pom-table th {
    background: var(--gray-50);
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 1;
}

.pom-table tbody tr:hover {
    background: var(--gray-50);
}

.pom-row-open td:nth-child(3) { color: #1b5e20; font-weight: 600; }
.pom-row-cancelled td:nth-child(3) { color: #9c0006; font-weight: 600; }
.pom-row-hold td:nth-child(3) { color: #7a6000; font-weight: 600; }

.pom-empty {
    text-align: center;
    color: var(--gray-500);
    padding: 24px !important;
}

.pom-modal-hint {
    font-size: var(--text-xs);
    color: var(--gray-400);
    margin: 0;
}

.pom-modal-key-hint {
    word-break: break-all;
    margin-top: 4px;
}

.pom-modal-key-hint code {
    font-size: 11px;
    color: var(--gray-500);
    background: var(--gray-50);
    padding: 4px 8px;
    border-radius: 4px;
}

.pom-load-warn {
    color: var(--danger);
}

.pom-file-modal {
    max-width: 480px;
    width: 90%;
}

.pom-file-modal-body {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.pom-file-hint {
    font-size: var(--text-sm);
    color: var(--gray-600);
    margin: 0;
}

.pom-file-label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: var(--text-sm);
    font-weight: 500;
}

.pom-file-label input[type="file"] {
    font-size: var(--text-sm);
}

.pom-file-current {
    font-size: var(--text-xs);
    color: var(--gray-500);
    margin: 0;
}

/* ===== POM SCRAPER MODAL ===== */
.pom-scraper-modal {
    max-width: 520px;
    width: 90%;
}

.pom-scraper-modal-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.pom-scraper-modal-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
}

.pom-scraper-modal-footer .btn:first-child {
    margin-right: auto;
}

.pom-scraper-mode {
    display: flex;
    gap: 16px;
    font-size: var(--text-sm);
}

.pom-scraper-mode label {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}

.pom-scraper-select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    font-size: var(--text-sm);
}

.pom-scraper-status {
    margin: 0;
    padding: 10px 12px;
    background: var(--gray-50);
    border-radius: var(--radius);
    font-size: 11px;
    line-height: 1.45;
    max-height: 140px;
    overflow: auto;
    white-space: pre-wrap;
    color: var(--gray-700);
}


