/* ============================================================
 *  财务总台账（应收 / 实收 / 应付 / 实付 / 营收）
 *  独立样式，前缀 lg-，不影响其它页面
 * ============================================================ */

:root {
    --lg-blue: #3b82f6;
    --lg-green: #10b981;
    --lg-amber: #f59e0b;
    --lg-rose: #f43f5e;
    --lg-violet: #8b5cf6;
    --lg-ink: #0f172a;
    --lg-muted: #8a94a6;
    --lg-line: #eef1f6;
    --lg-shadow: 0 6px 22px rgba(17, 34, 68, .07);
}

.lg-page {
    animation: lgFade .38s ease both;
}

@keyframes lgFade {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: none; }
}

@keyframes lgRise {
    from { opacity: 0; transform: translateY(14px); }
    to { opacity: 1; transform: none; }
}

/* ---------------- 顶部横幅 ---------------- */

.lg-hero {
    position: relative;
    display: flex;
    align-items: stretch;
    justify-content: space-between;
    gap: 18px;
    padding: 22px 26px;
    border-radius: 16px;
    overflow: hidden;
    color: #eaf1ff;
    background:
        radial-gradient(880px 320px at 88% -30%, rgba(139, 92, 246, .55), transparent 62%),
        radial-gradient(620px 280px at 8% 120%, rgba(56, 189, 248, .34), transparent 60%),
        linear-gradient(118deg, #101a33 0%, #1b2c52 46%, #2c2452 100%);
    box-shadow: 0 14px 34px rgba(16, 26, 51, .26);
    margin-bottom: 14px;
}

.lg-hero::after {
    content: '';
    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: 34px 34px;
    mask-image: linear-gradient(100deg, rgba(0, 0, 0, .6), transparent 72%);
    pointer-events: none;
}

.lg-hero-main { position: relative; z-index: 1; min-width: 0; }

.lg-hero-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    font-size: 11.5px;
    letter-spacing: .18em;
    text-transform: uppercase;
    color: #9db4e0;
}

.lg-hero-eyebrow b {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #38bdf8;
    box-shadow: 0 0 0 4px rgba(56, 189, 248, .18);
}

.lg-hero h1 {
    margin: 9px 0 6px;
    font-size: 27px;
    font-weight: 800;
    letter-spacing: .02em;
    color: #fff;
}

.lg-hero h1 em {
    font-style: normal;
    background: linear-gradient(92deg, #7dd3fc, #c4b5fd 58%, #fbcfe8);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.lg-hero p {
    margin: 0;
    font-size: 12.5px;
    color: #a8bcdd;
    line-height: 1.7;
}

.lg-hero-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 13px;
}

.lg-hero-tags span {
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11.5px;
    color: #cfe0ff;
    border: 1px solid rgba(157, 180, 224, .28);
    background: rgba(255, 255, 255, .06);
}

.lg-hero-side {
    position: relative;
    z-index: 1;
    flex-shrink: 0;
    min-width: 236px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    padding: 14px 20px;
    border-radius: 13px;
    background: rgba(255, 255, 255, .07);
    border: 1px solid rgba(255, 255, 255, .13);
    backdrop-filter: blur(6px);
}

.lg-hero-side .lg-hs-label {
    font-size: 12px;
    color: #a8bcdd;
    letter-spacing: .04em;
}

.lg-hero-side .lg-hs-value {
    font-size: 30px;
    font-weight: 800;
    line-height: 1.15;
    color: #fff;
    font-variant-numeric: tabular-nums;
}

