/* ========== 全局样式 ========== */
:root {
    --primary: #1989fa;
    --primary-dark: #1677ff;
    --success: #07c160;
    --warning: #ff976a;
    --danger: #ee0a24;
    --info: #969799;
    --bg: #f7f8fa;
    --card-bg: #ffffff;
    --border: #ebedf0;
    --text: #323233;
    --text-secondary: #646566;
    --text-light: #969799;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
                 "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { opacity: 0.85; }

/* ========== 布局 ========== */
/* 手机端隐藏顶部标题栏，仅保留底部Tabbar（2026-08-06）
   PC端(>=768px)由媒体查询覆盖为 display:flex，不受影响 */
.app-header {
    display: none;
    background: var(--primary);
    color: #fff;
    padding: 12px 16px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 1px 4px rgba(0,0,0,0.1);
}

.app-header h1 { font-size: 17px; font-weight: 600; }
.app-header .header-back { color: #fff; font-size: 20px; margin-right: 8px; }

.app-nav {
    display: none;  /* 移动端默认隐藏，用底部Tabbar */
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    overflow-x: auto;
    position: sticky;
    top: 49px;
    z-index: 99;
}

.app-nav a {
    flex: 1;
    text-align: center;
    padding: 10px 4px;
    color: var(--text-secondary);
    font-size: 13px;
    white-space: nowrap;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

.app-nav a.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    font-weight: 600;
}

.nav-icon { font-size: 18px; margin-right: 2px; }

.app-content { padding: 12px 12px 90px 12px; }

.app-tabbar {
    background: var(--card-bg);
    display: flex;
    border-top: 1px solid var(--border);
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    padding-bottom: env(safe-area-inset-bottom, 0);
}

.app-tabbar a {
    flex: 1;
    text-align: center;
    padding: 6px 0 8px;
    color: var(--text-light);
    font-size: 11px;
}

.app-tabbar a.active { color: var(--primary); }

.app-tabbar .tab-icon { font-size: 20px; display: block; margin-bottom: 2px; }

/* ========== 卡片 ========== */
.card {
    background: var(--card-bg);
    border-radius: 8px;
    padding: 14px;
    margin-bottom: 10px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.card-title {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.card-title a { font-size: 13px; font-weight: normal; }

/* ========== 统计卡片 ========== */
.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 12px; }

.stat-card {
    background: var(--card-bg);
    border-radius: 8px;
    padding: 14px;
    text-align: center;
}

.stat-card .stat-value { font-size: 24px; font-weight: 700; color: var(--primary); }
.stat-card .stat-label { font-size: 12px; color: var(--text-light); margin-top: 4px; }

.stat-card.warning .stat-value { color: var(--warning); }
.stat-card.success .stat-value { color: var(--success); }
.stat-card.danger .stat-value { color: var(--danger); }

/* ========== 列表 ========== */
.list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 14px;
    background: var(--card-bg);
    border-bottom: 1px solid var(--border);
    transition: background 0.2s;
}

.list-item:active { background: #f2f3f5; }

.list-item-content { flex: 1; }
.list-item-title { font-size: 14px; font-weight: 500; }
.list-item-subtitle { font-size: 12px; color: var(--text-light); margin-top: 3px; }
.list-item-extra { font-size: 13px; color: var(--text-secondary); margin-left: 8px; }

/* ========== 标签 ========== */
.tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    line-height: 1.5;
}

.tag-primary { background: #e6f4ff; color: var(--primary); }
.tag-success { background: #e6f9ec; color: var(--success); }
.tag-warning { background: #fff3e8; color: var(--warning); }
.tag-danger { background: #ffece8; color: var(--danger); }
.tag-info { background: #f0f1f2; color: var(--info); }
.tag-gray { background: #f7f8fa; color: var(--text-light); }

/* ========== 表单 ========== */
.form-group { margin-bottom: 14px; }
.form-label { display: block; font-size: 13px; color: var(--text-secondary); margin-bottom: 5px; }
.form-label .required { color: var(--danger); }

.form-input, .form-select, .form-textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 14px;
    background: #fff;
    transition: border-color 0.2s;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
    border-color: var(--primary);
    outline: none;
}

.form-textarea { min-height: 80px; resize: vertical; }

.form-row { display: flex; gap: 10px; }
.form-row .form-group { flex: 1; }

/* ========== 按钮 ========== */
.btn {
    display: inline-block;
    padding: 9px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    text-align: center;
    transition: opacity 0.2s;
    background: var(--primary);
    color: #fff;
}

.btn:active { opacity: 0.8; }
.btn-block { display: block; width: 100%; }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-success { background: var(--success); }
.btn-warning { background: var(--warning); }
.btn-danger { background: var(--danger); }
.btn-outline { background: #fff; color: var(--primary); border: 1px solid var(--primary); }
.btn-gray { background: #f0f1f2; color: var(--text-secondary); }

/* ========== 消息提示 ========== */
.flash-message {
    padding: 10px 14px;
    border-radius: 6px;
    margin-bottom: 10px;
    font-size: 13px;
}

.flash-success { background: #e6f9ec; color: var(--success); }
.flash-error { background: #ffece8; color: var(--danger); }
.flash-info { background: #e6f4ff; color: var(--primary); }

/* ========== 空状态 ========== */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-light);
}

.empty-state .empty-icon { font-size: 48px; margin-bottom: 10px; }
.empty-state .empty-text { font-size: 14px; }

/* ========== 详情页 ========== */
.detail-section { margin-bottom: 12px; }
.detail-section-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    padding: 8px 0;
}

.detail-row {
    display: flex;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
}

.detail-label { width: 90px; color: var(--text-light); font-size: 13px; flex-shrink: 0; }
.detail-value { flex: 1; font-size: 13px; }

/* ========== 进度条 ========== */
.progress-bar {
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 3px;
    transition: width 0.3s;
}

/* ========== 审批流程 ========== */
.approval-step {
    display: flex;
    padding: 10px 0;
    position: relative;
}

.approval-step:not(:last-child)::before {
    content: '';
    position: absolute;
    left: 15px;
    top: 36px;
    bottom: -4px;
    width: 2px;
    background: var(--border);
}

.step-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
    margin-right: 12px;
    z-index: 1;
}

.step-icon.pending { background: #f0f1f2; color: var(--info); }
.step-icon.approved { background: #e6f9ec; color: var(--success); }
.step-icon.rejected { background: #ffece8; color: var(--danger); }

.step-content { flex: 1; }
.step-name { font-size: 14px; font-weight: 500; }
.step-info { font-size: 12px; color: var(--text-light); margin-top: 2px; }
.step-comment { font-size: 13px; color: var(--text-secondary); margin-top: 4px; padding: 6px 8px; background: #f7f8fa; border-radius: 4px; }

/* ========== 分页 ========== */
.pagination { display: flex; justify-content: center; align-items: center; gap: 8px; padding: 12px 0; }
.pagination a, .pagination span {
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: 4px;
    font-size: 13px;
    background: #fff;
}
.pagination .active { background: var(--primary); color: #fff; border-color: var(--primary); }
.pagination .disabled { color: var(--text-light); }

/* ========== 搜索栏 ========== */
.search-bar {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.search-bar input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 13px;
}

.search-bar select {
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 13px;
    background: #fff;
}

/* ========== 登录页 ========== */
.login-page {
    background: linear-gradient(135deg, #1989fa 0%, #1677ff 100%);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 30px;
}

.login-logo {
    text-align: center;
    margin-bottom: 30px;
}

.login-logo .logo-icon { font-size: 56px; }
.login-logo h2 { color: #fff; margin-top: 10px; font-size: 20px; }
.login-logo p { color: rgba(255,255,255,0.8); font-size: 13px; margin-top: 4px; }

.login-form {
    background: #fff;
    border-radius: 12px;
    padding: 24px;
}

.login-tips {
    color: rgba(255,255,255,0.7);
    font-size: 12px;
    text-align: center;
    margin-top: 20px;
    line-height: 1.8;
}

/* ========== 工具类 ========== */
.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-gray { color: var(--text-light); }
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-10 { margin-top: 10px; }
.mt-20 { margin-top: 20px; }
.mb-10 { margin-bottom: 10px; }
.flex { display: flex; }
.flex-1 { flex: 1; }
.justify-between { justify-content: space-between; }
.items-center { align-items: center; }
.gap-10 { gap: 10px; }
.font-bold { font-weight: 600; }
.font-lg { font-size: 16px; }
.font-sm { font-size: 12px; }

/* ========== PC端响应式 (屏幕宽度 ≥ 768px) ========== */
@media (min-width: 768px) {
    body {
        background: #f0f2f5;
    }

    /* 整体容器居中，限制最大宽度 */
    .app-header {
        padding: 12px 24px;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        height: 52px;
        display: flex;
        align-items: center;
    }

    .app-header h1 { font-size: 18px; }

    /* 侧边导航替代底部Tabbar */
    .app-nav {
        display: flex;
        position: fixed;
        top: 52px;
        left: 0;
        bottom: 0;
        width: 200px;
        flex-direction: column;
        background: #001529;
        border-bottom: none;
        padding: 12px 0;
        overflow-y: auto;
    }

    .app-nav a {
        color: rgba(255,255,255,0.65);
        padding: 12px 24px;
        text-align: left;
        border-bottom: none;
        font-size: 14px;
        display: flex;
        align-items: center;
        gap: 10px;
        flex: none;
    }

    .app-nav a:hover { color: #fff; background: rgba(255,255,255,0.08); }
    .app-nav a.active { color: #fff; background: #1677ff; border-bottom: none; }

    /* ===== PC侧边导航分组（2026-08-06 精简方案） ===== */
    .app-nav .nav-group { flex: none; }
    .app-nav .nav-group summary {
        display: flex; align-items: center; gap: 10px;
        padding: 12px 24px; color: rgba(255,255,255,0.85);
        font-size: 14px; font-weight: 600; cursor: pointer;
        user-select: none; list-style: none; position: relative;
    }
    .app-nav .nav-group summary::-webkit-details-marker { display: none; }
    .app-nav .nav-group summary:hover { background: rgba(255,255,255,0.06); }
    .app-nav .nav-group summary::after {
        content: "▾"; margin-left: auto; font-size: 12px;
        opacity: 0.55; transition: transform .2s;
    }
    .app-nav .nav-group[open] summary::after { transform: rotate(180deg); }
    .app-nav .nav-group a {
        padding: 10px 24px 10px 34px;
        font-size: 13px; color: rgba(255,255,255,0.6);
        display: flex; align-items: center; gap: 8px; flex: none;
    }
    .app-nav .nav-group a:hover { color: #fff; background: rgba(255,255,255,0.08); }
    .app-nav .nav-group a.active { color: #fff; background: #1677ff; border-bottom: none; }


    /* 主内容区 */
    .app-content {
        margin-left: 200px;
        margin-top: 52px;
        padding: 20px 24px 30px 24px;
        max-width: calc(100% - 200px);
        min-height: calc(100vh - 52px);
    }

    /* 隐藏底部Tabbar */
    .app-tabbar { display: none; }

    /* 卡片优化 */
    .card {
        border-radius: 8px;
        padding: 20px 24px;
        margin-bottom: 16px;
        box-shadow: 0 1px 4px rgba(0,0,0,0.06);
        max-width: 900px;
    }

    /* 统计卡片PC版 */
    .stat-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 16px;
        margin-bottom: 16px;
        max-width: 900px;
    }

    .stat-card {
        padding: 20px 16px;
        border-radius: 8px;
        box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    }

    .stat-card .stat-value { font-size: 28px; }
    .stat-card .stat-label { font-size: 13px; }

    /* 列表项PC版 */
    .list-item {
        padding: 14px 0;
        border-bottom: 1px solid #f0f0f0;
    }

    .list-item:hover { background: #fafafa; }

    /* 表单PC版 */
    .form-input, .form-select, .form-textarea {
        max-width: 500px;
    }

    .form-textarea { min-height: 100px; }

    /* 按钮PC版 */
    .btn { padding: 10px 24px; }
    .btn-block { max-width: 300px; }

    /* 搜索栏PC版 */
    .search-bar { max-width: 900px; }
    .search-bar input { max-width: 300px; }

    /* 详情行PC版 */
    .detail-row { padding: 10px 0; }
    .detail-label { width: 110px; font-size: 14px; }
    .detail-value { font-size: 14px; }

    /* 登录页PC版 */
    .login-page { justify-content: center; align-items: center; }
    .login-form { width: 380px; padding: 32px; }

    /* 审批步骤PC版 */
    .step-icon {
        width: 36px; height: 36px;
        font-size: 16px;
    }

    /* 表格PC版 */
    table { font-size: 14px; }
    table th, table td { padding: 10px 6px; }

    /* 分页 */
    .pagination { max-width: 900px; }

    /* 空状态 */
    .empty-state { padding: 60px 20px; }
    .empty-state .empty-icon { font-size: 56px; }

    /* 用户信息卡 */
    .user-info-sidebar {
        display: block !important;
        position: fixed;
        top: 52px;
        left: 200px;
        right: 0;
        background: #fff;
        padding: 10px 24px;
        border-bottom: 1px solid #f0f0f0;
        font-size: 13px;
        color: #666;
        z-index: 50;
    }
}

/* ========== 大屏优化 (≥1200px) ========== */
@media (min-width: 1200px) {
    .card { max-width: 1000px; }
    .stat-grid { max-width: 1000px; }
    .search-bar { max-width: 1000px; }

    /* 双列布局用于列表页 */
    .pc-two-col {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 16px;
    }

    .pc-two-col .card { max-width: none; }
}
