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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
                 "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #e4edf5 100%);
    color: #2d3748;
    min-height: 100vh;
    line-height: 1.6;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header */
header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    padding: 48px 0 60px;
    margin-bottom: 32px;
    border-bottom-left-radius: 32px;
    border-bottom-right-radius: 32px;
    box-shadow: 0 10px 40px rgba(102, 126, 234, 0.3);
}
.header-inner { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 16px; }
header h1 { font-size: 36px; margin-bottom: 8px; font-weight: 700; }
header .subtitle { opacity: 0.9; font-size: 16px; }

/* 按钮 */
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    gap: 4px;
    padding: 10px 18px;
    border: none; border-radius: 10px;
    font-size: 14px; font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    line-height: 1;
    white-space: nowrap;
}
.btn-sm { padding: 6px 12px; font-size: 12px; border-radius: 8px; }
.btn-primary {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.35);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 16px rgba(102,126,234,.45); }
.btn-outline {
    background: #fff; color: #667eea;
    border: 2px solid #e0e7ff;
}
.btn-outline:hover { background: #eef2ff; border-color: #c7d2fe; }
.btn-ghost {
    background: rgba(255,255,255,0.18);
    color: #fff; backdrop-filter: blur(6px);
    border: 1px solid rgba(255,255,255,0.3);
}
.btn-ghost:hover { background: rgba(255,255,255,0.28); }
.btn-clear {
    background: #fef3c7; color: #92400e;
}
.btn-clear:hover { background: #fde68a; }

/* 可编辑金额 */
.editable-amount {
    cursor: pointer;
    border-bottom: 1px dashed transparent;
    padding: 0 2px;
    transition: all 0.18s;
    position: relative;
}
.editable-amount:hover {
    border-bottom-color: currentColor;
    background: rgba(102,126,234,0.08);
    border-radius: 4px;
}
.editable-amount.empty-amount {
    color: #f59e0b; font-weight: 500;
    padding: 4px 10px;
    background: #fffbeb;
    border: 1px dashed #fcd34d;
    border-radius: 8px;
}
.editable-amount.empty-amount:hover { background: #fef3c7; }

.edit-pen {
    font-size: 13px; opacity: 0.5;
    cursor: pointer; padding: 2px 4px;
    transition: opacity 0.2s;
}
.edit-pen:hover { opacity: 1; }
.edit-pen.small-pen { font-size: 12px; margin-left: 4px; }

.reno-money .spent.editable-amount {
    padding: 4px 8px;
    border-radius: 8px;
}
.reno-money .edit-pen { margin-left: -2px; }

/* Tip tag 替换 tag */
.tip-tag {
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    color: #92400e;
    padding: 5px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}
.tip-tag.tip-blue {
    background: linear-gradient(135deg, #dbeafe, #bfdbfe);
    color: #1e40af;
}
.tip-tag.tip-green {
    background: linear-gradient(135deg, #d1fae5, #a7f3d0);
    color: #065f46;
}

/* 行高亮 */
.no-amt-row { background: #fffbeb40; }
.no-amt-row:hover { background: #fff7d6 !important; }

/* 房子月度表格 */
.house-monthly-table { margin-top: 8px; }
.house-monthly-table .month-cell { font-weight: 600; color: #4c51bf; }
.house-monthly-table .subtotal { font-weight: 700; color: #2d3748; }

/* Modal */
.modal-mask {
    position: fixed; inset: 0;
    background: rgba(45, 55, 72, 0.55);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex; align-items: center; justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.2s ease;
    padding: 20px;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
    background: #fff;
    border-radius: 18px;
    padding: 32px 28px 24px;
    width: 100%; max-width: 400px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.2), 0 0 0 1px rgba(0,0,0,0.03);
    animation: slideUp 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    position: relative;
    overflow: hidden;
}
.modal::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: linear-gradient(90deg, #667eea, #764ba2);
}
@keyframes slideUp {
    from { transform: translateY(30px) scale(0.96); opacity: 0; }
    to { transform: translateY(0) scale(1); opacity: 1; }
}
.modal-title {
    font-size: 18px;
    font-weight: 700;
    color: #1a202c;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.modal-title::before {
    content: '';
    display: inline-block;
    width: 4px;
    height: 18px;
    background: linear-gradient(180deg, #667eea, #764ba2);
    border-radius: 2px;
}
.modal-tip {
    font-size: 13px;
    color: #718096;
    margin-bottom: 20px;
    padding: 8px 12px;
    background: #f7fafc;
    border-radius: 8px;
    border-left: 3px solid #667eea;
    line-height: 1.5;
}
.modal-input-wrap {
    display: flex; align-items: center;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 4px 4px 4px 16px;
    transition: all 0.2s ease;
    margin-bottom: 12px;
    background: #fafbfc;
}
.modal-input-wrap:focus-within {
    border-color: #667eea;
    background: #fff;
    box-shadow: 0 0 0 4px rgba(102,126,234,0.12);
}
.modal-currency {
    font-size: 18px;
    font-weight: 700;
    color: #667eea;
    margin-right: 8px;
}
.modal-input-wrap input {
    flex: 1;
    border: none; outline: none; background: transparent;
    padding: 12px 8px;
    font-size: 18px;
    font-weight: 600;
    font-family: inherit;
    color: #1a202c;
}
.modal-input-wrap input::placeholder { color: #cbd5e0; font-weight: 400; font-size: 14px; }
.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 8px;
}

/* Modal form field styling */
.modal-field {
    margin-bottom: 16px;
}
.modal-field-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #4a5568;
    margin-bottom: 6px;
}
.modal-field-label .required { color: #e53e3e; margin-left: 2px; }
.modal-field-input {
    width: 100%;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 15px;
    font-family: inherit;
    color: #1a202c;
    background: #fafbfc;
    transition: all 0.2s;
    outline: none;
}
.modal-field-input:focus {
    border-color: #667eea;
    background: #fff;
    box-shadow: 0 0 0 4px rgba(102,126,234,0.12);
}
.modal-field-input::placeholder { color: #cbd5e0; }

/* Month selector in modal */
.modal-month-select {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    padding: 4px 0;
}
.modal-month-chip {
    padding: 8px 14px;
    border: 2px solid #e2e8f0;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    color: #4a5568;
    background: #f7fafc;
    cursor: pointer;
    transition: all 0.15s;
}
.modal-month-chip:hover {
    border-color: #667eea;
    color: #667eea;
}
.modal-month-chip.active {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff;
    border-color: transparent;
}

/* Form fields inside modal */
#modalBody .form-row {
    margin-bottom: 14px;
}
#modalBody .form-row label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: #4a5568;
    margin-bottom: 6px;
}
#modalBody .form-row label::after {
    content: attr(data-suffix);
    color: #a0aec0;
    font-weight: 400;
    font-size: 12px;
}
#modalBody .form-input {
    width: 100%;
    border: 2px solid #e2e8f0;
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 15px;
    font-family: inherit;
    color: #1a202c;
    background: #fafbfc;
    transition: all 0.2s ease;
    outline: none;
    box-sizing: border-box;
}
#modalBody .form-input:focus {
    border-color: #667eea;
    background: #fff;
    box-shadow: 0 0 0 4px rgba(102,126,234,0.12);
}
#modalBody .form-input::placeholder { color: #cbd5e0; }
#modalBody select.form-input {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23a0aec0' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
    cursor: pointer;
}

/* Toast */
.toast {
    position: fixed;
    top: 24px; left: 50%; transform: translateX(-50%) translateY(-80px);
    background: #fff;
    color: #2d3748;
    padding: 14px 22px;
    border-radius: 14px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.15);
    font-size: 14px; font-weight: 600;
    z-index: 2000;
    opacity: 0;
    transition: all 0.3s ease;
    border-left: 4px solid #43e97b;
}
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }
.toast-error { border-left-color: #f56565; background: #fff5f5; color: #742a2a; }
.toast-warn { border-left-color: #f6ad55; background: #fffaf0; color: #7c2d12; }

/* Overview cards */
.overview-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 20px;
    margin: -72px 0 32px;
    position: relative;
    z-index: 2;
}
.card {
    background: #fff;
    border-radius: 18px;
    padding: 24px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.12);
}
.card-label { color: #718096; font-size: 14px; margin-bottom: 8px; }
.card-value {
    font-size: 30px;
    font-weight: 700;
    margin-bottom: 8px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.card-base .card-value {
    background: linear-gradient(135deg, #f093fb, #f5576c);
    -webkit-background-clip: text;
    background-clip: text;
}
.card-house .card-value {
    background: linear-gradient(135deg, #4facfe, #00f2fe);
    -webkit-background-clip: text;
    background-clip: text;
}
.card-appliance .card-value {
    background: linear-gradient(135deg, #43e97b, #38f9d7);
    -webkit-background-clip: text;
    background-clip: text;
}
.card-sub { color: #a0aec0; font-size: 13px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.progress-mini {
    display: inline-block;
    width: 80px;
    height: 6px;
    background: #edf2f7;
    border-radius: 3px;
    overflow: hidden;
}
.progress-mini span {
    display: block;
    height: 100%;
    background: linear-gradient(90deg, #f093fb, #f5576c);
    border-radius: 3px;
}

/* Panel */
.panel {
    background: #fff;
    border-radius: 20px;
    padding: 28px;
    margin-bottom: 28px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.06);
}
.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}
.panel-header h2 {
    font-size: 20px;
    color: #2d3748;
    font-weight: 600;
}
.tag {
    background: #fef3c7;
    color: #92400e;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}
.tag-blue { background: #dbeafe; color: #1e40af; }
.tag-green { background: #d1fae5; color: #065f46; }

/* Renovation list */
.renovation-list { display: flex; flex-direction: column; gap: 16px; }
.reno-item {
    padding: 18px 20px;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border-radius: 14px;
    border-left: 4px solid #667eea;
    transition: transform 0.2s;
}
.reno-item:hover { transform: translateX(4px); }
.reno-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    flex-wrap: wrap;
    gap: 8px;
}
.reno-name {
    font-size: 16px;
    font-weight: 600;
    color: #2d3748;
    display: flex;
    align-items: center;
    gap: 8px;
}
.reno-icon { font-size: 14px; }
.reno-ratio {
    background: #667eea;
    color: #fff;
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    margin-left: 4px;
}
.reno-money {
    display: flex;
    align-items: baseline;
    gap: 6px;
}
.reno-money .spent { font-size: 18px; font-weight: 700; color: #667eea; }
.reno-money .budget { font-size: 13px; color: #a0aec0; }
.reno-bar {
    width: 100%;
    height: 8px;
    background: #e2e8f0;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 6px;
}
.reno-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea, #764ba2);
    border-radius: 4px;
    transition: width 0.8s ease;
}
.reno-foot { font-size: 12px; color: #718096; }

/* Chart grid */
.chart-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 28px;
    margin-bottom: 28px;
}
@media (max-width: 860px) {
    .chart-grid { grid-template-columns: 1fr; }
}
.chart { width: 100%; height: 340px; }
.chart-large { height: 360px; }

/* House summary */
.house-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px dashed #e2e8f0;
}
.hs-item {
    padding: 16px;
    background: #f8fafc;
    border-radius: 12px;
    text-align: center;
}
.hs-item.highlight {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: #fff;
}
.hs-item.highlight .hs-label,
.hs-item.highlight .hs-value { color: #fff; }
.hs-label { display: block; font-size: 13px; color: #718096; margin-bottom: 6px; }
.hs-value { font-size: 20px; font-weight: 700; color: #2d3748; }

/* Room tabs */
.room-charts { margin-bottom: 20px; }
#roomChart { height: 300px; }
.room-stats {
    display: flex;
    gap: 16px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}
.room-stat-card {
    flex: 1;
    min-width: 160px;
    background: linear-gradient(135deg, #f6f9fc 0%, #eef2f7 100%);
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 14px 18px;
    display: flex;
    align-items: center;
    gap: 12px;
}
.room-stat-card .stat-icon {
    width: 42px;
    height: 42px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}
.room-stat-card .stat-icon.icon-money {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff;
}
.room-stat-card .stat-icon.icon-count {
    background: linear-gradient(135deg, #43e97b, #38f9d7);
    color: #fff;
}
.room-stat-card .stat-icon.icon-est {
    background: linear-gradient(135deg, #fa709a, #fee140);
    color: #fff;
}
.room-stat-card .stat-body .stat-label {
    font-size: 12px;
    color: #718096;
    margin-bottom: 4px;
}
.room-stat-card .stat-body .stat-value {
    font-size: 20px;
    font-weight: 700;
    color: #2d3748;
    line-height: 1.2;
}
.room-stat-card .stat-body .stat-value .unit {
    font-size: 13px;
    font-weight: 500;
    color: #a0aec0;
    margin-left: 2px;
}
.room-stat-card .stat-body .stat-sub {
    font-size: 12px;
    color: #718096;
    margin-top: 3px;
}
.room-stat-card .stat-body .stat-sub .progress-bar {
    display: inline-block;
    width: 60px;
    height: 6px;
    background: #e2e8f0;
    border-radius: 3px;
    overflow: hidden;
    margin-right: 6px;
    vertical-align: middle;
}
.room-stat-card .stat-body .stat-sub .progress-bar .fill {
    height: 100%;
    background: linear-gradient(90deg, #667eea, #764ba2);
    border-radius: 3px;
    transition: width 0.3s;
}

.room-tabs {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}
.room-tab {
    padding: 8px 18px;
    border: 2px solid #e2e8f0;
    background: #fff;
    color: #4a5568;
    border-radius: 20px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}
.room-tab:hover { border-color: #667eea; color: #667eea; }
.room-tab.active {
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-color: transparent;
    color: #fff;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.35);
}
.room-details { overflow-x: auto; }

/* Table */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}
.data-table th, .data-table td {
    padding: 14px 16px;
    text-align: left;
    border-bottom: 1px solid #edf2f7;
}
.data-table th {
    background: #f7fafc;
    color: #4a5568;
    font-weight: 600;
}
.data-table tbody tr:hover { background: #f8fafc; }
.data-table tfoot th {
    background: #edf2f7;
    color: #2d3748;
}

.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}
.badge-done { background: #d1fae5; color: #065f46; }
.badge-pending { background: #fef3c7; color: #92400e; }

/* Footer */
footer {
    text-align: center;
    padding: 28px 0;
    color: #a0aec0;
    font-size: 13px;
    margin-top: 20px;
}

@media (max-width: 600px) {
    header { padding: 32px 0 48px; border-bottom-left-radius: 24px; border-bottom-right-radius: 24px; }
    header h1 { font-size: 26px; }
    .card-value { font-size: 24px; }
    .panel { padding: 20px; border-radius: 16px; }
    .overview-cards { gap: 14px; }
    .chart { height: 280px; }
    .chart-large { height: 300px; }
}

/* ============ 采购待办清单（紧凑列表） ============ */
.panel-shopping .shop-section-title {
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    margin: 12px 0 8px;
    padding-left: 6px;
    border-left: 3px solid #667eea;
}
.panel-shopping .shop-section-title.shop-warn {
    border-left-color: #f59e0b;
    color: #92400e;
}
.panel-shopping .shop-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.panel-shopping .shop-row {
    display: grid;
    grid-template-columns: 70px 1fr 70px 80px auto;
    gap: 8px;
    align-items: center;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 13px;
    background: #f9fafb;
    transition: background 0.15s;
}
.panel-shopping .shop-row:hover {
    background: #eef2ff;
}
.panel-shopping .shop-row-warn {
    background: #fffbeb;
}
.panel-shopping .shop-row-warn:hover {
    background: #fef3c7;
}
.panel-shopping .shop-row-room {
    font-size: 11px;
    color: #667eea;
    background: #eef2ff;
    padding: 2px 6px;
    border-radius: 4px;
    font-weight: 500;
    text-align: center;
    white-space: nowrap;
}
.panel-shopping .shop-row-name {
    font-weight: 500;
    color: #1f2937;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.panel-shopping .shop-row-month {
    font-size: 11px;
    color: #6b7280;
    text-align: center;
}
.panel-shopping .shop-row-est {
    font-size: 13px;
    font-weight: 600;
    color: #059669;
    text-align: right;
    font-variant-numeric: tabular-nums;
}
.panel-shopping .shop-row-est-empty {
    color: #d97706;
    font-size: 12px;
}
.panel-shopping .shop-row-actions {
    display: flex;
    gap: 4px;
}
.panel-shopping .btn-outline {
    background: transparent;
    color: #667eea;
    border: 1px solid #667eea;
}
.panel-shopping .btn-outline:hover {
    background: #eef2ff;
}

@media (max-width: 600px) {
    .panel-shopping .shop-row {
        grid-template-columns: 55px 1fr 50px auto;
        font-size: 12px;
    }
    .panel-shopping .shop-row-month {
        display: none;
    }
    .panel-shopping .shop-row-est {
        font-size: 12px;
    }
}
