* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
body {
    font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
    background: #f0f1f5; color: #333; font-size: 14px;
    padding-top: 50px; padding-bottom: 56px;
}
.hidden { display: none !important; }

/* Header */
.header {
    position: fixed; top: 0; left: 0; right: 0; height: 50px;
    background: #4a5568; color: #fff;
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 16px; z-index: 100;
}
.header-title { font-size: 16px; font-weight: 500; flex: 1; text-align: center; }
.header-user { font-size: 12px; opacity: 0.8; }
.header-back {
    width: 44px; height: 44px; display: flex; align-items: center; justify-content: center;
    font-size: 28px; font-weight: 300; cursor: pointer; margin-left: -8px;
}

/* Bottom Nav */
.bottom-nav {
    position: fixed; bottom: 0; left: 0; right: 0; height: 56px;
    background: #fff; border-top: 1px solid #e8e8ec;
    display: flex; z-index: 100;
}
.nav-item {
    flex: 1; display: flex; flex-direction: column; align-items: center;
    justify-content: center; cursor: pointer; position: relative;
    padding: 6px 0; color: #999; font-size: 10px;
}
.nav-item.active { color: #4a5568; }
.nav-icon { font-size: 20px; line-height: 1; margin-bottom: 2px; }
.nav-label { font-size: 11px; }
.nav-badge {
    position: absolute; top: 4px; right: calc(50% - 14px);
    background: #e53935; color: #fff; font-size: 10px;
    min-width: 16px; height: 16px; border-radius: 8px;
    display: flex; align-items: center; justify-content: center; padding: 0 3px;
}

/* Page */
.page { display: none; padding: 0 0 16px; min-height: 100vh; }
.page.active { display: block; }

/* Filter bar */
.filter-bar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 8px 12px; background: #fff; border-bottom: 1px solid #e8e8ec;
    position: sticky; top: 50px; z-index: 50;
}
.filter-tabs { display: flex; gap: 4px; overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 2px; scrollbar-width: none; }
.filter-tabs::-webkit-scrollbar { display: none; }
.ftab {
    padding: 4px 10px; border-radius: 14px; font-size: 12px; cursor: pointer;
    background: #f0f1f5; color: #666; white-space: nowrap; flex-shrink: 0;
}
.ftab.active { background: #4a5568; color: #fff; }
.sort-select {
    font-size: 12px; border: 1px solid #d9d9de; border-radius: 5px;
    padding: 3px 6px; background: #fafafa; color: #555;
}
.sort-btn {
    padding: 3px 9px; border-radius: 12px; font-size: 12px; cursor: pointer;
    background: #f0f1f5; color: #888; border: 1px solid #e0e0e6;
}
.sort-btn.active { background: #4a5568; color: #fff; border-color: #4a5568; }

/* Card */
.card {
    background: #fff; margin: 8px 12px; border-radius: 8px;
    padding: 12px 14px; box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    border: 1px solid #e8e8ec;
}
.card h3 { font-size: 14px; font-weight: 600; color: #4a5568; margin-bottom: 8px; }

/* Project pipeline card */
.proj-card {
    background: #fff; margin: 6px 12px; border-radius: 8px;
    padding: 10px 12px; border: 1px solid #e8e8ec;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04); cursor: pointer;
}
.proj-card:active { background: #f8f8f8; }
.proj-card-top {
    display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px;
}
.proj-name {
    font-size: 14px; font-weight: 600; color: #222;
    flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-right: 8px;
}
.proj-amount { font-size: 14px; font-weight: 700; color: #4a5568; white-space: nowrap; }
.proj-pipeline {
    display: flex; align-items: center; gap: 0;
}
.pip-step {
    display: flex; align-items: center; font-size: 12px;
}
.pip-dot {
    width: 8px; height: 8px; border-radius: 50%; margin-right: 3px; flex-shrink: 0;
}
.pip-dot.done { background: #43a047; }
.pip-dot.pending { background: #d9d9de; }
.pip-label { color: #666; margin-right: 10px; }
.pip-label.done { color: #43a047; }
.pip-label.pending { color: #bbb; }
.proj-meta { font-size: 11px; color: #bbb; margin-top: 5px; }

/* Finance table card */
.fin-card {
    background: #fff; margin: 6px 12px; border-radius: 8px;
    padding: 10px 12px; border: 1px solid #e8e8ec;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04); cursor: pointer;
}
.fin-card:active { background: #f8f8f8; }
.fin-card.loss { border-left: 3px solid #e53935; }
.fin-card.warning { border-left: 3px solid #f9c400; }
.fin-card.normal { border-left: 3px solid #43a047; }
.fin-top {
    display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px;
}
.fin-name {
    font-size: 13px; font-weight: 600; color: #222;
    flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-right: 8px;
}
.fin-profit-rate { font-size: 15px; font-weight: 700; }
.fin-profit-rate.good { color: #43a047; }
.fin-profit-rate.warn { color: #f9c400; }
.fin-profit-rate.bad { color: #e53935; }
.fin-row {
    display: flex; justify-content: space-between; font-size: 12px;
    padding: 2px 0; color: #666;
}
.fin-row .val { font-weight: 500; color: #333; }
.fin-row .val.red { color: #e53935; }

/* Client / Vendor list */
.contact-card {
    background: #fff; margin: 6px 12px; border-radius: 8px;
    padding: 10px 12px; border: 1px solid #e8e8ec;
}
.contact-name { font-size: 14px; font-weight: 600; margin-bottom: 3px; }
.contact-detail { font-size: 12px; color: #888; }

/* Project detail */
.detail-section { margin: 6px 12px; }
.detail-title { font-size: 13px; font-weight: 600; color: #4a5568; margin: 10px 0 4px; padding: 0 2px; }
.kpi-row { display: flex; gap: 6px; margin: 8px 12px; }
.kpi-card {
    flex: 1; background: #fff; border-radius: 8px; padding: 10px 8px;
    text-align: center; box-shadow: 0 1px 2px rgba(0,0,0,0.05); border: 1px solid #e8e8ec;
}
.kpi-value { font-size: 16px; font-weight: 700; }
.kpi-label { font-size: 11px; color: #999; margin-top: 2px; }

/* Misc */
.tag {
    display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 11px; vertical-align: middle;
}
.tag-green { background: #e8f0e8; color: #3b7a3b; }
.tag-orange { background: #f5f0e6; color: #8a6d3b; }
.tag-red { background: #f2e8e8; color: #8a3b3b; }
.tag-blue { background: #e8edf2; color: #3b6e8a; }
.tag-gray { background: #edf0f2; color: #666; }
.tag-purple { background: #f0e8f2; color: #6b3b8a; }
.urgent { border-left: 3px solid #e53935; }

.form-group { margin-bottom: 12px; }
.form-group label { display: block; font-size: 12px; color: #666; margin-bottom: 3px; font-weight: 500; }
.form-group input, .form-group select, .form-group textarea {
    width: 100%; padding: 8px 10px; border: 1px solid #d9d9de; border-radius: 6px;
    font-size: 13px; background: #fafafa; color: #333;
}
.form-group input:focus, .form-group select:focus { outline: none; border-color: #7b8794; background: #fff; }
.form-group textarea { min-height: 50px; resize: vertical; }

.btn { display: block; width: 100%; padding: 10px; border: none; border-radius: 6px; font-size: 14px; cursor: pointer; text-align: center; }
.btn-primary { background: #4a5568; color: #fff; }
.btn-success { background: #43a047; color: #fff; }
.btn-danger { background: #e53935; color: #fff; }
.btn-sm { display: inline-block; width: auto; padding: 5px 12px; font-size: 12px; border: none; border-radius: 5px; cursor: pointer; }
.btn-sm.btn-primary { background: #4a5568; color: #fff; }
.btn-sm.btn-success { background: #43a047; color: #fff; }
.btn-sm.btn-danger { background: #e53935; color: #fff; }

.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { background: #f7f8fa; color: #999; font-weight: 500; font-size: 12px; padding: 6px 10px; text-align: left; border-bottom: 1px solid #e8e8ec; }
.tbl td { padding: 8px 10px; border-bottom: 1px solid #f0f0f0; }
.tbl tr:active { background: #f5f5f5; }

/* 进展节点 */
.pc-pipeline { display: flex; align-items: center; margin-bottom: 8px; }
.pp-node { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.pp-dot { width: 12px; height: 12px; border-radius: 50%; background: #d9d9de; border: 2px solid #d9d9de; }
.pp-dot-on { background: #43a047; border-color: #43a047; }
.pp-lbl { font-size: 11px; color: #bbb; white-space: nowrap; }
.pp-lbl-on { color: #43a047; font-weight: 600; }
.pp-line { flex: 1; height: 2px; background: #e0e0e0; margin: 0 4px; margin-bottom: 14px; }
.pp-line-on { background: #43a047; }

/* 项目列表卡片 */
.pc-row { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; color: #333; margin-bottom: 5px; }
.pc-row:last-child { margin-bottom: 0; }
.pc-item { display: flex; align-items: baseline; gap: 3px; white-space: nowrap; }
.pc-lbl { font-size: 11px; color: #999; }
.pc-name { flex: 1; min-width: 0; white-space: normal; color: #333; }
.proj-card { background: #fff; margin: 6px 12px; border-radius: 8px; padding: 10px 12px; border: 1px solid #e8e8ec; cursor: pointer; }
.proj-card:active { background: #f7f8fa; }

.toast {
    position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
    background: rgba(0,0,0,0.72); color: #fff;
    padding: 10px 18px; border-radius: 6px; font-size: 13px; z-index: 1000;
}

.list-item {
    background: #fff; margin: 6px 12px; padding: 10px 14px;
    border-radius: 8px; box-shadow: 0 1px 2px rgba(0,0,0,0.04); border: 1px solid #e8e8ec;
}
.row-between { display: flex; justify-content: space-between; align-items: center; padding: 3px 0; font-size: 13px; }
.row-between .label { color: #999; }
