/* 引入本地鸿蒙字体 */
@font-face {
    font-family: 'HarmonyOS Sans SC';
    src: url('fonts/HarmonyOS_Sans_SC_Regular.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'HarmonyOS Sans SC';
    src: url('fonts/HarmonyOS_Sans_SC_Medium.woff2') format('woff2');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'HarmonyOS Sans SC';
    src: url('fonts/HarmonyOS_Sans_SC_Bold.woff2') format('woff2');
    font-weight: 600;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'HarmonyOS Sans SC';
    src: url('fonts/HarmonyOS_Sans_SC_Bold.woff2') format('woff2');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

/* 重置与基础设置 */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'HarmonyOS Sans SC', 'Inter', system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: #f4f7f6; /* 清爽浅灰绿色纯色背景 */
    color: #333333;
    line-height: 1.6;
    padding: 2rem;
}

.container {
    max-width: 1600px;
    margin: 0 auto;
}

/* 顶部标题区域 */
.page-header {
    text-align: center;
    margin-bottom: 2rem;
}

.page-header h1 {
    font-size: 2.2rem;
    color: #1a1a1a;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.subtitle {
    color: #666666;
    font-size: 1rem;
}

/* --- 极简密保遮罩层 --- */
.login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(244, 247, 246, 0.85); /* 柔和灰绿半透明 */
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 9999;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.3s ease;
}

.login-box {
    background-color: #ffffff;
    padding: 3rem 2.5rem;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
    text-align: center;
    max-width: 400px;
    width: 90%;
    margin-bottom: 5vh;
}

.login-box h2 {
    color: #2c3e50;
    margin-bottom: 0.5rem;
    font-size: 1.5rem;
}

.login-box p {
    color: #718096;
    font-size: 0.95rem;
    margin-bottom: 2rem;
}

.login-box input {
    width: 100%;
    padding: 1rem;
    border: 1px solid #cbd5e0;
    border-radius: 6px;
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
    text-align: center;
    letter-spacing: 2px;
    font-family: inherit;
    color: #2c3e50;
    background-color: #f8fafc;
}

.login-box input:focus {
    outline: none;
    border-color: #3182ce;
    background-color: #ffffff;
}

.login-box button {
    width: 100%;
    padding: 1rem;
    background-color: #2c3e50;
    color: #ffffff;
    border: none;
    border-radius: 6px;
    font-size: 1.1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
    font-family: inherit;
}

.login-box button:hover {
    background-color: #1a252f;
}

.login-error {
    color: #e53e3e;
    margin-top: 1rem;
    font-size: 0.9rem;
    font-weight: 500;
}

/* --- 看板 Dashboard 区域 --- */
.dashboard-section {
    margin-bottom: 2.5rem;
}

