@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');

/* ── Placeholders ───────────────────────────────────────────────────── */
::placeholder {
    color: #c8cdd5;
    opacity: 1;
}

/* ═══════════════════════════════════════════════════════════════
   Dashboard — Projects Page
   Sidebar is 280px (matching invoices panel width)
   ═══════════════════════════════════════════════════════════════ */

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

body {
    font-family: 'Poppins', sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f7fa;
    padding-top: 44px;
}

/* ─── Top Navigation ─────────────────────────────────────────── */
.top-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 44px;
    background: #2c3e50;
    display: flex;
    align-items: center;
    padding: 0 20px;
    z-index: 800;
    border-bottom: 2px solid #3498db;
}

.top-nav-links {
    display: flex;
    gap: 4px;
}

.top-nav-link {
    color: rgba(255,255,255,0.7);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    padding: 6px 14px;
    border-radius: 5px;
    transition: background 0.15s, color 0.15s;
}

.top-nav-link:hover {
    background: rgba(255,255,255,0.1);
    color: #fff;
}

.top-nav-link.active {
    background: #3498db;
    color: #fff;
}

.top-nav-user {
    margin-left: auto;
    position: relative;
}

.top-nav-user-btn {
    background: rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.85);
    border: none;
    border-radius: 5px;
    padding: 5px 11px;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    transition: background 0.15s;
    white-space: nowrap;
    max-width: 220px;
}

.top-nav-user-btn:hover {
    background: rgba(255,255,255,0.18);
    color: #fff;
}

#top-nav-user-email {
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 180px;
}

.top-nav-caret {
    opacity: 0.6;
    font-size: 10px;
}

.top-nav-user-dropdown {
    display: none;
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    background: #1a252f;
    border-radius: 7px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.3);
    min-width: 150px;
    overflow: hidden;
    z-index: 200;
}

.top-nav-user-dropdown.open {
    display: block;
}

.top-nav-logout-btn {
    width: 100%;
    background: none;
    border: none;
    color: rgba(255,255,255,0.8);
    padding: 11px 16px;
    text-align: left;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.top-nav-logout-btn:hover {
    background: rgba(231,76,60,0.2);
    color: #e74c3c;
}

/* ─── Page View Container (list & detail, full-width) ───────── */
.projects-page-view {
    max-width: 1100px;
    margin: 0 auto;
    padding: 24px 30px;
}

/* Hide inactive view (works on both desktop & mobile) */
.view-hidden { display: none !important; }

/* ─── Project Action Bar (back + status, mirrors ivp-action-bar) */
.proj-action-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    background: #f8f9fa;
    border: 1px solid #e3e8ee;
    border-radius: 8px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

/* ─── Map + Street View Split Row ───────────────────────────── */
.map-sv-row {
    display: flex;
    gap: 12px;
    margin-bottom: 24px;
}

.map-sv-row .map-wrapper {
    flex: 1;
    margin-bottom: 0;
    min-width: 0;
}

.streetview-wrapper {
    flex: 1;
    min-width: 0;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    position: relative;
    background: #1a252f;
    transition: height 0.4s ease;
}

.streetview-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.streetview-label {
    position: absolute;
    bottom: 10px;
    left: 12px;
    background: rgba(0,0,0,0.45);
    color: white;
    font-size: 11px;
    padding: 3px 9px;
    border-radius: 20px;
    backdrop-filter: blur(4px);
    pointer-events: none;
}

/* ─── Map Wrapper ────────────────────────────────────────────── */
.map-wrapper {
    height: 280px;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

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

/* ─── Detail Sections ────────────────────────────────────────── */
.detail-section {
    background: white;
    border-radius: 12px;
    padding: 22px 25px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.07);
    margin-bottom: 20px;
}

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

/* Back button row (above map) */
.back-btn-row {
    margin-bottom: 8px;
}

.back-all-projects-btn {
    background: none;
    border: none;
    color: #3498db;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    padding: 0 12px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: color 0.15s;
}

.back-all-projects-btn:hover {
    color: #2980b9;
    text-decoration: underline;
}

/* Detail header actions */
.detail-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

.detail-section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.detail-section-header h3 {
    font-size: 18px;
    color: #2c3e50;
}

/* Header section specific */
.detail-header-section {
    padding: 16px 22px;
}

.detail-header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.detail-title-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 4px;
}

