/* ===== 基础重置 ===== */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { font-size: 16px; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    background: #f0f2f5;
    color: #1a1a2e;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}
a { text-decoration: none; color: inherit; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, select, textarea { font-family: inherit; font-size: 1rem; }

/* ===== 应用容器 ===== */
.app {
    max-width: 640px;
    margin: 0 auto;
    min-height: 100vh;
    background: #f0f2f5;
    position: relative;
    padding-bottom: 70px;
}

/* ===== 顶部标题栏 ===== */
.app-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: linear-gradient(135deg, #1a73e8 0%, #1557b0 100%);
    color: #fff;
    padding: 14px 20px;
    box-shadow: 0 2px 8px rgba(26,115,232,0.3);
}
.header-title {
    font-size: 1.2rem;
    font-weight: 600;
    text-align: center;
}

/* ===== 主内容区 ===== */
.app-content {
    padding: 16px;
}

/* ===== 底部导航 ===== */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 640px;
    background: #fff;
    display: flex;
    justify-content: space-around;
    padding: 8px 0 calc(8px + env(safe-area-inset-bottom));
    box-shadow: 0 -2px 10px rgba(0,0,0,0.08);
    z-index: 100;
}
.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    color: #8a8a9a;
    font-size: 0.7rem;
    padding: 4px 12px;
    transition: color 0.2s;
}
.nav-item svg { width: 24px; height: 24px; }
.nav-item.active { color: #1a73e8; }

/* ===== 卡片 ===== */
.card {
    background: #fff;
    border-radius: 14px;
    padding: 18px;
    margin-bottom: 14px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.04);
}
.card-title {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* ===== 统计卡片 ===== */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 14px;
}
.stat-card {
    background: #fff;
    border-radius: 14px;
    padding: 18px 16px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.04);
}
.stat-card .stat-label {
    font-size: 0.8rem;
    color: #8a8a9a;
    margin-bottom: 6px;
}
.stat-card .stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1a73e8;
}
.stat-card.green .stat-value { color: #0d9e6f; }
.stat-card.orange .stat-value { color: #f57c00; }

/* ===== 快捷入口 ===== */
.quick-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
}
.quick-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px 8px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
    transition: transform 0.15s;
}
.quick-item:active { transform: scale(0.95); }
.quick-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
}
.quick-icon.blue { background: #e8f0fe; color: #1a73e8; }
.quick-icon.green { background: #e6f4ea; color: #0d9e6f; }
.quick-icon.orange { background: #fef3e0; color: #f57c00; }
.quick-icon.purple { background: #f3e8fd; color: #7b1fa2; }
.quick-label { font-size: 0.78rem; color: #333; }

/* ===== 表单 ===== */
.form-group {
    margin-bottom: 16px;
}
.form-label {
    display: block;
    font-size: 0.88rem;
    font-weight: 500;
    color: #555;
    margin-bottom: 8px;
}
.form-label .required { color: #e53935; }
.form-input, .form-select, .form-textarea {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #e0e0e8;
    border-radius: 10px;
    font-size: 1rem;
    background: #fafafa;
    transition: border-color 0.2s, background 0.2s;
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
    border-color: #1a73e8;
    background: #fff;
}
.form-select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23888' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    padding-right: 40px;
}
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.form-hint {
    font-size: 0.78rem;
    color: #999;
    margin-top: 4px;
}

/* ===== 按钮 ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 14px 24px;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.15s;
    min-height: 48px;
}
.btn:active { transform: scale(0.97); }
.btn-primary {
    background: linear-gradient(135deg, #1a73e8, #1557b0);
    color: #fff;
    box-shadow: 0 4px 12px rgba(26,115,232,0.35);
}
.btn-success {
    background: linear-gradient(135deg, #0d9e6f, #0a7d58);
    color: #fff;
    box-shadow: 0 4px 12px rgba(13,158,111,0.35);
}
.btn-danger {
    background: #fde8e8;
    color: #e53935;
}
.btn-ghost {
    background: #f0f2f5;
    color: #555;
}
.btn-block { width: 100%; }
.btn-sm {
    padding: 8px 14px;
    font-size: 0.85rem;
    min-height: 36px;
    border-radius: 8px;
}

/* ===== 列表项 ===== */
.list-item {
    display: flex;
    align-items: center;
    padding: 14px 0;
    border-bottom: 1px solid #f0f0f5;
    gap: 12px;
}
.list-item:last-child { border-bottom: none; }
.list-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1a73e8, #1557b0);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 1rem;
    flex-shrink: 0;
}
.list-info { flex: 1; min-width: 0; }
.list-title {
    font-size: 0.95rem;
    font-weight: 500;
    margin-bottom: 2px;
}
.list-sub {
    font-size: 0.78rem;
    color: #999;
}
.list-amount {
    font-size: 1.05rem;
    font-weight: 700;
    color: #1a73e8;
    flex-shrink: 0;
}
.list-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

/* ===== 标签 ===== */
.tag {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 500;
}
.tag-blue { background: #e8f0fe; color: #1a73e8; }
.tag-green { background: #e6f4ea; color: #0d9e6f; }
.tag-orange { background: #fef3e0; color: #f57c00; }
.tag-gray { background: #f0f2f5; color: #888; }
.tag-red { background: #fde8e8; color: #e53935; }

/* ===== 空状态 ===== */
.empty-state {
    text-align: center;
    padding: 50px 20px;
    color: #aaa;
}
.empty-state .empty-icon { font-size: 3rem; margin-bottom: 12px; }
.empty-state p { font-size: 0.9rem; }

/* ===== 金额展示 ===== */
.amount-display {
    background: linear-gradient(135deg, #1a73e8 0%, #1557b0 100%);
    color: #fff;
    border-radius: 14px;
    padding: 24px;
    text-align: center;
    margin-bottom: 14px;
}
.amount-display .amount-label {
    font-size: 0.85rem;
    opacity: 0.85;
    margin-bottom: 6px;
}
.amount-display .amount-value {
    font-size: 2.2rem;
    font-weight: 700;
}
.amount-display .amount-unit {
    font-size: 1rem;
    opacity: 0.8;
}

/* ===== 筛选栏 ===== */
.filter-bar {
    display: flex;
    gap: 10px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}
.filter-bar .form-select, .filter-bar .form-input {
    flex: 1;
    min-width: 100px;
    padding: 10px 12px;
    font-size: 0.88rem;
}

/* ===== 工序选择网格 ===== */
.process-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}
.process-card {
    border: 2px solid #e0e0e8;
    border-radius: 12px;
    padding: 14px;
    cursor: pointer;
    transition: all 0.15s;
    background: #fff;
}
.process-card:active { transform: scale(0.97); }
.process-card.selected {
    border-color: #1a73e8;
    background: #e8f0fe;
}
.process-card .proc-name {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: 4px;
}
.process-card .proc-info {
    font-size: 0.75rem;
    color: #888;
}

/* ===== 产品折叠 ===== */
.product-section {
    margin-bottom: 14px;
}
.product-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: #fff;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.product-header .arrow {
    transition: transform 0.2s;
    color: #999;
}
.product-section.open .product-header .arrow { transform: rotate(90deg); }
.product-body {
    display: none;
    padding: 12px;
    background: #f8f9fb;
    border-radius: 0 0 12px 12px;
    margin-top: -4px;
}
.product-section.open .product-body { display: block; }

/* ===== 弹窗 ===== */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 200;
    align-items: flex-end;
    justify-content: center;
}
.modal-overlay.show { display: flex; }
.modal {
    background: #fff;
    width: 100%;
    max-width: 640px;
    border-radius: 20px 20px 0 0;
    max-height: 85vh;
    overflow-y: auto;
    animation: slideUp 0.25s ease;
}
@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 20px;
    border-bottom: 1px solid #f0f0f5;
    font-weight: 600;
    font-size: 1.05rem;
    position: sticky;
    top: 0;
    background: #fff;
    z-index: 1;
}
.modal-close {
    font-size: 1.5rem;
    color: #999;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}
.modal-body { padding: 20px; }

/* ===== Toast ===== */
.toast {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0,0,0,0.8);
    color: #fff;
    padding: 14px 28px;
    border-radius: 10px;
    font-size: 0.9rem;
    z-index: 300;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s;
}
.toast.show { opacity: 1; }

/* ===== 工资表 ===== */
.salary-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}
.salary-table th {
    background: #f5f7fa;
    padding: 12px 10px;
    text-align: left;
    font-weight: 600;
    color: #555;
    border-bottom: 2px solid #e8e8ef;
}
.salary-table td {
    padding: 12px 10px;
    border-bottom: 1px solid #f0f0f5;
}
.salary-table tr:active { background: #f8f9fb; }
.salary-table .amount-col { text-align: right; font-weight: 600; color: #1a73e8; }
.salary-total-row {
    background: #e8f0fe !important;
    font-weight: 700;
}
.salary-total-row td { border-bottom: none; }

/* ===== 分段控件 ===== */
.segment {
    display: flex;
    background: #f0f2f5;
    border-radius: 10px;
    padding: 4px;
    margin-bottom: 16px;
}
.segment button {
    flex: 1;
    padding: 10px;
    border-radius: 8px;
    font-size: 0.88rem;
    font-weight: 500;
    color: #666;
    transition: all 0.15s;
}
.segment button.active {
    background: #fff;
    color: #1a73e8;
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}

/* ===== 桌面端适配 ===== */
@media (min-width: 768px) {
    .app {
        box-shadow: 0 0 30px rgba(0,0,0,0.08);
    }
    .process-grid { grid-template-columns: repeat(3, 1fr); }
    .quick-grid { grid-template-columns: repeat(4, 1fr); }
}