.dash-cards {
    display: grid;
    /* 缩小 minmax 与 gap 以保证宽屏下8张卡片始终在一排 */
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.dash-card {
    background-color: #ffffff;
    border-radius: 8px;
    padding: 1.2rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.dash-title {
    font-size: 0.95rem;
    color: #718096;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.dash-value {
    font-size: 1.8rem;
    font-weight: 700;
    color: #2d3748;
}

.dash-charts {
    display: grid;
    grid-template-columns: 1fr 2fr; /* 饼图小部分，柱状图大部分 */
    gap: 1.5rem;
}

.chart-container {
    background-color: #ffffff;
    border-radius: 8px;
    padding: 1.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    min-height: 300px;
}

/* --- 工具筛选区 --- */
.filter-section {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #ffffff;
    border-radius: 8px;
    padding: 1rem 1.5rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.filter-group {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    flex: 1;
}

.filter-group select,
.filter-group input {
    padding: 0.4rem 1rem;
    border: 1px solid #cbd5e0;
    border-radius: 4px;
    font-size: 0.95rem;
    font-family: inherit;
    background-color: #f8fafc;
    transition: all 0.2s;
    height: 40px;
}

.filter-group select:focus,
.filter-group input:focus {
    outline: none;
    border-color: #2c3e50;
    background-color: #ffffff;
}

.filter-group input {
    flex: 1;
    min-width: 250px; /* 搜索框变大一些 */
}

/* 批量操作动作 */
.batch-actions {
    display: flex;
    gap: 0.8rem;
    align-items: center;
}

.selected-text {
    font-size: 0.95rem;
    color: #2c3e50;
    font-weight: 600;
    background-color: #e2e8f0;
    padding: 0.3rem 0.8rem;
    border-radius: 4px;
}

.btn-batch {
    padding: 0.6rem 1.2rem;
    border: none;
    border-radius: 4px;
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
    color: #fff;
    font-family: inherit;
    height: 40px;
}

.btn-batch-paid {
    background-color: #38a169; /* 绿色系主操作 */
}
.btn-batch-paid:hover { background-color: #2f855a; }

.btn-batch-delete {
    background-color: #e53e3e; /* 红色系告警删除 */
}
.btn-batch-delete:hover { background-color: #c53030; }


/* --- 录入表单区域 --- */
.form-section {
    background-color: #ffffff;
    border-radius: 8px;
    padding: 2rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    margin-bottom: 1.5rem;
}

.section-title {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    color: #2c3e50;
    border-left: 4px solid #2c3e50;
    padding-left: 0.8rem;
}

.record-form {
    display: flex;
    flex-wrap: wrap; /* 允许换行，容纳8个以上的表单项，避免拥挤 */
    gap: 1.5rem;
    align-items: flex-end;
}

.form-group {
    display: flex;
    flex-direction: column;
    flex: 1; /* 默认均撑开 */
    min-width: 11%;
}

.form-group label {
    font-size: 0.9rem;
    font-weight: 500;
    color: #4a5568;
    margin-bottom: 0.5rem;
}

.required {
    color: #e53e3e;
}

.form-group input,
.form-group select {
    padding: 0 1rem;
    border: 1px solid #cbd5e0;
    border-radius: 4px;
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.2s;
    background-color: #f8fafc;
    height: 45px;
    color: #333333;
}

/* 单独给 select 保留右侧空间，防止原生黑箭头挡住文字 */
.form-group select {
    padding-right: 2.5rem;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #2c3e50;
    background-color: #ffffff;
}

.form-actions {
    display: flex;
    align-items: flex-end;
    flex-shrink: 0;
}

.btn-submit {
    padding: 0.8rem 1.5rem;
    background-color: #2c3e50;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s;
    height: 45px;
}

.btn-submit:hover {
    background-color: #1a252f;
}

.btn-cancel {
    padding: 0.8rem 1.5rem;
    background-color: transparent;
    color: #4a5568;
    border: 1px solid #cbd5e0;
    border-radius: 4px;
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    height: 45px;
    margin-left: 0.8rem;
}

.btn-cancel:hover {
    background-color: #f1f5f9;
    color: #1a202c;
}

/* 月份分类归属模块 */
.month-section {
    background-color: #ffffff;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    margin-bottom: 2.5rem;
    overflow: hidden;
    position: relative;
}

.month-title {
    background-color: #2c3e50;
    color: #ffffff;
    padding: 1rem 1.5rem;
    font-size: 1.2rem;
    font-weight: 500;
    border-bottom: 1px solid #e1e8ed;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.month-total {
    font-size: 0.95rem;
    font-weight: normal;
    opacity: 0.9;
}

/* 横向滚动包裹器 */
.table-responsive {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch; 
}

/* 动态生成的表格样式 */
.data-table {
    width: 100%;
    min-width: 1080px; /* 拉长了，兼容新的列 */
    border-collapse: collapse;
    text-align: left;
}

.data-table th,
.data-table td {
    padding: 1rem 1.5rem;
    border-bottom: 1px solid #eceff1;
    vertical-align: middle; 
}

.data-table th {
    background-color: #f8fafc;
    color: #4a5568;
    font-weight: 600;
    font-size: 0.95rem;
}

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

.data-table tbody tr:hover {
    background-color: #f1f5f9;
}

.data-table tbody tr:last-child td {
    border-bottom: none;
}

/* 复选框样式稍微加大一点便于选择 */
.row-checkbox {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

/* 状态与次要信息弱化展示 */
.col-remarks {
    color: #718096;
    font-size: 0.9rem;
}

/* 类别小标识 (Badge) */
.badge {
    padding: 0.25rem 0.6rem;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 500;
    display: inline-block;
}
.badge-new { background-color: #e3f2fd; color: #1976d2; }
.badge-renew { background-color: #f3e5f5; color: #7b1fa2; }
.badge-feature { background-color: #e8f5e9; color: #388e3c; }
.badge-default { background-color: #f1f5f9; color: #64748b; }

/* 金额红系纯色标示 */
.col-price {
    font-size: 1.05rem;
    font-weight: 500;
    color: #e53e3e;
}

/* 操作按键：编辑 */
.btn-edit {
    background-color: transparent;
    border: 1px solid #63b3ed;
    color: #3182ce;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    padding: 0.35rem 0.8rem;
    border-radius: 4px;
    font-family: inherit;
    transition: all 0.2s ease;
    margin-right: 0.5rem;
}

.btn-edit:hover {
    background-color: #3182ce;
    color: #ffffff;
    border-color: #3182ce;
}

.btn-edit:active {
    background-color: #2b6cb0;
    border-color: #2b6cb0;
}

/* 操作按键：删除 */
.btn-delete {
    background-color: transparent;
    border: 1px solid #fc8181;
    color: #e53e3e;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    padding: 0.35rem 0.8rem;
    border-radius: 4px;
    font-family: inherit;
    transition: all 0.2s ease;
}

.btn-delete:hover {
    background-color: #e53e3e;
    color: #ffffff;
    border-color: #e53e3e;
}

.btn-delete:active {
    background-color: #c53030;
    border-color: #c53030;
}

/* 状态颜色的高亮指示 */
.text-paid {
    color: #38a169;
    font-weight: 500;
}

.text-unpaid {
    color: #dd6b20;
    font-weight: 600;
}

/* 空状态区块 */
.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: #718096;
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

/* 响应式适配移动设备 */
@media (max-width: 900px) {
    .dash-charts {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    body {
        padding: 1rem;
    }
    
    .record-form {
        flex-direction: column;
        align-items: stretch;
    }
    
    .form-group {
        min-width: 100%;
    }
    
    .form-actions {
        margin-top: 1rem;
        flex-direction: column;
        gap: 0.5rem;
    }

    .btn-submit, .btn-cancel {
        width: 100%;
        margin-left: 0;
    }
    
    .filter-section {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filter-group {
        flex-direction: column;
        flex: 1;
    }
    
    .batch-actions {
        margin-top: 1rem;
        justify-content: space-between;
        flex-wrap: wrap;
    }
    
    .month-title {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
}