.detail-title-row h2 {
    font-size: 22px;
    color: #2c3e50;
    margin: 0;
}

.project-address-sub {
    font-size: 13px;
    color: #7f8c8d;
    margin: 0;
}

/* ─── Buttons ────────────────────────────────────────────────── */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    text-decoration: none;
}

.btn-primary {
    background-color: #3498db;
    color: white;
}

.btn-primary:hover {
    background-color: #2980b9;
    transform: translateY(-1px);
}

.btn-secondary {
    background-color: #95a5a6;
    color: white;
}

.btn-secondary:hover {
    background-color: #7f8c8d;
}

.btn-sm {
    padding: 7px 14px;
    font-size: 13px;
}

.btn-danger {
    background-color: #e74c3c;
    color: white;
}

.btn-danger:hover {
    background-color: #c0392b;
}

.btn-danger:disabled,
.btn-danger:disabled:hover {
    background-color: #e0b0ad;
    cursor: not-allowed;
    opacity: 0.65;
}

.np-error {
    color: #e74c3c;
    font-size: 13px;
    margin-top: 8px;
    line-height: 1.4;
}

.np-error a {
    color: #e74c3c;
    font-weight: 600;
    text-decoration: underline;
    cursor: pointer;
}

.delete-project-wrap {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
}

.delete-hint {
    font-size: 11px;
    color: #e74c3c;
    min-height: 14px;
}

/* ─── Status Segmented Toggle ───────────────────────────────── */
.status-toggle-group {
    display: flex;
    border-radius: 7px;
    overflow: hidden;
    border: 1.5px solid #dde2e8;
    flex-shrink: 0;
    margin-bottom: 16px;
}

.status-toggle-btn {
    background: white;
    border: none;
    border-right: 1.5px solid #dde2e8;
    padding: 6px 11px;
    font-size: 12px;
    font-weight: 500;
    color: #95a5a6;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
}

.status-toggle-btn:last-child {
    border-right: none;
}

.status-toggle-btn:hover:not(.active-status) {
    background: #f4f6f7;
    color: #2c3e50;
}

.status-toggle-btn.active-status[data-status="active"] {
    background: #d5f5e3;
    color: #1e8449;
    font-weight: 700;
}

.status-toggle-btn.active-status[data-status="on-hold"] {
    background: #fef9e7;
    color: #b7950b;
    font-weight: 700;
}

.status-toggle-btn.active-status[data-status="cancelled"] {
    background: #fdedec;
    color: #c0392b;
    font-weight: 700;
}

.status-toggle-btn.active-status[data-status="completed"] {
    background: #eaecee;
    color: #717d7e;
    font-weight: 700;
}

.status-toggle-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* ─── Status Badges ──────────────────────────────────────────── */
.project-badge {
    flex-shrink: 0;
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.project-badge.active {
    background: #d5f5e3;
    color: #1e8449;
}

.project-badge.completed {
    background: #eaecee;
    color: #717d7e;
}

.project-badge.on-hold {
    background: #fef9e7;
    color: #b7950b;
}

.project-badge.cancelled {
    background: #fdedec;
    color: #c0392b;
}

/* ─── Customer Info Grid ─────────────────────────────────────── */
.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 18px;
}

.info-item label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    color: #7f8c8d;
    text-transform: uppercase;
    margin-bottom: 5px;
    letter-spacing: 0.5px;
}

.info-item p {
    font-size: 14px;
    color: #2c3e50;
    font-weight: 500;
}

/* Multi-value customer fields */
.info-item div p {
    font-size: 14px;
    color: #2c3e50;
    font-weight: 500;
    margin: 0 0 2px;
}

