/* ==========================================================================
   绩效管家 · 共享设计系统（PC / 手机共用）
   引入顺序：bootstrap.min.css → app.css → pc.css 或 mobile.css
   ========================================================================== */

/* ---------- 设计令牌 ---------- */
:root {
    --brand: #4f46e5;
    --brand-600: #4338ca;
    --brand-soft: #eef2ff;
    --brand-grad: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    --bg: #f1f5f9;
    --surface: #ffffff;
    --border: #e2e8f0;
    --text: #0f172a;
    --text-muted: #64748b;
    --radius: 14px;
    --radius-sm: 9px;
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06);
    --shadow: 0 4px 16px -4px rgba(15, 23, 42, .10);
    --ok: #059669;
    --warn: #d97706;
    --bad: #dc2626;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
        "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
}

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- Bootstrap 组件品牌化覆盖 ---------- */
.card {
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    border-radius: var(--radius);
    background: var(--surface);
}

.btn {
    border-radius: var(--radius-sm);
    font-weight: 500;
}
.btn-primary {
    --bs-btn-bg: var(--brand);
    --bs-btn-border-color: var(--brand);
    --bs-btn-hover-bg: var(--brand-600);
    --bs-btn-hover-border-color: var(--brand-600);
    --bs-btn-active-bg: var(--brand-600);
    --bs-btn-active-border-color: var(--brand-600);
    --bs-btn-disabled-bg: var(--brand);
    --bs-btn-disabled-border-color: var(--brand);
}
.btn-outline-primary {
    --bs-btn-color: var(--brand);
    --bs-btn-border-color: var(--brand);
    --bs-btn-hover-bg: var(--brand);
    --bs-btn-hover-border-color: var(--brand);
    --bs-btn-active-bg: var(--brand);
    --bs-btn-active-border-color: var(--brand);
}
.btn-success { --bs-btn-bg: var(--ok); --bs-btn-border-color: var(--ok); --bs-btn-hover-bg: #047857; --bs-btn-hover-border-color: #047857; }
.btn-outline-success { --bs-btn-color: var(--ok); --bs-btn-border-color: var(--ok); --bs-btn-hover-bg: var(--ok); --bs-btn-hover-border-color: var(--ok); --bs-btn-active-bg: var(--ok); }

.form-control:focus, .form-select:focus {
    border-color: #a5b4fc;
    box-shadow: 0 0 0 .2rem rgba(79, 70, 229, .15);
}
.form-label { color: var(--text-muted); font-size: .85rem; margin-bottom: .25rem; }

.badge { border-radius: 999px; font-weight: 600; padding: .35em .7em; }

.alert { border-radius: var(--radius-sm); border: none; }
.alert-success { background: #d1fae5; color: #065f46; }
.alert-danger  { background: #fee2e2; color: #991b1b; }
.alert-warning { background: #fef3c7; color: #92400e; }
.alert-info    { background: #e0f2fe; color: #075985; }

.pagination { --bs-pagination-active-bg: var(--brand); --bs-pagination-active-border-color: var(--brand); --bs-pagination-color: var(--brand); margin-bottom: 0; }
.pagination .page-link { border-radius: var(--radius-sm) !important; margin: 0 2px; border: none; font-weight: 500; }
.pagination .page-item.active .page-link { box-shadow: 0 2px 6px rgba(79, 70, 229, .35); }
.pagination .page-item.disabled .page-link { background: transparent; color: #94a3b8; }

/* ---------- 页头 ---------- */
.page-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    margin-bottom: .75rem;
}
.page-head h4, .page-head h5 { margin: 0; font-weight: 700; }
.page-head .sub { color: var(--text-muted); font-size: .85rem; }

/* ---------- 统计卡 ---------- */
.stat-card {
    border-radius: var(--radius);
    padding: .9rem .5rem !important;
    color: #fff;
    text-align: center;
    border: none;
    position: relative;
    overflow: hidden;
}
.stat-card .num { font-size: 1.35rem; font-weight: 800; letter-spacing: -.5px; line-height: 1.2; }
.stat-card .lbl2 { font-size: .75rem; opacity: .85; }
.stat-card::after {
    content: "";
    position: absolute;
    right: -18px; top: -18px;
    width: 72px; height: 72px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .14);
}
.stat-brand { background: var(--brand-grad); }
.stat-green { background: linear-gradient(135deg, #059669 0%, #10b981 100%); }
.stat-amber { background: linear-gradient(135deg, #d97706 0%, #f59e0b 100%); }
.stat-sky   { background: linear-gradient(135deg, #0284c7 0%, #38bdf8 100%); }
.stat-violet{ background: linear-gradient(135deg, #6d28d9 0%, #a855f7 100%); }
.stat-dim   { background: linear-gradient(135deg, #475569 0%, #64748b 100%); }

/* ---------- 空状态 ---------- */
.empty-state {
    text-align: center;
    padding: 2.5rem 1rem;
    color: var(--text-muted);
}
.empty-state i { font-size: 2.2rem; display: block; margin-bottom: .5rem; opacity: .45; }

/* ---------- 快捷入口（管理员首页） ---------- */
.quick-link {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding: .9rem 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--text);
    box-shadow: var(--shadow-sm);
    transition: transform .12s ease, box-shadow .12s ease;
    height: 100%;
}
.quick-link:hover { transform: translateY(-2px); box-shadow: var(--shadow); color: var(--text); }
.quick-link .ic {
    width: 42px; height: 42px;
    border-radius: 11px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.25rem; color: #fff; flex-shrink: 0;
}
.quick-link .t { font-weight: 600; font-size: .95rem; }
.quick-link .d { color: var(--text-muted); font-size: .78rem; }
.ic-indigo { background: var(--brand-grad); }
.ic-green  { background: linear-gradient(135deg, #059669, #10b981); }
.ic-amber  { background: linear-gradient(135deg, #d97706, #f59e0b); }
.ic-slate  { background: linear-gradient(135deg, #334155, #64748b); }
.ic-sky    { background: linear-gradient(135deg, #0284c7, #38bdf8); }

/* ---------- 按钮（沿用既有类名，统一风格） ---------- */
.btn { min-height: 38px; display: inline-flex; align-items: center; justify-content: center; }
.btn-sm { min-height: 34px; }
.btn-lg-custom {
    padding: .6rem 1rem;
    font-size: 1rem;
    width: 100%;
    border-radius: var(--radius-sm);
    font-weight: 600;
}
.btn-filter { background: var(--brand); color: #fff; }
.btn-filter:hover { background: var(--brand-600); color: #fff; }
.btn-reset { background: #fff; color: var(--text-muted); border: 1px solid var(--border); }
.btn-reset:hover { background: #f8fafc; color: var(--text); }

.action-btn {
    width: 36px; height: 36px;
    display: inline-flex; align-items: center; justify-content: center;
    padding: 0; font-size: 1.05rem;
    border-radius: 9px;
    border: none;
}
.btn-edit       { background: var(--brand-soft); color: var(--brand); }
.btn-reset-pwd  { background: #fef9c3; color: #ca8a04; }
.btn-delete     { background: #fee2e2; color: var(--bad); }
.btn-toggle-on  { background: #d1fae5; color: var(--ok); }
.btn-toggle-off { background: #ffedd5; color: #ea580c; }
.action-btn:hover { transform: scale(1.06); }
.action-btn:disabled { opacity: .35; cursor: not-allowed; transform: none; }

/* ---------- 数据表格（列自动换行约束保留） ---------- */
.table-scroll-container {
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    -webkit-overflow-scrolling: touch;
}
.table-scroll-container table { margin-bottom: 0; width: 100%; }
/* 表格自适应铺满容器，不出现横向滚动条（仅用于不需要横向滚动的页面） */
.table-fit { overflow-x: hidden; max-height: none; }
.table-fit thead th, .table-fit tbody td { white-space: normal; word-break: break-word; overflow-wrap: anywhere; }
.table-scroll-container thead th {
    position: sticky; top: 0; z-index: 10;
    background: #f8fafc;
    color: var(--text-muted);
    font-weight: 600;
    white-space: nowrap;
    box-shadow: inset 0 -1px 0 var(--border);
}
.table-scroll-container tbody td {
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
    vertical-align: middle;
    line-height: 1.4;
}
/* 表格内 form 元素默认 margin 撑高行高，强制清零 */
.table-scroll-container td form { margin: 0; }
.table-scroll-container td .action-btn { vertical-align: middle; }
.table-bordered { --bs-table-border-color: var(--border); }
.table-light { --bs-table-bg: #f8fafc; }

.table-footer { background: #f8fafc; font-weight: 700; box-shadow: inset 0 1px 0 var(--border); }
.col-action { width: 96px; }

/* 表格列宽拖拽手柄 */
.col-resize-handle {
    position: absolute;
    top: 0; right: 0;
    width: 6px; height: 100%;
    cursor: col-resize;
    z-index: 20;
    user-select: none;
}
.col-resize-handle:hover,
.col-resize-handle:active {
    background: rgba(79, 70, 229, 0.35);
}
/* 拖拽时表头文字不被选中 */
.table-scroll-container thead th { user-select: none; }

.employee-list-table { margin-bottom: 0; }
.employee-list-table thead th { font-weight: 600; color: var(--text-muted); white-space: normal; overflow-wrap: anywhere; word-break: break-word; }
.employee-list-table tbody td { white-space: normal; overflow-wrap: anywhere; word-break: break-word; vertical-align: middle; }
.employee-list-table .col-name { width: 150px; }
.employee-list-table .col-username { width: 130px; }
.employee-list-table .col-role { width: 80px; }
.employee-list-table .col-status { width: 70px; text-align: center; }
.employee-list-table .col-actions { width: 180px; text-align: center; }

.export-group { display: flex; flex-wrap: wrap; gap: 8px; }
.export-group .btn { flex: 1 1 auto; min-width: 120px; }

/* ---------- 表单分区 ---------- */
.form-section-title {
    font-size: .8rem;
    font-weight: 700;
    color: var(--brand);
    text-transform: uppercase;
    letter-spacing: .5px;
    margin: 1.1rem 0 .5rem;
    display: flex;
    align-items: center;
    gap: .4rem;
}
.form-section-title::after { content: ""; flex: 1; height: 1px; background: var(--border); }

/* ---------- 登录页 ---------- */
.auth-wrap {
    min-height: calc(100vh - 60px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.5rem 0;
}
.auth-logo {
    width: 72px; height: 72px;
    border-radius: 22px;
    background: var(--brand-grad);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-size: 2rem;
    box-shadow: 0 10px 24px -6px rgba(79, 70, 229, .5);
    margin-bottom: .9rem;
}
.auth-title { font-weight: 800; font-size: 1.35rem; }
.auth-sub { color: var(--text-muted); font-size: .88rem; margin-bottom: 1.2rem; }
.auth-card { width: 100%; max-width: 380px; }
.auth-card .card-body { padding: 1.6rem 1.4rem; }
.input-icon { position: relative; }
.input-icon i {
    position: absolute; left: 12px; top: 50%;
    transform: translateY(-50%);
    color: #94a3b8; font-size: 1rem;
    pointer-events: none;
}
.input-icon .form-control { padding-left: 38px; }

/* ---------- 列表汇总条 ---------- */
.sum-strip {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem 1.2rem;
    justify-content: center;
    background: var(--brand-soft);
    color: var(--brand-600);
    border-radius: var(--radius-sm);
    padding: .5rem .8rem;
    margin-bottom: .7rem;
    font-size: .84rem;
    font-weight: 600;
}