.lg-hero-side .lg-hs-value.neg { color: #fda4af; }
.lg-hero-side .lg-hs-value.pos { color: #6ee7b7; }

.lg-hero-side .lg-hs-sub {
    font-size: 11.5px;
    color: #9db4e0;
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.lg-hero-side .lg-hs-sub b { color: #dbeafe; font-weight: 600; }

.lg-hero-side .lg-hs-spark {
    margin-top: 6px;
    height: 34px;
    width: 100%;
}

/* ---------------- 指标卡 ---------------- */

.lg-cards {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 14px;
}

@media (max-width: 1500px) {
    .lg-cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 1080px) {
    .lg-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.lg-card {
    position: relative;
    padding: 15px 16px 13px;
    border-radius: 14px;
    background: #fff;
    border: 1px solid var(--lg-line);
    box-shadow: var(--lg-shadow);
    cursor: pointer;
    overflow: hidden;
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
    animation: lgRise .42s ease both;
}

.lg-card:nth-child(2) { animation-delay: .04s; }
.lg-card:nth-child(3) { animation-delay: .08s; }
.lg-card:nth-child(4) { animation-delay: .12s; }
.lg-card:nth-child(5) { animation-delay: .16s; }

.lg-card::before {
    content: '';
    position: absolute;
    inset: 0 0 auto 0;
    height: 3px;
    background: var(--lg-accent, var(--lg-blue));
    opacity: .9;
}

.lg-card::after {
    content: '';
    position: absolute;
    right: -34px;
    top: -42px;
    width: 118px;
    height: 118px;
    border-radius: 50%;
    background: var(--lg-accent, var(--lg-blue));
    opacity: .07;
    transition: opacity .18s ease, transform .18s ease;
}

.lg-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 14px 30px rgba(17, 34, 68, .13);
}

.lg-card:hover::after { opacity: .14; transform: scale(1.08); }

.lg-card.active {
    border-color: var(--lg-accent, var(--lg-blue));
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--lg-accent, #3b82f6) 16%, transparent), 0 14px 30px rgba(17, 34, 68, .12);
}

.lg-card.active::before { height: 4px; }

.lg-card-top {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
}

.lg-ico {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 9px;
    font-size: 14px;
    background: #f1f5fb;
    background: color-mix(in srgb, var(--lg-accent, #3b82f6) 12%, #fff);
    color: var(--lg-accent, #3b82f6);
    flex-shrink: 0;
}

.lg-card-title {
    font-size: 13px;
    font-weight: 600;
    color: #4b5563;
    letter-spacing: .02em;
}

.lg-card-badge {
    margin-left: auto;
    font-size: 11px;
    color: var(--lg-muted);
    white-space: nowrap;
}

.lg-card-value {
    font-size: 25px;
    font-weight: 800;
    color: var(--lg-ink);
    letter-spacing: -.01em;
    line-height: 1.2;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.lg-card-value small {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--lg-muted);
    margin-left: 4px;
}

.lg-card-foot {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    margin-top: 9px;
    font-size: 11.5px;
    color: var(--lg-muted);
    white-space: nowrap;
}

.lg-card-foot b { color: #4b5563; font-weight: 700; font-variant-numeric: tabular-nums; }
.lg-card-foot .pos { color: var(--lg-green); }
.lg-card-foot .neg { color: var(--lg-rose); }
.lg-card-foot .warn { color: #b45309; }

.lg-bar {
    position: relative;
    height: 5px;
    margin-top: 8px;
    border-radius: 999px;
    background: #f0f2f7;
    overflow: hidden;
}

.lg-bar i {
    display: block;
    height: 100%;
    border-radius: 999px;
    background: var(--lg-accent, #3b82f6);
    background: linear-gradient(90deg, color-mix(in srgb, var(--lg-accent, #3b82f6) 55%, #fff), var(--lg-accent, #3b82f6));
    transition: width .7s cubic-bezier(.2, .7, .3, 1);
}

.lg-card.receivable { --lg-accent: var(--lg-blue); }
.lg-card.received { --lg-accent: var(--lg-green); }
.lg-card.payable { --lg-accent: var(--lg-amber); }
.lg-card.paid { --lg-accent: var(--lg-rose); }
.lg-card.revenue { --lg-accent: var(--lg-violet); }

.lg-card.revenue .lg-card-value { color: #6d28d9; }

/* ---------------- 图表区 ---------------- */

.lg-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.72fr) minmax(300px, .78fr);
    gap: 12px;
    margin-bottom: 14px;
}

@media (max-width: 1180px) {
    .lg-grid { grid-template-columns: minmax(0, 1fr); }
}

.lg-panel {
    background: #fff;
    border: 1px solid var(--lg-line);
    border-radius: 14px;
    box-shadow: var(--lg-shadow);
    padding: 14px 16px 12px;
    min-width: 0;
}

.lg-panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.lg-panel-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 700;
    color: #1f2937;
}

.lg-panel-title i {
    width: 4px;
    height: 14px;
    border-radius: 2px;
    background: linear-gradient(180deg, #6366f1, #a855f7);
    display: inline-block;
}

.lg-legend {
    display: flex;
    gap: 14px;
    font-size: 11.5px;
    color: var(--lg-muted);
    flex-wrap: wrap;
}

.lg-legend span { display: inline-flex; align-items: center; gap: 5px; }
.lg-legend em { width: 8px; height: 8px; border-radius: 3px; display: inline-block; font-style: normal; }

.lg-chart-svg { width: 100%; height: auto; display: block; overflow: visible; }

.lg-chart-empty {
    padding: 34px 0;
    text-align: center;
    color: var(--lg-muted);
    font-size: 12.5px;
}

/* 费用构成 */
.lg-mix-total {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    margin-bottom: 4px;
}

.lg-mix-total b {
    font-size: 23px;
    font-weight: 800;
    color: var(--lg-ink);
    font-variant-numeric: tabular-nums;
}

.lg-mix-total span { font-size: 11.5px; color: var(--lg-muted); padding-bottom: 3px; }

.lg-mix-list { margin-top: 10px; display: flex; flex-direction: column; gap: 11px; }

.lg-mix-item .lg-mix-top {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: #4b5563;
    margin-bottom: 5px;
}

.lg-mix-item .lg-mix-top b { font-variant-numeric: tabular-nums; color: #1f2937; }

.lg-mix-item .lg-bar { margin-top: 0; height: 6px; }

.lg-mix-empty { color: var(--lg-muted); font-size: 12.5px; padding: 18px 0; text-align: center; }

.lg-mini-note {
    margin-top: 10px;
    padding-top: 9px;
    border-top: 1px dashed #edf0f6;
    font-size: 11.5px;
    color: var(--lg-muted);
    line-height: 1.7;
}

/* ---------------- 明细区 ---------------- */

.lg-detail {
    background: #fff;
    border: 1px solid var(--lg-line);
    border-radius: 14px;
    box-shadow: var(--lg-shadow);
    padding: 0;
    overflow: hidden;
    scroll-margin-top: 12px;
}

.lg-detail-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    padding: 12px 16px;
    border-bottom: 1px solid var(--lg-line);
    background: linear-gradient(180deg, #fbfcfe, #fff);
}

.lg-tabs { display: flex; gap: 6px; flex-wrap: wrap; }

.lg-tab {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 30px;
    padding: 0 13px;
    border-radius: 999px;
    border: 1px solid #e7ebf3;
    background: #fff;
    color: #5b6472;
    font-size: 12.5px;
    cursor: pointer;
    transition: all .16s ease;
}

.lg-tab:hover { border-color: #c7d2fe; color: #4f46e5; background: #f7f8ff; }

.lg-tab.active {
    border-color: transparent;
    color: #fff;
    background: linear-gradient(120deg, #4f46e5, #7c3aed);
    box-shadow: 0 6px 14px rgba(79, 70, 229, .24);
}

.lg-detail-total {
    display: flex;
    align-items: baseline;
    gap: 10px;
    font-size: 12px;
    color: var(--lg-muted);
    white-space: nowrap;
}

.lg-detail-total b {
    font-size: 19px;
    font-weight: 800;
    color: #111827;
    font-variant-numeric: tabular-nums;
}

.lg-detail-body { padding: 4px 16px 14px; }

.lg-tip {
    margin: 8px 0 10px;
    padding: 8px 12px;
    border-radius: 9px;
    background: #f7f8ff;
    border: 1px solid #e8eaff;
    color: #5b5f7a;
    font-size: 12px;
    line-height: 1.7;
}

.lg-tip b { color: #4f46e5; }

/* 明细表 */
.lg-table-wrap { overflow-x: auto; }

table.lg-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 12.5px;
    color: #3f4756;
}

table.lg-table thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: #f8fafc;
    color: #7c8595;
    font-weight: 600;
    font-size: 11.5px;
    letter-spacing: .03em;
    text-align: left;
    padding: 9px 10px;
    border-bottom: 1px solid var(--lg-line);
    white-space: nowrap;
}

table.lg-table thead th:first-child { border-top-left-radius: 9px; }
table.lg-table thead th:last-child { border-top-right-radius: 9px; }

table.lg-table tbody td {
    padding: 9px 10px;
    border-bottom: 1px solid #f4f6fa;
    vertical-align: middle;
    white-space: nowrap;
}

table.lg-table tbody tr { transition: background .14s ease; }
table.lg-table tbody tr:hover { background: #fafbff; }
table.lg-table tbody tr.clickable { cursor: pointer; }

table.lg-table tbody tr:last-child td { border-bottom: 0; }

.lg-num { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.lg-num.big { font-size: 13px; color: #111827; }
.lg-num.income { color: #059669; }
.lg-num.expense { color: #e11d48; }
.lg-num.warn { color: #b45309; }

.lg-link {
    color: #4f46e5;
    font-weight: 600;
    cursor: pointer;
    border-bottom: 1px dashed rgba(79, 70, 229, .35);
}

.lg-link:hover { color: #7c3aed; border-bottom-style: solid; }

.lg-sub { color: var(--lg-muted); font-size: 11.5px; }

.lg-chip {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 999px;
    font-size: 11px;
    line-height: 17px;
    border: 1px solid #e5e9f2;
    background: #f7f9fc;
    color: #5b6472;
    white-space: nowrap;
}

.lg-chip.ok { color: #047857; border-color: #bbf7d0; background: #ecfdf5; }
.lg-chip.warn { color: #b45309; border-color: #fde68a; background: #fffbeb; }
.lg-chip.bad { color: #be123c; border-color: #fecdd3; background: #fff1f2; }
.lg-chip.info { color: #1d4ed8; border-color: #bfdbfe; background: #eff6ff; }
.lg-chip.violet { color: #6d28d9; border-color: #ddd6fe; background: #f5f3ff; }

/* 表格内迷你进度 */
.lg-cellbar {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 108px;
}

.lg-cellbar .lg-bar { flex: 1; margin: 0; height: 5px; }
.lg-cellbar span { font-size: 11px; color: var(--lg-muted); width: 34px; text-align: right; }

.lg-empty {
    padding: 42px 0;
    text-align: center;
    color: var(--lg-muted);
    font-size: 13px;
}

.lg-empty .lg-empty-ico { font-size: 26px; display: block; margin-bottom: 8px; opacity: .65; }

.lg-more {
    padding: 9px 10px 2px;
    font-size: 11.5px;
    color: var(--lg-muted);
    text-align: right;
}

/* ---------------- 项目弹窗 ---------------- */

.lg-proj-top {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 12px;
}

.lg-proj-kpi {
    padding: 10px 12px;
    border-radius: 11px;
    background: #f8fafc;
    border: 1px solid #eef1f7;
}

.lg-proj-kpi span { display: block; font-size: 11.5px; color: var(--lg-muted); }
.lg-proj-kpi b {
    display: block;
    margin-top: 3px;
    font-size: 18px;
    font-weight: 800;
    color: #111827;
    font-variant-numeric: tabular-nums;
}

.lg-proj-kpi.good b { color: #047857; }
.lg-proj-kpi.bad b { color: #be123c; }

.lg-proj-sec { margin-top: 14px; }

.lg-proj-sec h4 {
    margin: 0 0 7px;
    font-size: 13px;
    color: #374151;
    display: flex;
    align-items: center;
    gap: 7px;
}

.lg-proj-sec h4 em {
    font-style: normal;
    font-size: 11px;
    color: var(--lg-muted);
    font-weight: 400;
}

.lg-proj-sec table.lg-table thead th { background: #f8fafc; }
.lg-proj-sec .lg-table-wrap { border: 1px solid var(--lg-line); border-radius: 10px; }

/* 打印/窄屏兼容 */
@media (max-width: 760px) {
    .lg-hero { flex-direction: column; }
    .lg-hero-side { width: 100%; }
    .lg-cards { grid-template-columns: 1fr; }
    .lg-proj-top { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