/* Section icon (Material Symbols) — consistent 18px */
.section-icon {
    font-size: 18px;
    vertical-align: middle;
    margin-right: 4px;
}

/* Invoice ID subtitle */
.invoice-id-sub {
    font-size: 11px;
    color: #95a5a6;
    margin-bottom: 6px;
}

/* ─── Notes Log ──────────────────────────────────────────────── */
.notes-log {
    max-height: 260px;
    overflow-y: auto;
    margin-bottom: 12px;
}

.notes-empty {
    font-size: 13px;
    color: #95a5a6;
    text-align: center;
    padding: 16px 0;
}

.note-entry {
    padding: 8px 0;
    border-bottom: 1px solid #f0f2f4;
}

.note-entry:last-child {
    border-bottom: none;
}

.note-body {
    display: flex;
    align-items: center;
    gap: 8px;
}

.note-text {
    font-size: 14px;
    color: #2c3e50;
    flex: 1;
    line-height: 1.4;
}

.note-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 4px;
}

.note-user {
    font-size: 11px;
    font-weight: 600;
    color: #7f8c8d;
}

.note-date {
    font-size: 11px;
    color: #b0b8c1;
}

.note-actions {
    display: flex;
    gap: 4px;
    margin-left: auto;
}

.note-action-icon {
    font-size: 16px;
    color: #95a5a6;
    cursor: pointer;
    border-radius: 4px;
    padding: 2px;
    transition: color 0.15s, background 0.15s;
}

.note-action-icon:hover {
    color: #3498db;
    background: rgba(52,152,219,0.08);
}

.note-delete-icon:hover {
    color: #e74c3c;
    background: rgba(231,76,60,0.08);
}

.note-edit-input {
    flex: 1;
    padding: 6px 10px;
    border: 1.5px solid #3498db;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    color: #2c3e50;
    outline: none;
    box-shadow: 0 0 0 3px rgba(52,152,219,0.12);
}

.note-edit-actions {
    display: flex;
    gap: 4px;
    flex-shrink: 0;
}

.note-add-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.note-add-row input {
    flex: 1;
    padding: 8px 12px;
    border: 1.5px solid #dde2e8;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    color: #2c3e50;
    outline: none;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.note-add-row input:focus {
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52,152,219,0.12);
}

/* ─── Invoices Grid ──────────────────────────────────────────── */
.invoices-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.invoice-card {
    padding: 15px;
    border: 1px solid #e1e8ed;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.invoice-card:hover {
    border-color: #3498db;
    box-shadow: 0 4px 12px rgba(52,152,219,0.15);
    transform: translateY(-2px);
}

.invoice-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 10px;
    min-width: 0;
}

.invoice-number {
    font-size: 13px;
    font-weight: 600;
    color: #2c3e50;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.invoice-date {
    font-size: 12px;
    color: #7f8c8d;
    white-space: nowrap;
    flex-shrink: 0;
}

.invoice-amount {
    font-size: 20px;
    font-weight: 700;
    color: #27ae60;
    margin-bottom: 6px;
}

.invoice-details {
    font-size: 12px;
    color: #7f8c8d;
}

/* ─── Photos Grid ────────────────────────────────────────────── */
.photos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
}

.photo-card {
    position: relative;
    aspect-ratio: 1;
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.photo-card:hover {
    transform: scale(1.04);
    box-shadow: 0 4px 16px rgba(0,0,0,0.18);
}

.photo-card img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.photo-info {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0,0,0,0.72), transparent);
    color: white;
    padding: 28px 8px 8px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
}

.photo-category-chip {
    display: inline-block;
    background: rgba(52,152,219,0.9);
    color: white;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.4px;
    padding: 2px 7px;
    border-radius: 20px;
    text-transform: uppercase;
    white-space: nowrap;
    flex-shrink: 0;
}

.photo-date-label {
    font-size: 11px;
    opacity: 0.85;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ─── Empty States ───────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 50px 20px;
    color: #95a5a6;
}

