* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Microsoft YaHei', Arial, sans-serif;
}

body {
    background-color: #f5f7fa;
    height: 100vh;
    overflow: hidden;
}

.container {
    display: flex;
    height: 100vh;
    position: relative;
}

.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 2000;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 5px solid #f3f3f3;
    border-top: 5px solid #1e3c72;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-text {
    color: white;
    margin-top: 20px;
    font-size: 16px;
    text-align: center;
}

.sidebar {
    position: relative;
    width: 480px;            /* 加宽 */
    background: white;
    border-right: 1px solid #e0e0e0;
    transition: width 0.3s ease;
    overflow: visible;
    height: 100vh;
    flex-shrink: 0;
}

.sidebar.collapsed {
    width: 0;
    border-right: none;
}

.sidebar.collapsed .sidebar-content {
    display: none;
}

.sidebar-toggle {
    position: absolute;
    top: 50%;
    right: -15px;
    transform: translateY(-50%);
    width: 30px;
    height: 30px;
    background: #1e3c72;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 100;
    box-shadow: 0 2px 5px rgba(0,0,0,0.2);
    font-size: 16px;
    transition: background 0.2s;
}

.sidebar-toggle:hover {
    background: #2a5298;
}

.sidebar.collapsed + .map-area {
    margin-left: 0;
    width: 100%;
}

.sidebar-content {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
    width: 100%;
}

.sidebar-header {
    padding: 15px 20px;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    color: white;
    flex-shrink: 0;
}

.sidebar-header h1 {
    font-size: 20px;
    margin-bottom: 15px;
}

.sidebar-header .app-version {
    font-size: 11.5px;
    opacity: 0.85;
    margin-bottom: 14px;
    letter-spacing: 0.5px;
}

.filter-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 10px;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.filter-group label {
    font-size: 12px;
    opacity: 0.9;
    white-space: nowrap;
}

.filter-group select {
    width: 100%;
    padding: 6px 8px;
    border: none;
    border-radius: 4px;
    background: rgba(255,255,255,0.1);
    color: white;
    font-size: 12px;
    cursor: pointer;
    height: 28px;
}

.filter-group select option {
    color: #333;
    background: white;
    padding: 4px;
}

.operation-section {
    padding: 15px 20px;
    border-bottom: 1px solid #e0e0e0;
    flex-shrink: 0;
}

.button-row {
    display: flex;
    gap: 8px;               /* 减小间距 */
    margin-bottom: 8px;
}

.button-row:last-child {
    margin-bottom: 15px;
}

.action-button {
    flex: 1;
    padding: 6px 8px;
    border: none;
    border-radius: 6px;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    white-space: nowrap;
}

.action-button.primary {
    background: #1e3c72;
    color: white;
}

.action-button.primary:hover {
    background: #2a5298;
}

.action-button.success {
    background: #28a745;
    color: white;
}

.action-button.success:hover {
    background: #218838;
}

.action-button.info {
    background: #17a2b8;
    color: white;
}

.action-button.info:hover {
    background: #138496;
}

.action-button.secondary {
    background: #6c757d;
    color: white;
}

.action-button.secondary:hover {
    background: #5a6268;
}

.action-button.danger {
    background: #dc3545;
    color: white;
}

.action-button.danger:hover {
    background: #c82333;
}

.action-button.danger:disabled {
    background: #e0a9b0;
    cursor: not-allowed;
}

.search-box {
    margin-top: 10px;
}

.search-box input {
    width: 100%;
    padding: 10px 15px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
}

.search-box input:focus {
    outline: none;
    border-color: #1e3c72;
    box-shadow: 0 0 0 2px rgba(30, 60, 114, 0.1);
}

.project-list-section {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
}

.list-header {
    padding: 15px 20px;
    background: #f8f9fa;
    border-bottom: 1px solid #e0e0e0;
    flex-shrink: 0;
}

.list-stats {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    font-size: 13px;
    color: #666;
    line-height: 1.4;
}

.stats-separator {
    color: #ddd;
}

