/* ============================================================
   返利管理系统 v2.0 统一样式
   ============================================================ */
:root {
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --primary-light: #eef2ff;
    --sidebar-w: 248px;
}

* { -webkit-tap-highlight-color: transparent; }

html { scroll-behavior: smooth; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
    -webkit-font-smoothing: antialiased;
}

/* ---------- 滚动条 ---------- */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }
.sidebar-scroll::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); }

/* ---------- 卡片 ---------- */
.card {
    background: #fff;
    border-radius: 1rem;
    border: 1px solid #e2e8f0;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
    transition: box-shadow .25s ease, transform .25s ease;
}
.card-hover:hover {
    box-shadow: 0 12px 32px -12px rgba(15, 23, 42, .16);
    transform: translateY(-2px);
}

/* 统计卡顶部渐变条 */
.stat-card { position: relative; overflow: hidden; }
.stat-card::before {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--sc1, #6366f1), var(--sc2, #a855f7));
}

/* ---------- 按钮 ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .45rem;
    border-radius: .65rem;
    font-size: .875rem;
    font-weight: 500;
    padding: .55rem 1.1rem;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all .2s ease;
    white-space: nowrap;
    line-height: 1.25rem;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary {
    background: linear-gradient(135deg, #4f46e5, #7c3aed);
    color: #fff;
    box-shadow: 0 4px 14px -4px rgba(79, 70, 229, .5);
}
.btn-primary:hover { filter: brightness(1.08); box-shadow: 0 6px 20px -6px rgba(79, 70, 229, .6); }
.btn-ghost { background: #fff; border-color: #e2e8f0; color: #475569; }
.btn-ghost:hover { border-color: #c7d2fe; color: var(--primary); background: var(--primary-light); }
.btn-danger { background: #fee2e2; color: #dc2626; }
.btn-danger:hover { background: #fecaca; }
.btn-danger-solid { background: #dc2626; color: #fff; }
.btn-danger-solid:hover { background: #b91c1c; }
.btn-success { background: #dcfce7; color: #16a34a; }
.btn-success:hover { background: #bbf7d0; }
.btn-sm { padding: .35rem .7rem; font-size: .78rem; border-radius: .5rem; }

/* ---------- 表单 ---------- */
.label { display: block; font-size: .8rem; font-weight: 600; color: #334155; margin-bottom: .4rem; }
.label .req { color: #ef4444; margin-left: 2px; }
.inp, .select {
    width: 100%;
    border: 1px solid #e2e8f0;
    border-radius: .6rem;
    padding: .55rem .8rem;
    font-size: .875rem;
    color: #0f172a;
    background: #fff;
    transition: border-color .2s, box-shadow .2s;
    outline: none;
}
.inp:focus, .select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, .12);
}
.inp::placeholder { color: #94a3b8; }
/* 校验错误态（表单实时校验：JS 给 .inp/.combo 输入框加 .inp-err） */
.inp-err, .inp.inp-err {
    border-color: #f43f5e !important;
    box-shadow: 0 0 0 3px rgba(244, 63, 94, .12) !important;
}
.err-msg { font-size: 11.5px; color: #f43f5e; margin-top: .25rem; line-height: 1.4; }
select.select { appearance: none; 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='%2394a3b8' d='M6 8.8 1.5 4.3l.7-.7L6 7.4l3.8-3.8.7.7z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right .75rem center; padding-right: 2rem; }

/* ---------- 表格 ---------- */
.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .855rem; }
.tbl thead th {
    background: #f8fafc;
    color: #64748b;
    font-weight: 600;
    text-align: left;
    padding: .7rem 1rem;
    white-space: nowrap;
    border-bottom: 1px solid #e2e8f0;
    position: sticky; top: 0; z-index: 5;
}
/* 修正：.tbl thead th(0,1,2) 优先级高于 Tailwind .text-right(0,1,0)，导致表头 text-right 失效、与右对齐数据错位 */
.tbl thead th.text-right { text-align: right; }
.tbl thead th.text-center { text-align: center; }
.tbl tbody td { padding: .75rem 1rem; border-bottom: 1px solid #f1f5f9; color: #334155; vertical-align: middle; }
.tbl tbody tr { transition: background .15s; }
.tbl tbody tr:hover { background: #f8faff; }
/* 列悬停高亮（JS 按列号加 .col-hl）：与行悬停形成十字交叉，交叉点/表头加深 */
.tbl thead th.col-hl { background: #e2e8f0; }
.tbl tbody td.col-hl { background: #f1f5f9; }
.tbl tbody tr:hover td.col-hl { background: #e2e8f0; }
.tbl-wrap { overflow-x: auto; }

/* ---------- 徽章 ---------- */
.badge {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    padding: .18rem .6rem;
    border-radius: 999px;
    font-size: .72rem;
    font-weight: 600;
    line-height: 1.4;
    white-space: nowrap;
}
.badge-dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-indigo { background: #e0e7ff; color: #4338ca; }
.badge-green  { background: #dcfce7; color: #15803d; }
.badge-amber  { background: #fef3c7; color: #b45309; }
.badge-red    { background: #fee2e2; color: #b91c1c; }
.badge-gray   { background: #f1f5f9; color: #64748b; }
.badge-sky    { background: #e0f2fe; color: #0369a1; }
.badge-violet { background: #f3e8ff; color: #7e22ce; }

/* ---------- 侧边栏 ---------- */
.nav-item {
    display: flex;
    align-items: center;
    gap: .8rem;
    padding: .68rem .9rem;
    margin: .15rem .75rem;
    border-radius: .7rem;
    color: #cbd5e1;
    font-size: .9rem;
    transition: all .2s ease;
    position: relative;
}
.nav-item i { width: 1.25rem; text-align: center; font-size: .95rem; }
.nav-item:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-item.active {
    background: linear-gradient(135deg, rgba(99,102,241,.9), rgba(139,92,246,.85));
    color: #fff;
    box-shadow: 0 6px 18px -6px rgba(99,102,241,.6);
}
.nav-item.active::before {
    content: "";
    position: absolute; left: -.75rem; top: 50%;
    transform: translateY(-50%);
    width: 4px; height: 60%;
    border-radius: 0 4px 4px 0;
    background: #a5b4fc;
}

/* ---------- 弹窗 ---------- */
.modal-overlay {
    position: fixed; inset: 0; z-index: 100;
    display: flex; align-items: flex-start; justify-content: center;
    padding: 4vh 1rem;
    background: rgba(15, 23, 42, .55);
    backdrop-filter: blur(4px);
    opacity: 0; pointer-events: none;
    transition: opacity .22s ease;
    overflow-y: auto;
}
.modal-overlay.show { opacity: 1; pointer-events: auto; }
.modal-box {
    background: #fff;
    border-radius: 1.1rem;
    box-shadow: 0 24px 64px -16px rgba(15, 23, 42, .35);
    width: 100%;
    transform: translateY(14px) scale(.98);
    transition: transform .25s cubic-bezier(.34,1.4,.64,1);
}
.modal-overlay.show .modal-box { transform: translateY(0) scale(1); }

/* ---------- Toast ---------- */
#toast-root {
    position: fixed;
    top: 1.1rem; right: 1.1rem;
    z-index: 999;
    display: flex; flex-direction: column; gap: .6rem;
    pointer-events: none;
}
.toast-item {
    display: flex; align-items: center; gap: .6rem;
    min-width: 260px; max-width: 380px;
    padding: .8rem 1rem;
    border-radius: .8rem;
    background: #fff;
    box-shadow: 0 12px 32px -8px rgba(15,23,42,.25);
    font-size: .875rem; color: #334155;
    border-left: 4px solid #6366f1;
    animation: toastIn .3s cubic-bezier(.21,1.02,.73,1);
    pointer-events: auto;
}
.toast-item.out { animation: toastOut .25s ease forwards; }
.toast-success { border-left-color: #22c55e; } .toast-success i { color: #22c55e; }
.toast-error   { border-left-color: #ef4444; } .toast-error i { color: #ef4444; }
.toast-info    { border-left-color: #6366f1; } .toast-info i { color: #6366f1; }
.toast-warn    { border-left-color: #f59e0b; } .toast-warn i { color: #f59e0b; }
@keyframes toastIn { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateX(24px); } }

/* ---------- 确认弹窗动画 ---------- */
@keyframes shake { 0%,100%{transform:translateX(0)} 25%{transform:translateX(-5px)} 75%{transform:translateX(5px)} }
.shake { animation: shake .3s ease; }

/* ---------- 空状态 ---------- */
.empty-state { text-align: center; padding: 3.5rem 1rem; color: #94a3b8; }
.empty-state i { font-size: 2.6rem; margin-bottom: .9rem; color: #cbd5e1; }

/* ---------- 登录页 ---------- */
.login-bg {
    background: linear-gradient(135deg, #1e1b4b 0%, #312e81 45%, #4338ca 100%);
    position: relative;
    overflow: hidden;
}
.orb { position: absolute; border-radius: 50%; filter: blur(70px); opacity: .45; animation: float 9s ease-in-out infinite; }
@keyframes float { 0%,100% { transform: translateY(0) scale(1); } 50% { transform: translateY(-26px) scale(1.06); } }
.grid-pattern {
    position: absolute; inset: 0;
    background-image:
        linear-gradient(rgba(255,255,255,.045) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,.045) 1px, transparent 1px);
    background-size: 44px 44px;
    mask-image: radial-gradient(ellipse at center, black 30%, transparent 75%);
}
.glass-card {
    background: rgba(255,255,255,.94);
    backdrop-filter: blur(18px);
    border: 1px solid rgba(255,255,255,.55);
    box-shadow: 0 32px 80px -20px rgba(0,0,0,.5);
}

/* ---------- 工具 ---------- */
/* 仅渐显不位移：transform 动画 + both 填充会让元素持续成为 fixed 后代的包含块，
   页面滚动时抽屉/遮罩等 fixed 层会跟随文档滚动（滚动越多可见越少） */
.fade-up { animation: fadeUp .45s ease both; }
@keyframes fadeUp { from { opacity: 0; } to { opacity: 1; } }
.text-gradient {
    background: linear-gradient(135deg, #6366f1, #a855f7);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}
.section-title { font-size: 1.05rem; font-weight: 700; color: #0f172a; display: flex; align-items: center; gap: .55rem; }
.section-title i { color: var(--primary); font-size: .95rem; }

/* ---------- 层级选择卡片（政策录入） ---------- */
.lvl-card input { position: absolute; opacity: 0; pointer-events: none; }
.lvl-card span {
    display: flex; flex-direction: column; align-items: center; gap: .2rem;
    padding: .8rem .5rem; border: 1.5px solid #e2e8f0; border-radius: .75rem;
    cursor: pointer; text-align: center; font-size: .85rem; font-weight: 600; color: #475569;
    transition: all .15s ease; background: #fff;
}
.lvl-card span small { font-size: .7rem; font-weight: 400; color: #94a3b8; }
.lvl-card span i { font-size: 1.05rem; color: #94a3b8; transition: color .15s ease; }
.lvl-card input:checked + span {
    border-color: var(--primary); background: #eef2ff; color: #4338ca;
    box-shadow: 0 0 0 3px rgba(99,102,241,.12);
}
.lvl-card input:checked + span i { color: var(--primary); }
.lvl-card input:checked + span small { color: #818cf8; }
.badge-teal { background: #ccfbf1; color: #0f766e; }

/* ---------- Tabs（档案页） ---------- */
.tab-btn {
    padding: .55rem 1.1rem; border-radius: .75rem; font-size: .85rem; font-weight: 600;
    color: #64748b; background: #fff; border: 1.5px solid #e2e8f0; cursor: pointer;
    transition: all .15s ease;
}
.tab-btn:hover { border-color: #c7d2fe; color: #4338ca; }
.tab-btn.tab-active { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 4px 14px -4px rgba(99,102,241,.5); }
.tab-btn.tab-active span { opacity: .8; }

/* ---------- 开关 ---------- */
.switch {
    position: relative; display: inline-block; width: 40px; height: 22px; vertical-align: middle;
    border-radius: 999px; background: #cbd5e1; border: none; cursor: pointer; transition: background .2s ease;
}
.switch:disabled { opacity: .55; cursor: not-allowed; }
.switch-dot {
    position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%;
    background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: left .2s ease;
}
.switch-on { background: #10b981; }
.switch-on .switch-dot { left: 20px; }

/* ---------- 可搜索下拉 combo ---------- */
.combo { position: relative; }
.combo .combo-panel { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 80;
    max-height: 248px; overflow-y: auto; background: #fff; border: 1px solid #e2e8f0;
    border-radius: .65rem; box-shadow: 0 12px 32px rgba(15, 23, 42, .14); display: none; }
.combo .combo-panel.show { display: block; }
.combo .combo-item { padding: .45rem .85rem; font-size: 12.5px; cursor: pointer; line-height: 1.45; color: #334155; }
.combo .combo-item:hover { background: #eef2ff; }
.combo .combo-item.active { color: #4f46e5; font-weight: 600; background: #eef2ff; }
.combo .combo-empty { padding: .9rem; font-size: 12px; color: #94a3b8; text-align: center; }

/* ============================================================
   紧凑主题：整体降密度，单屏信息量更大
   （app.css 在 tailwind.css 之后加载，同级特异性下此处生效）
   ============================================================ */
html { font-size: 14.5px; }   /* rem 基准 16→14.5，所有 rem 间距/标准字号同步收紧 */

/* ---------- 卡片 ---------- */
.card { border-radius: .7rem; }
.card.p-4 { padding: .6rem .75rem; }
.card.p-5 { padding: .8rem .9rem; }
.card .px-5.py-4 { padding: .6rem .9rem; }

/* ---------- 栅格与纵向间距 ---------- */
.gap-4 { gap: .55rem; }
.gap-5 { gap: .7rem; }
.mb-4 { margin-bottom: .55rem; }
.mb-5 { margin-bottom: .7rem; }

/* ---------- 表格 ---------- */
.tbl { font-size: 12.5px; }
.tbl thead th { padding: .42rem .6rem; font-size: 11px; }
.tbl tbody td { padding: .42rem .6rem; }

/* ---------- 表单与按钮 ---------- */
.label { font-size: 11px; margin-bottom: .3rem; }
.inp, .select { padding: .38rem .6rem; font-size: 12.5px; border-radius: .5rem; }
select.select { background-position: right .5rem center; padding-right: 1.6rem; }
.btn { font-size: 12.5px; padding: .4rem .85rem; border-radius: .55rem; line-height: 1.1rem; }
.btn-sm { padding: .28rem .55rem; font-size: 11.5px; }

/* ---------- 标题 ---------- */
.section-title { font-size: 13px; gap: .4rem; }
.section-title i { font-size: 12px; }

/* ---------- 侧边栏 / 顶栏 / 主区 ---------- */
:root { --sidebar-w: 186px; }
.w-\[248px\] { width: 186px; }
.h-\[68px\] { height: 50px; }
aside .w-10.h-10 { width: 36px; height: 36px; } /* 品牌图标随窄栏缩小，防止标题换行 */
aside .h-\[68px\] { gap: .6rem; padding-left: .9rem; padding-right: .9rem; }
main.flex-1 { padding: .75rem .85rem; }
.nav-item { padding: .5rem .75rem; margin: .12rem .6rem; gap: .65rem; font-size: 12.5px; border-radius: .55rem; }
.nav-item i { width: 1.1rem; font-size: .85rem; }

/* ---------- 大数字与图表高度 ---------- */
.text-\[24px\] { font-size: 18px; }
.text-\[22px\] { font-size: 16.5px; }
.h-\[280px\] { height: 225px; }
.h-\[300px\] { height: 240px; }
.h-\[340px\] { height: 285px; }

/* ---------- 驾驶舱投屏模式（会议大屏） ---------- */
/* 只藏侧边栏：不能用 aside 标签选择器——明细抽屉 #drkDrawer 也是 aside，会被误伤导致投屏下明细表整个 display:none */
html.tv-mode #sidebar { display: none; }
html.tv-mode header { display: none; }
html.tv-mode main.flex-1 { zoom: 1.5; padding: 1rem 1.1rem; }
html.tv-mode .text-\[24px\] { font-size: 28px; }
html.tv-mode .section-title { font-size: 15px; }
html.tv-mode .section-title i { font-size: 13.5px; }
#tvExit {
    display: none; position: fixed; top: 14px; right: 16px; z-index: 9999;
    align-items: center; gap: .4rem; padding: .42rem .9rem; border-radius: 999px;
    background: linear-gradient(135deg, #4f46e5, #7c3aed); color: #fff;
    font-size: 12.5px; font-weight: 600; border: none; cursor: pointer;
    box-shadow: 0 8px 20px -6px rgba(79, 70, 229, .6);
}
#tvExit:hover { filter: brightness(1.08); }
#tvExit i { font-size: 11px; }
html.tv-mode #tvExit { display: inline-flex; }
/* 投屏高对比主题：白底黑字加粗，灰阶文字变黑，红绿指标加深保留 */
html.tv-mode body { background: #fff; }
html.tv-mode .card { border: 1px solid #cbd5e1; box-shadow: none; }
html.tv-mode [class*="text-slate-"] { color: #1e293b; }
html.tv-mode .section-title { color: #0f172a; font-weight: 700; }
html.tv-mode .text-\[24px\] { color: #0f172a; font-weight: 800; }
html.tv-mode .tbl { color: #0f172a; }
html.tv-mode .tbl thead th { color: #0f172a; font-weight: 700; background: #f1f5f9; border-bottom: 2px solid #94a3b8; }
html.tv-mode .tbl tbody td { font-weight: 500; }
html.tv-mode .tbl td.text-rose-600 { color: #be123c; font-weight: 600; }
html.tv-mode .tbl td.text-emerald-600 { color: #047857; font-weight: 600; }
html.tv-mode .tbl td.text-amber-600 { color: #b45309; font-weight: 600; }
html.tv-mode .empty-state { color: #475569; }

/* ---------- Tailwind 任意值类补齐 ----------
   JS 模板字符串里的类名不会被 tailwind 预编译扫描，下列全站用到但未定义的类在此手工补齐；
   置于文件末尾，级联顺序保证能覆盖 .select/.inp 的 width:100% */
.h-\[52px\] { height: 52px; }
.left-\[5px\] { left: 5px; }
.text-\[10\.5px\] { font-size: 10.5px; }
.text-\[14px\] { font-size: 14px; }
.text-\[16px\] { font-size: 16px; }
.text-\[18px\] { font-size: 18px; }
.text-\[20px\] { font-size: 20px; }
.text-\[21px\] { font-size: 21px; }
.w-\[92px\] { width: 92px; }
.w-\[100px\] { width: 100px; }
.w-\[120px\] { width: 120px; }
.w-\[130px\] { width: 130px; }
.w-\[140px\] { width: 140px; }
.w-\[45\%\] { width: 45%; }
.w-\[52px\] { width: 52px; }
.w-\[150px\] { width: 150px; }
.w-\[72px\] { width: 72px; }
.w-\[84px\] { width: 84px; }
.w-\[96px\] { width: 96px; }
.min-w-\[130px\] { min-width: 130px; }
.max-w-\[1400px\] { max-width: 1400px; }
.w-\[160px\] { width: 160px; }
.w-\[170px\] { width: 170px; }
.w-\[180px\] { width: 180px; }
.w-\[200px\] { width: 200px; }
.w-\[220px\] { width: 220px; }
.w-\[240px\] { width: 240px; }
.w-\[260px\] { width: 260px; }
.w-\[280px\] { width: 280px; }