.empty-state-icon {
    font-size: 54px;
    margin-bottom: 12px;
}

.empty-state h3 {
    font-size: 18px;
    margin-bottom: 8px;
}

.empty-state p {
    font-size: 14px;
}

.no-pin {
    color: #bdc3c7;
    font-size: 11px;
    font-style: italic;
}

/* ─── Modals ─────────────────────────────────────────────────── */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    animation: fadeIn 0.25s ease;
}

.modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.modal-content {
    background-color: white;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.25s ease;
}

@keyframes slideUp {
    from { transform: translateY(40px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 22px 25px;
    border-bottom: 1px solid #e1e8ed;
}

.modal-header h2 {
    font-size: 20px;
    color: #2c3e50;
}

.modal-close {
    font-size: 26px;
    background: none;
    border: none;
    cursor: pointer;
    color: #95a5a6;
    transition: color 0.2s;
    line-height: 1;
}

.modal-close:hover { color: #2c3e50; }

.modal-body { padding: 22px 25px; }

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 14px 22px;
    border-top: 1px solid #eee;
}

/* Image Modal */
.image-modal-content {
    max-width: 90%;
    max-height: 90vh;
    padding: 0;
    position: relative;
    display: flex;
    flex-direction: column;
}

.image-modal-content .modal-close {
    position: absolute;
    top: 14px;
    right: 14px;
    background: rgba(0,0,0,0.65);
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.image-modal-content img {
    width: 100%;
    height: auto;
    display: block;
    min-height: 0;
    object-fit: contain;
    flex: 1 1 auto;
    overflow: hidden;
}

@media (min-width: 701px) {
    .image-modal-content {
        max-width: 600px;
    }
    .image-modal-content img {
        max-height: calc(90vh - 60px);
    }
}

.lowres-tag {
    position: absolute;
    top: 12px;
    left: 12px;
    pointer-events: none;
}

.image-modal-footer {
    padding: 16px;
    text-align: center;
    background: white;
}

/* ─── Photo Review Modal ─────────────────────────────────────── */
.photo-review-modal-content {
    max-width: 860px;
    width: 95vw;
    max-height: 85vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.photo-review-modal-content .modal-body {
    overflow-y: auto;
    flex: 1;
}

.review-count {
    color: #7f8c8d;
    font-size: 13px;
    margin: 2px 0 0;
}

.review-photos-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 14px;
    padding: 4px 0 8px;
}

.review-photo-item {
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    overflow: hidden;
    background: #fafafa;
    display: flex;
    flex-direction: column;
}

.review-thumb {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    display: block;
}

.review-photo-meta { padding: 8px; }

.review-file-name {
    font-size: 11px;
    color: #555;
    margin: 0 0 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.review-category-select {
    width: 100%;
    padding: 5px 8px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 13px;
    background: white;
    cursor: pointer;
    color: #2c3e50;
}

.review-category-select:focus {
    border-color: #3498db;
    outline: none;
    box-shadow: 0 0 0 3px rgba(52,152,219,0.15);
}

/* ─── Scrollbars ─────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.25); border-radius: 10px; }
.main-content::-webkit-scrollbar-thumb { background: #bdc3c7; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.4); }

/* ─── Mobile Projects Section ────────────────────────────────── */
#mobile-projects-section {
    display: none;
}

.mobile-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.mobile-section-title {
    font-size: 14px;
    font-weight: 700;
    color: #2c3e50;
}

.mobile-search-bar {
    margin-bottom: 10px;
}

.mobile-search-bar input {
    width: 100%;
    padding: 9px 12px;
    border: 1.5px solid #dde2e8;
    border-radius: 8px;
    font-size: 13px;
    color: #2c3e50;
    background: white;
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.mobile-search-bar input:focus {
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52,152,219,0.12);
}

.mobile-projects-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 4px;
    max-width: 100%;
    min-width: 0;
}

.mobile-projects-list::-webkit-scrollbar { width: 5px; }
.mobile-projects-list::-webkit-scrollbar-track { background: transparent; }
.mobile-projects-list::-webkit-scrollbar-thumb { background: #d5dce4; border-radius: 4px; }

.mobile-project-card {
    background: white;
    border-radius: 6px;
    border: 1px solid #e8ecf0;
    padding: 9px 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    cursor: pointer;
    transition: background 0.15s, box-shadow 0.15s;
}

.mobile-project-card:hover,
.mobile-project-card:active {
    background: #f0f7ff;
    box-shadow: 0 2px 8px rgba(52,152,219,0.15);
}

.mobile-project-card.map-highlight,
.panel-project-card.map-highlight {
    animation: mapPinHighlight 1.8s ease-out forwards;
}

@keyframes mapPinHighlight {
    0%   { box-shadow: 0 0 0 3px rgba(52,152,219,0.7); background: #e8f4fd; }
    60%  { box-shadow: 0 0 0 5px rgba(52,152,219,0.3); background: #f0f7ff; }
    100% { box-shadow: none; background: transparent; }
}

.mpc-name {
    font-weight: 700;
    font-size: 13px;
    color: #2c3e50;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px;
}

.mpc-address {
    font-size: 11px;
    color: #7f8c8d;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 5px;
}

.mpc-meta {
    display: flex;
    align-items: center;
    gap: 8px;
}

.mpc-meta-item {
    font-size: 11px;
    color: #7f8c8d;
}

/* ─── New Project Modal ──────────────────────────────────── */
.new-project-modal-content {
    max-width: 480px;
    width: 90%;
    border-radius: 12px;
    overflow: hidden;
}

.np-hint {
    font-size: 13px;
    color: #7f8c8d;
    margin-bottom: 20px;
    line-height: 1.5;
}

.np-form-group {
    margin-bottom: 18px;
}

.np-form-group label {
    display: block;
    font-weight: 600;
    font-size: 14px;
    color: #2c3e50;
    margin-bottom: 6px;
}

.np-form-group input {
    width: 100%;
    padding: 10px 12px;
    border: 1.5px solid #dde2e8;
    border-radius: 6px;
    font-size: 14px;
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.np-form-group input:focus {
    border-color: #3498db;
    box-shadow: 0 0 0 3px rgba(52,152,219,0.12);
}

.np-address-wrapper {
    position: relative;
}

.np-autocomplete-list {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1.5px solid #dde2e8;
    border-top: none;
    border-radius: 0 0 6px 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    list-style: none;
    margin: 0;
    padding: 0;
    z-index: 10;
    max-height: 200px;
    overflow-y: auto;
}

.np-autocomplete-list li {
    padding: 10px 12px;
    font-size: 13px;
    color: #2c3e50;
    cursor: pointer;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.15s;
}

.np-autocomplete-list li:last-child {
    border-bottom: none;
}

.np-autocomplete-list li:hover {
    background: #eaf4fb;
    color: #2980b9;
}

/* ─── Responsive ─────────────────────────────────────────────── */
@media (min-width: 701px) {
    /* Hide mobile-only card elements on desktop */
    .proj-mobile-only { display: none !important; }

    /* Desktop table header row */
    .proj-table-header {
        display: grid;
        grid-template-columns: 1fr 1fr 90px 55px 100px;
        padding: 7px 14px;
        background: #f0f4f8;
        border: 1px solid #dde2e8;
        border-radius: 8px 8px 0 0;
        font-size: 11px;
        font-weight: 700;
        color: #7f8c8d;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        align-items: center;
    }

    /* Remove card gaps on desktop — rows separated by border */
    .mobile-projects-list { gap: 0; }

    /* Each row is a grid matching the header columns */
    .mobile-project-card {
        display: grid;
        grid-template-columns: 1fr 1fr 90px 55px 100px;
        align-items: center;
        padding: 10px 14px;
        border-radius: 0;
        border: 1px solid #e8ecf0;
        border-top: none;
        box-shadow: none;
    }

    .mobile-project-card:last-child {
        border-radius: 0 0 8px 8px;
    }

    .mobile-project-card:hover,
    .mobile-project-card:active {
        background: #f0f7ff;
        box-shadow: none;
    }

    /* Column styles */
    .proj-col-address {
        font-size: 13px;
        font-weight: 600;
        color: #2c3e50;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .proj-col-customer {
        font-size: 12px;
        color: #7f8c8d;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .proj-col-status {
        display: flex;
        align-items: center;
    }

    .proj-col-invoices {
        font-size: 13px;
        font-weight: 600;
        color: #2c3e50;
        text-align: center;
    }

    .proj-col-amount {
        font-size: 13px;
        font-weight: 600;
        color: #2c3e50;
        text-align: right;
        padding-right: 8px;
    }

    .proj-table-header span:nth-child(4) { text-align: center; }
    .proj-table-header span:last-child   { text-align: right; padding-right: 8px; }
}

@media (max-width: 700px) {
    /* Hide desktop table elements on mobile */
    .proj-table-header { display: none !important; }
    .proj-col { display: none !important; }

    /* Show mobile card elements */
    .proj-mobile-only { display: block; }
    .mpc-meta.proj-mobile-only { display: flex; }

    /* Restore card layout with gaps */
    .mobile-projects-list { gap: 8px; }
    .mobile-project-card {
        display: block;
        border-radius: 6px;
        box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    }

    /* List view: fills viewport, scrolls its cards */
    #projects-list-view {
        padding: 12px;
        flex: 1;
        overflow-y: auto;
        min-height: 0;
    }

    /* Detail view: flex column that fills viewport and contains sub-scroll */
    #projects-detail-view {
        display: flex;
        flex-direction: column;
        flex: 1;
        overflow: hidden;
        padding: 0;
        max-width: 100%;
        min-height: 0;
    }

    /* Action bar: pinned at top, never scrolls */
    #projects-detail-view .proj-action-bar {
        flex-shrink: 0;
        margin-bottom: 0;
        border-radius: 0;
        border-left: none;
        border-right: none;
        border-top: none;
    }

    /* Project detail content: fills remaining height and scrolls */
    #project-detail {
        flex: 1;
        overflow-y: auto;
        padding: 12px;
        min-height: 0;
    }

    /* Hide sidebar on mobile — projects listed inline */
    .sidebar { display: none; }

    /* Prevent body scroll — only inner panels scroll */
    html, body { overflow: hidden; height: 100%; }

    /* Fill exactly the space below the fixed nav; no page scroll */
    .main-content {
        margin-left: 0;
        max-width: 100%;
        padding: 0;
        height: calc(100dvh - 44px);
        overflow: hidden;
        display: flex;
        flex-direction: column;
    }

    /* Map row sits at top as a fixed-height flex child */
    .map-sv-row {
        position: static;
        z-index: auto;
        background: none;
        margin: 0;
        padding: 0;
        flex-shrink: 0;
    }

    .map-wrapper { height: 200px; }

    /* Contain Leaflet z-indices so they don't bleed over sticky elements */
    .map-wrapper { isolation: isolate; }

    /* Project list mode: map fixed, list scrolls */
    .invoice-card   { padding: 10px 12px; }
    .invoice-amount { font-size: 16px; margin-bottom: 3px; }
    .invoice-number { font-size: 12px; }
    .invoice-header { margin-bottom: 6px; }
    .info-grid      { grid-template-columns: 1fr; }
    .photos-grid    { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }

    .detail-section { padding: 16px; }

    .status-toggle-btn   { flex-shrink: 0; font-size: 11px; padding: 5px 8px; }

    /* Header actions stack on mobile */
    .detail-header-inner      { flex-direction: column; align-items: flex-start; gap: 10px; }
    .detail-header-actions    { width: 100%; justify-content: flex-end; }
}

@media (max-width: 600px) {
    .review-photos-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    }
}
