/* 辉科食品 CRM - 手机端样式 v2 (顶部导航) */
:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --success: #16a34a;
    --warning: #ea580c;
    --danger: #dc2626;
    --bg: #f1f5f9;
    --card: #ffffff;
    --text: #1e293b;
    --text-light: #64748b;
    --border: #e2e8f0;
    --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
                 "Microsoft YaHei", sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* ── 顶部栏 ── */
.top-bar {
    background: var(--primary);
    color: #fff;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(37,99,235,.3);
}
.top-bar h1 { font-size: 17px; font-weight: 600; }
.top-bar .right-wrap { display: flex; align-items: center; gap: 6px; }
.top-bar .right-wrap a { color: #fff; text-decoration: none; font-size: 13px; }
.top-bar .user-badge {
    background: rgba(255,255,255,.2);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 12px;
}
.top-bar .notif-icon {
    position: relative;
    width: 36px; height: 36px;
    border-radius: 50%;
    background: rgba(255,255,255,.15);
    display: flex; align-items: center; justify-content: center;
    font-size: 18px;
    cursor: pointer;
}
.top-bar .notif-icon .badge {
    position: absolute;
    top: -2px; right: -2px;
    background: #dc2626;
    color: #fff;
    border-radius: 50%;
    min-width: 18px; height: 18px;
    font-size: 10px;
    font-weight: 700;
    display: none;
    align-items: center; justify-content: center;
    padding: 0 3px;
    box-shadow: 0 1px 4px rgba(220,38,38,.4);
}

/* ── 顶部两排导航标签栏 ── */
.tab-nav {
    background: #fff;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 52px;
    z-index: 99;
    box-shadow: 0 1px 4px rgba(0,0,0,.04);
    padding: 0 8px;
}
.tab-row {
    display: flex;
    gap: 2px;
    padding: 3px 0 2px;
}
.tab-row a {
    flex: 1;
    text-align: center;
    padding: 8px 2px;
    text-decoration: none;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-light);
    border-radius: 8px;
    transition: all .12s;
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}
.tab-row a.active {
    background: var(--primary);
    color: #fff;
    font-weight: 600;
    box-shadow: 0 2px 6px rgba(37,99,235,.25);
}
.tab-row a .tab-icon { font-size: 15px; display: block; margin-bottom: 1px; }
.tab-row a:active { opacity: .8; }

/* ── 内容区 ── */
.container { max-width: 480px; margin: 0 auto; padding: 12px; }

/* ── 卡片 ── */
.card {
    background: var(--card);
    border-radius: 12px;
    box-shadow: var(--shadow);
    margin-bottom: 12px;
    overflow: hidden;
}
.card-header {
    padding: 14px 16px 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-light);
    border-bottom: 1px solid var(--border);
}
.card-body { padding: 14px 16px; }

/* ── 仪表盘统计 ── */
.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    padding: 16px;
}
.stat-card {
    background: var(--card);
    border-radius: 12px;
    box-shadow: var(--shadow);
    padding: 16px;
    text-align: center;
}
.stat-num {
    font-size: 28px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 4px;
}
.stat-label { font-size: 12px; color: var(--text-light); }

/* ── 按钮 ── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: opacity .15s;
    min-height: 44px;
}
.btn:active { opacity: .8; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-outline {
    background: transparent;
    border: 1.5px solid var(--border);
    color: var(--text);
}
.btn-block { width: 100%; }
.btn-sm { padding: 6px 14px; font-size: 13px; min-height: auto; }
.btn-group { display: flex; gap: 8px; flex-wrap: wrap; }

/* ── 表单 ── */
.form-group { margin-bottom: 14px; }
.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-light);
    margin-bottom: 5px;
}
.form-control {
    width: 100%;
    padding: 10px 12px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-size: 15px;
    background: #fff;
    transition: border-color .15s;
    min-height: 44px;
}
.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}
textarea.form-control { min-height: 80px; resize: vertical; }
select.form-control { appearance: auto; }