.project-table-container {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

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

.project-table th {
    background: #f8f9fa;
    padding: 12px 8px;
    text-align: left;
    font-weight: bold;
    color: #333;
    border-bottom: 2px solid #e0e0e0;
    position: sticky;
    top: 0;
    z-index: 10;
}

.project-table td {
    padding: 10px 8px;
    border-bottom: 1px solid #f0f0f0;
}

.project-table tbody tr:hover {
    background: #f8f9fa;
}

.project-table tbody tr.selected {
    background: #e3f2fd;
}

.status-indicator {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
}

.status-complete {
    background: #28a745;
}

.status-incomplete {
    background: #dc3545;
}

.status-icon {
    font-size: 16px;
    display: inline-block;
}

.status-icon.red {
    color: #dc3545;
}

.status-icon.yellow {
    color: #ffc107;
}

.status-icon.green {
    color: #28a745;
}

.status-icon.gray {
    color: #6c757d;
}

.project-name-cell {
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.main-project-name {
    font-weight: bold;
    font-size: 13px;
    color: #333;
    display: block;
    margin-bottom: 2px;
}

.sub-project-name {
    font-size: 11px;
    color: #666;
    display: block;
    line-height: 1.3;
}

.delivery-date-cell {
    font-size: 12px;
    color: #555;
    white-space: nowrap;
}

.table-action {
    padding: 4px 8px;
    border: none;
    border-radius: 3px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.table-action.primary {
    background: #1e3c72;
    color: white;
}

.table-action.primary:hover {
    background: #2a5298;
}

.map-area {
    flex: 1;
    position: relative;
    transition: margin-left 0.3s ease;
}

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

.coordinate-pick-hint {
    position: absolute;
    top: 20px;
    left: 20px;
    right: 20px;
    max-width: 400px;
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.15);
    z-index: 1500;
}

.hint-content h3 {
    margin-bottom: 10px;
    color: #1e3c72;
}

.coordinate-input {
    display: flex;
    gap: 10px;
    margin: 15px 0;
}

.coordinate-input input {
    flex: 1;
    padding: 10px;
    border: 2px solid #1e3c72;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
}

.coordinate-input button {
    padding: 10px 20px;
    background: #1e3c72;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.hint-actions {
    display: flex;
    gap: 10px;
    margin-top: 15px;
}

.hint-actions button {
    flex: 1;
    padding: 10px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

.hint-actions button:first-child {
    background: #6c757d;
    color: white;
}

.hint-actions button:last-child {
    background: #ffc107;
    color: #212529;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 2000;
    display: none;
    justify-content: center;
    align-items: center;
}

.modal-content {
    background: white;
    border-radius: 12px;
    width: 450px;
    max-width: 90%;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
    transition: width .2s ease, max-width .2s ease;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid #e8e8e8;
    position: relative;
    background: white;
    z-index: 1;
    border-radius: 12px 12px 0 0;
}

.modal-header h2 {
    color: #1e3c72;
    font-size: 18px;
    font-weight: 600;
    margin: 0;
}

.modal-header button {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #999;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.modal-header button:hover {
    background: #f5f5f5;
    color: #666;
}

.subtab-bar { display: flex; gap: 4px; padding: 12px 20px 0; border-bottom: 1px solid #e8e8e8; flex-shrink: 0; }
.subtab { background: none; border: none; padding: 10px 16px; font-size: 14px; color: #6b7280; cursor: pointer; border-bottom: 2px solid transparent; }
.subtab.active { color: #1e3c72; border-bottom-color: #1e3c72; font-weight: 600; }
.tab-pane { display: block; }

.modal-body {
    display: flex;
    flex-direction: column;
    height: 100%;
    overflow: hidden;
}

.form-scroll-content {
    flex: 1;
    overflow-y: auto;
    padding: 0 20px;
    max-height: calc(90vh - 140px);
}

.form-section {
    margin-bottom: 24px;
    padding-top: 15px;
}

.section-title {
    font-size: 14px;
    font-weight: 600;
    color: #1e3c72;
    margin-bottom: 12px;
    padding-bottom: 6px;
    border-bottom: 1px solid #e8e8e8;
    position: relative;
}

.section-title:before {
    content: '';
    position: absolute;
    left: 0;
    bottom: -1px;
    width: 60px;
    height: 2px;
    background: #1e3c72;
}

.form-row {
    display: flex;
    gap: 15px;
    margin-bottom: 12px;
}

.form-group {
    flex: 1;
}

.form-group.full-width {
    flex: 0 0 100%;
}

.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    color: #555;
    font-weight: 500;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.2s;
    background: white;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #1e3c72;
    box-shadow: 0 0 0 2px rgba(30, 60, 114, 0.1);
}

.form-group input[readonly] {
    background: #f8f9fa;
    color: #666;
}

.coordinate-input-group {
    display: flex;
    gap: 10px;
    align-items: center;
}

.coordinate-input-group input {
    flex: 1;
}

.pick-btn {
    padding: 10px 16px;
    background: #1e3c72;
    color: white;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s;
    flex-shrink: 0;
}

.pick-btn:hover {
    background: #2a5298;
}

.status-display {
    background: #f8f9fa;
    border-radius: 8px;
    padding: 15px;
    margin: 15px 0;
    border: 1px solid #e8e8e8;
}

.status-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.status-item {
    text-align: center;
    flex: 1;
}

.status-label {
    font-size: 13px;
    color: #666;
    margin-bottom: 4px;
}

.status-value {
    font-size: 16px;
    font-weight: 600;
}

.status-value.delivered {
    color: #28a745;
}

.status-value.partial {
    color: #ffc107;
}

.status-value.undelivered {
    color: #dc3545;
}

.info-row {
    display: flex;
    padding: 10px 0;
    border-bottom: 1px solid #f0f0f0;
    align-items: flex-start;
    min-height: 38px;
}

.info-row:last-child {
    border-bottom: none;
}

.info-label {
    width: 100px;
    font-size: 13px;
    color: #666;
    font-weight: 500;
    flex-shrink: 0;
    line-height: 1.5;
}

.info-value {
    flex: 1;
    font-size: 14px;
    color: #333;
    line-height: 1.5;
    word-break: break-word;
    padding-left: 10px;
}

.modal-actions {
    display: flex;
    gap: 10px;
    padding: 20px;
    border-top: 1px solid #e8e8e8;
    background: white;
    flex-shrink: 0;
}

.btn {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background: #1e3c72;
    color: white;
}

.btn-primary:hover {
    background: #2a5298;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

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

.btn-danger:hover {
    background: #c82333;
}

::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

.project-marker {
    position: relative;
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.project-marker:hover {
    transform: scale(1.2);
    z-index: 100;
}

.project-marker.highlighted {
    border-width: 3px;
    border-color: #ffcc00;
    transform: scale(1.2);
    z-index: 100;
}

.project-marker.new { 
    background-color: #28a745;
}

.project-marker.stable { 
    background-color: #ffc107;
    color: #212529;
}

.project-marker.old { 
    background-color: #dc3545;
}

.project-marker.unfinished { 
    background-color: #007bff;
}

.project-marker.closed::after {
    content: '✓';
    position: absolute;
    top: -5px;
    right: -5px;
    background: #28a745;
    color: white;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    font-size: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid white;
    box-shadow: 0 1px 2px rgba(0,0,0,0.2);
    z-index: 2;
}

.project-marker.small { 
    width: 20px; 
    height: 20px; 
    font-size: 10px; 
}

.project-marker.medium { 
    width: 24px; 
    height: 24px; 
    font-size: 12px; 
}

.project-marker.large { 
    width: 28px; 
    height: 28px; 
    font-size: 14px; 
}

.modal-content.modal-lg {
    width: 700px;
    max-width: 95%;
}

small {
    display: block;
    margin-top: 4px;
    font-size: 12px;
    color: #6c757d;
}

/* 备份管理样式 */
.backup-list {
    max-height: 400px;
    overflow-y: auto;
}
.backup-item {
    padding: 10px 15px;
    border-bottom: 1px solid #eee;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.backup-item:hover {
    background: #f8f9fa;
}
.backup-time {
    font-size: 14px;
    color: #333;
}
.backup-restore-btn {
    padding: 4px 12px;
    background: #ffc107;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}
.backup-restore-btn:hover {
    background: #e0a800;
}

@media (max-width: 1200px) {
    .sidebar {
        width: 400px;
    }
}

@media (max-width: 768px) {
    .container {
        flex-direction: column;
    }
    .sidebar {
        width: 100%;
        height: 60vh;
    }
    .sidebar.collapsed {
        width: 0;
        height: 100vh;
    }
    .filter-grid {
        grid-template-columns: 1fr;
        gap: 6px;
    }
    .filter-group select {
        height: 32px;
        font-size: 14px;
    }
    .coordinate-pick-hint {
        top: 10px;
        left: 10px;
        right: 10px;
        padding: 15px;
    }
    .modal-content {
        width: 95%;
        max-height: 85vh;
    }
    .form-row {
        flex-direction: column;
        gap: 10px;
    }
    .coordinate-input-group {
        flex-direction: column;
        align-items: stretch;
    }
    .pick-btn {
        width: 100%;
    }
    .info-row {
        flex-direction: column;
        gap: 5px;
    }
    .info-label {
        width: 100%;
    }
    .info-value {
        padding-left: 0;
    }
    .list-stats {
        font-size: 12px;
        gap: 5px;
    }
}

/* ===== 项目信息浮层：页面级可拖动面板（移植自「物业交付评估」pip 风格） ===== */
/* 作用域严格限定 .proj-info-panel，避免影响 edit/add 等其他弹窗 */
.proj-info-panel {
    position: fixed;
    top: 80px;
    right: 24px;
    width: 440px;
    max-width: 92vw;
    max-height: 82vh;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 14px 44px rgba(0,0,0,0.20);
    z-index: 2500;
    display: none;
    flex-direction: column;
    overflow: hidden;
    font-size: 13px;
    transition: box-shadow 0.2s;
}
.proj-info-panel.pip-show { display: flex; }

.pip-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 11px 16px;
    cursor: move;
    user-select: none;
    background: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%);
    color: #fff;
    font-weight: 600;
}
.pip-title { font-size: 14px; }
.pip-close {
    background: transparent;
    border: none;
    color: #fff;
    font-size: 18px;
    line-height: 1;
    padding: 0 4px;
    cursor: pointer;
    transition: opacity 0.2s;
}
.pip-close:hover { opacity: 0.8; }

.pip-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    overflow: hidden;
}

.proj-info-panel .subtab-bar {
    display: flex;
    gap: 4px;
    padding: 10px 16px 0;
    background: #f8fafc;
    border-bottom: 1px solid #eef1f5;
}
.proj-info-panel .subtab {
    flex: 1;
    padding: 8px 0;
    border: none;
    background: transparent;
    color: #7286a0;
    font-size: 13px;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: color 0.2s, border-color 0.2s;
}
.proj-info-panel .subtab.active {
    color: #1e3c72;
    font-weight: 600;
    border-bottom-color: #1e3c72;
}

/* 内容区可滚动 */
.proj-info-panel .info-panel-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 14px 16px;
}

/* 分组改造成卡片 */
.proj-info-panel .form-section {
    background: #ffffff;
    border: 1px solid #e8eef5;
    border-radius: 10px;
    padding: 12px 14px 4px;
    margin-bottom: 14px;
    box-shadow: 0 1px 3px rgba(30,60,114,0.05);
}
.proj-info-panel .section-title {
    background: linear-gradient(135deg, #eef3fb, #e3ecf7);
    color: #1e3c72;
    margin: -12px -14px 10px;
    padding: 9px 14px;
    border-radius: 10px 10px 0 0;
    border-bottom: none;
    font-size: 12.5px;
    font-weight: 600;
}
.proj-info-panel .section-title:before { display: none; }

/* 字段行：标签浅蓝灰、值加粗深色，整体缩小一号 */
.proj-info-panel .info-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    padding: 7px 4px;
    border-bottom: 1px dashed #eef1f5;
    font-size: 13px;
}
.proj-info-panel .info-label {
    flex: 0 0 112px;
    color: #7286a0;
    font-weight: 500;
    font-size: 12.5px;
}
.proj-info-panel .info-value {
    flex: 1;
    text-align: left;
    padding-left: 8px;
    color: #1f2d3d;
    font-weight: 600;
    font-size: 13px;
    word-break: break-all;
}

/* 底部操作按钮 */
.proj-info-panel .pip-actions {
    display: flex;
    gap: 10px;
    padding: 12px 16px;
    border-top: 1px solid #eef1f5;
    background: #fafbfc;
}
.proj-info-panel .pip-actions .btn {
    flex: 1;
    padding: 9px;
    font-size: 13px;
}

/* 拖动期间禁止选中文本，保持手感 */
body.dragging-modal { user-select: none; cursor: move; }
.dragging-modal, .dragging-modal * { user-select: none !important; }