/* ── 列表 ── */
.list-item {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    text-decoration: none;
    color: var(--text);
}
.list-item:last-child { border-bottom: none; }
.list-item:active { background: #f8fafc; }
.item-main { flex: 1; }
.item-title { font-size: 15px; font-weight: 500; margin-bottom: 2px; }
.item-sub { font-size: 12px; color: var(--text-light); }
.item-right { text-align: right; flex-shrink: 0; margin-left: 8px; }
.item-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 500;
}
.badge-pending { background: #fef3c7; color: #92400e; }
.badge-approved { background: #dcfce7; color: #166534; }
.badge-rejected { background: #fee2e2; color: #991b1b; }
.badge-shipped { background: #dbeafe; color: #1e40af; }
.badge-signed { background: #e0e7ff; color: #3730a3; }
.badge-pass { background: #dcfce7; color: #166534; }
.badge-fail { background: #fee2e2; color: #991b1b; }

/* ── Flash 消息 ── */
.flash {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 12px;
    font-size: 14px;
    font-weight: 500;
}
.flash-success { background: #dcfce7; color: #166534; }
.flash-danger { background: #fee2e2; color: #991b1b; }
.flash-warning { background: #fef3c7; color: #92400e; }

/* ── 详情页 ── */
.detail-row {
    display: flex;
    padding: 8px 0;
    border-bottom: 1px solid #f1f5f9;
}
.detail-label {
    width: 90px;
    flex-shrink: 0;
    font-size: 13px;
    color: var(--text-light);
}
.detail-value { flex: 1; font-size: 14px; }

/* ── 流程进度条 ── */
.progress-steps {
    display: flex;
    padding: 16px;
    gap: 4px;
}
.progress-step {
    flex: 1;
    text-align: center;
    font-size: 11px;
    color: var(--text-light);
    position: relative;
}
.progress-step .dot {
    width: 24px; height: 24px;
    border-radius: 50%;
    background: var(--border);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    margin-bottom: 4px;
    color: #fff;
}
.progress-step.active .dot { background: var(--primary); }
.progress-step.done .dot { background: var(--success); }
.progress-step.fail .dot { background: var(--danger); }

/* ── 登录页 ── */
.login-wrap {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px 24px;
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
}
.login-wrap .app-name {
    font-size: 28px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 4px;
}
.login-wrap .app-sub {
    font-size: 14px;
    color: rgba(255,255,255,.7);
    margin-bottom: 32px;
}
.login-card {
    background: #fff;
    border-radius: 16px;
    padding: 24px;
    width: 100%;
    max-width: 380px;
    box-shadow: 0 10px 40px rgba(0,0,0,.15);
}

/* ── 空状态 ── */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-light);
}
.empty-state .icon { font-size: 48px; margin-bottom: 12px; }
.empty-state p { font-size: 14px; }

/* ── 页面标题 ── */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}
.page-header h2 { font-size: 18px; font-weight: 600; }

/* ── 角色标记 ── */
.role-tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 500;
}
.role-admin { background: #e0e7ff; color: #3730a3; }
.role-sales { background: #dbeafe; color: #1e40af; }
.role-market { background: #fef3c7; color: #92400e; }
.role-warehouse { background: #dcfce7; color: #166534; }

/* ── 分析标签 ── */
.ana-tabs {
    display: flex;
    gap: 0;
    overflow-x: auto;
    background: #fff;
    border-radius: 10px;
    margin-bottom: 12px;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}
.ana-tabs::-webkit-scrollbar { display: none; }
.ana-tabs a {
    flex-shrink: 0;
    padding: 10px 14px;
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-light);
    border-bottom: 2.5px solid transparent;
}
.ana-tabs a.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

.ana-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.ana-stat { background: var(--card); border-radius: 10px; padding: 14px; text-align: center; box-shadow: var(--shadow); }
.ana-stat .num { font-size: 22px; font-weight: 700; color: var(--primary); }
.ana-stat .label { font-size: 11px; color: var(--text-light); margin-top: 2px; }
.bar-chart { padding: 10px 16px; }
.bar-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.bar-label { width: 70px; flex-shrink: 0; font-size: 12px; color: var(--text); text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { flex: 1; height: 18px; background: #f1f5f9; border-radius: 9px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 9px; transition: width .4s; min-width: 4px; }
.bar-val { font-size: 12px; font-weight: 600; color: var(--text); min-width: 30px; text-align: right; white-space: nowrap; }

.rank-list { list-style: none; }
.rank-list li { display: flex; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border); gap: 8px; }
.rank-list li:last-child { border-bottom: none; }
.rank-num { width: 24px; height: 24px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; flex-shrink: 0; }
.rank-1 { background: #fef3c7; color: #d97706; }
.rank-2 { background: #e2e8f0; color: #475569; }
.rank-3 { background: #fde68a; color: #92400e; }
.rank-n { background: #f1f5f9; color: #94a3b8; }

/* ── 流程总览（列表页顶部） ── */
.flow-overview {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 0 4px;
}
.flow-node {
    flex: 1;
    text-align: center;
    background: #f8fafc;
    border-radius: 8px;
    padding: 6px 2px;
    border: 1.5px solid var(--border);
    max-width: 90px;
}
.flow-node .fn-icon {
    font-size: 18px;
    margin-bottom: 1px;
}
.flow-node .fn-label {
    font-size: 10px;
    font-weight: 600;
    color: var(--text);
    line-height: 1.3;
}
.flow-node .fn-role {
    font-size: 9px;
    color: var(--text-light);
    margin-top: 1px;
}
.flow-arrow {
    font-size: 16px;
    color: var(--text-light);
    flex-shrink: 0;
    padding: 0 2px;
}

/* ── 隐藏敏感信息 ── */
.sensitive-hidden { filter: blur(4px); user-select: none; }
