:root {
    --bg: #f6f5fb;
    --surface: #ffffff;
    --ink: #0f172a;
    --ink-2: #1e293b;
    --muted: #64748b;
    --muted-2: #94a3b8;
    --line: #eef0f6;

    --brand: #6366f1;
    --brand-2: #8b5cf6;
    --brand-3: #a78bfa;
    --brand-dark: #4338ca;

    --mint: #10b981;
    --amber: #f59e0b;
    --rose: #f43f5e;
    --sky: #0ea5e9;
    --pink: #ec4899;

    --r-lg: 22px;
    --r-md: 16px;
    --r-sm: 10px;

    --sh-sm: 0 1px 2px rgba(15,23,42,.04);
    --sh:    0 4px 14px rgba(15,23,42,.06);
    --sh-lg: 0 16px 40px rgba(79,70,229,.15);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { height: 100%; }
body {
    font-family: 'Prompt', sans-serif;
    background: var(--bg);
    color: var(--ink);
    -webkit-font-smoothing: antialiased;
}

.main {
    padding: 28px;
    max-width: 1440px;
    width: 100%;
    margin: 0 auto;
}

/* ===== TOPBAR ===== */
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 22px;
    gap: 16px;
    flex-wrap: wrap;
}
.breadcrumb {
    font-size: 12px; color: var(--muted);
    display: flex; align-items: center; gap: 6px;
}
.breadcrumb b { color: var(--ink); font-weight: 500; }
.page-title {
    font-size: 26px; font-weight: 700; color: var(--ink);
    margin-top: 4px;
}
.page-sub { font-size: 13px; color: var(--muted); margin-top: 2px; }

.topbar-right {
    display: flex; align-items: center; gap: 10px;
}
.icon-btn {
    width: 40px; height: 40px; border-radius: 12px;
    background: #fff; border: 1px solid var(--line);
    color: var(--ink-2); display: grid; place-items: center;
    cursor: pointer; transition: all .2s;
    position: relative;
}
.icon-btn:hover { border-color: var(--brand); color: var(--brand); }
.icon-btn .dot {
    position: absolute; top: 8px; right: 8px;
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--rose); border: 2px solid #fff;
}
.btn-export {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 10px 16px;
    background: linear-gradient(135deg, #6366f1, #8b5cf6);
    color: #fff; border: none; border-radius: 12px;
    font-family: inherit; font-weight: 500; font-size: 13px;
    cursor: pointer; transition: all .2s;
    box-shadow: 0 6px 16px rgba(99,102,241,.35);
}
.btn-export:hover { transform: translateY(-1px); box-shadow: 0 10px 24px rgba(99,102,241,.45); }

/* ===== FILTER CHIPS ===== */
.filters {
    display: flex; flex-wrap: wrap; gap: 10px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 14px;
    margin-bottom: 22px;
    box-shadow: var(--sh-sm);
}
.filter-chip {
    flex: 1 1 160px;
    /* display: flex;  */
    align-items: center; gap: 8px;
    padding: 10px 12px;
    background: var(--bg);
    border-radius: 10px;
    font-size: 12.5px;
    color: var(--ink-2);
    cursor: pointer;
    transition: all .2s;
    border: 1px solid transparent;
}
.filter-chip:hover { border-color: var(--brand-3); background: #fff; }
.filter-chip i { color: var(--brand); font-size: 14px; }
.filter-chip input {
    border: none; background: transparent; outline: none;
    flex: 1; min-width: 0;
    font-family: inherit; font-size: 12.5px;
    color: var(--ink-2);
}
.filter-chip input::placeholder { color: var(--muted-2); }
.filter-apply {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 10px 20px;
    background: var(--ink);
    color: #fff;
    border: none; border-radius: 10px;
    font-family: inherit; font-weight: 500; font-size: 12.5px;
    cursor: pointer; transition: all .2s;
}
.filter-apply:hover { background: #1e293b; }

/* ============================================================
   BENTO GRID — KPI
   ============================================================ */
.bento-kpi {
    display: grid;
    grid-template-columns: 1.3fr 1fr 1fr 1fr;
    gap: 16px;
    margin-bottom: 22px;
}

.kpi-hero {
    background: linear-gradient(135deg, #1e1b4b 0%, #4338ca 55%, #7c3aed 100%);
    color: #fff;
    border-radius: var(--r-lg);
    padding: 24px;
    position: relative;
    overflow: hidden;
    box-shadow: var(--sh-lg);
}
.kpi-hero::before, .kpi-hero::after {
    content:""; position: absolute; border-radius: 50%;
    background: rgba(255,255,255,.06); pointer-events: none;
}
.kpi-hero::before { width: 220px; height: 220px; top: -90px; right: -60px; }
.kpi-hero::after  { width: 150px; height: 150px; bottom: -70px; left: -40px; }

.kpi-hero .kh-label {
    display: inline-flex; align-items: center; gap: 8px;
    background: rgba(255,255,255,.12);
    padding: 5px 12px; border-radius: 999px;
    font-size: 11.5px; color: #e0e7ff;
    backdrop-filter: blur(6px);
    position: relative; z-index: 1;
}
.kpi-hero .kh-value {
    font-size: 62px; font-weight: 700; line-height: 1;
    margin: 16px 0 6px;
    background: linear-gradient(180deg, #fff 40%, #c4b5fd);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    position: relative; z-index: 1;
}
.kpi-hero .kh-value span { font-size: 16px; font-weight: 500; color: #c4b5fd; -webkit-text-fill-color: #c4b5fd; margin-left: 6px; }
.kpi-hero .kh-desc {
    font-size: 12.5px; color: #c7d2fe;
    position: relative; z-index: 1;
}
.kpi-hero .kh-foot {
    margin-top: 18px; display: flex; align-items: center; justify-content: space-between;
    padding-top: 16px; border-top: 1px solid rgba(255,255,255,.15);
    position: relative; z-index: 1;
}
.kpi-hero .kh-trend {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 4px 10px; border-radius: 999px;
    background: rgba(34,197,94,.2); color: #86efac;
    font-size: 11.5px; font-weight: 500;
}

.kpi-card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    padding: 20px;
    position: relative;
    overflow: hidden;
    transition: all .25s;
}
.kpi-card:hover { transform: translateY(-3px); box-shadow: var(--sh); }
.kpi-card::after {
    content:""; position: absolute;
    top: 0; right: 0; width: 120px; height: 120px;
    border-radius: 50%;
    transform: translate(30%, -30%);
    opacity: .6;
}
.kpi-card.blue::after   { background: radial-gradient(circle, rgba(14,165,233,.18), transparent 70%); }
.kpi-card.amber::after  { background: radial-gradient(circle, rgba(245,158,11,.2), transparent 70%); }
.kpi-card.mint::after   { background: radial-gradient(circle, rgba(16,185,129,.2), transparent 70%); }

.kpi-card .kc-icon {
    width: 42px; height: 42px; border-radius: 12px;
    display: grid; place-items: center;
    font-size: 18px; margin-bottom: 14px;
    position: relative; z-index: 1;
}
.kpi-card.blue  .kc-icon { background: rgba(14,165,233,.12); color: var(--sky); }
.kpi-card.amber .kc-icon { background: rgba(245,158,11,.15); color: var(--amber); }
.kpi-card.mint  .kc-icon { background: rgba(16,185,129,.15); color: var(--mint); }

.kpi-card .kc-label { font-size: 12.5px; color: var(--muted); position: relative; z-index: 1; }
.kpi-card .kc-value {
    font-size: 32px; font-weight: 700; color: var(--ink);
    margin-top: 4px; line-height: 1;
    position: relative; z-index: 1;
}
.kpi-card .kc-value span { font-size: 13px; font-weight: 400; color: var(--muted); margin-left: 4px; }

.kpi-card .kc-spark {
    position: absolute; bottom: 12px; right: 12px;
    width: 80px; height: 32px;
    z-index: 1;
}

/* ============================================================
   SECTION HEADERS
   ============================================================ */
.section-head {
    display: flex; align-items: center; justify-content: space-between;
    margin: 12px 0 14px;
    flex-wrap: wrap; gap: 8px;
}
.section-head h2 {
    font-size: 18px; font-weight: 600; color: var(--ink);
    display: flex; align-items: center; gap: 10px;
}
.section-head h2::before {
    content:""; width: 4px; height: 20px; border-radius: 3px;
    background: linear-gradient(180deg, var(--brand), var(--brand-2));
}
.section-head .hint { font-size: 12px; color: var(--muted); }

/* ============================================================
   BENTO GRID — CHARTS
   ============================================================ */
.bento {
    display: grid;
    gap: 18px;
    margin-bottom: 22px;
}
.donut-chart{
    margin-bottom:22px
}
.bento.col-2 { grid-template-columns: 1fr 1fr; }

.panel {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    padding: 22px;
    box-shadow: var(--sh-sm);
    height: 100%;
}
.panel-head {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 16px; gap: 10px;
}
.panel-head .ph-left { display: flex; align-items: center; gap: 12px; }
.panel-head .ph-icon {
    width: 36px; height: 36px; border-radius: 10px;
    display: grid; place-items: center;
    font-size: 16px;
}
.ph-icon.violet { background: rgba(139,92,246,.12); color: var(--brand-2); }
.ph-icon.amber  { background: rgba(245,158,11,.15); color: var(--amber); }
.ph-icon.pink   { background: rgba(236,72,153,.12); color: var(--pink); }
.ph-icon.sky    { background: rgba(14,165,233,.12); color: var(--sky); }

.panel-title { font-size: 15px; font-weight: 600; color: var(--ink); }
.panel-subtitle { font-size: 11.5px; color: var(--muted-2); margin-top: 1px; }
.panel-select {
    height: 32px; padding: 0 28px 0 12px;
    border: 1px solid var(--line); border-radius: 8px;
    font-family: inherit; font-size: 12px; color: var(--ink-2);
    background: #fff url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path fill='%2394a3b8' d='M0 0l5 6 5-6z'/></svg>") no-repeat right 10px center;
    -webkit-appearance: none; appearance: none;
    outline: none;
}

.donut-wrap {
    position: relative;
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 20px;
    align-items: center;
}
.donut-box { position: relative; height: 220px; }
.donut-center {
    position: absolute; inset: 0;
    display: grid; 
    place-items: center;
    text-align: center; 
    pointer-events: none;
}
.donut-center .dc-num { font-size: 30px; font-weight: 700; color: var(--ink); line-height: 1; }
.donut-center .dc-lbl { font-size: 11px; color: var(--muted); margin-top: 4px; }

.legend {
    display: flex; flex-direction: column; gap: 10px;
}
.legend-item {
    display: flex; align-items: center; gap: 10px;
    font-size: 12.5px; color: var(--ink-2);
    padding: 6px 0;
    border-bottom: 1px dashed var(--line);
}
.legend-item:last-child { border-bottom: none; }
.legend-item .sq {
    width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0;
}
.legend-item .lbl { flex: 1; color: var(--muted); color: #828185;}
.legend-item .val { font-weight: 700; color: #828185; font-size: 13px; }
.legend-item .pct {
    font-size: 10.5px; color: var(--muted-2);
    padding: 2px 6px; background: var(--bg); border-radius: 4px;
}

.chart-box { position: relative; height: 260px; }
.chart-box.tall { height: 340px; }

/* ============================================================
   BUDGET SECTION — Ring cards (dark)
   ============================================================ */
.budget-grid {
    display: grid;
    /* grid-template-columns: 1fr 1fr; */
    gap: 18px;
}
.budget-card {
    border-radius: var(--r-lg);
    padding: 24px;
    color: #fff;
    position: relative;
    overflow: hidden;
}
.budget-card.purple {
    background: linear-gradient(135deg, #1e1b4b 0%, #4338ca 50%, #7c3aed 100%);
}
.budget-card.green {
    background: linear-gradient(135deg, #064e3b 0%, #047857 50%, #059669 100%);
}
.budget-card::before {
    content:""; position: absolute;
    width: 260px; height: 260px; border-radius: 50%;
    top: -120px; right: -80px;
    background: radial-gradient(circle, rgba(255,255,255,.14), transparent 60%);
}

.bc-head {
    display: flex; justify-content: space-between; align-items: flex-start;
    margin-bottom: 20px; position: relative; z-index: 1;
}
.bc-title { font-size: 14px; font-weight: 500; max-width: 400px; line-height: 1.4; opacity: .95; }
.bc-tag {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 5px 10px; border-radius: 999px;
    background: rgba(255,255,255,.14);
    font-size: 11px; backdrop-filter: blur(6px);
}

.bc-body {
    display: grid;
    grid-template-columns: 400px 1fr;
    gap: 22px;
    align-items: center;
    position: relative; z-index: 1;
    margin-bottom: 18px;
}
.ring-wrap { position: relative; width: 300px; height: 160px; }
.ring-wrap svg { transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: rgba(255,255,255,.14); stroke-width: 12; }
.ring-fg { fill: none; stroke-width: 12; stroke-linecap: round; }
.ring-fg.purple { stroke: #fca5a5; }
.ring-fg.green  { stroke: #fde68a; }
.ring-center {
    position: absolute; inset: 0;
    display: grid; place-items: center; text-align: center;
}
.ring-center .rc-num {
    font-size: 30px; font-weight: 700; line-height: 1;
}
.budget-card.purple .ring-center .rc-num { color: #fecaca; }
.budget-card.green  .ring-center .rc-num { color: #fde68a; }
.ring-center .rc-unit { font-size: 11px; color: rgba(255,255,255,.75); margin-top: 4px; }

.bc-stat-list { display: flex; flex-direction: column; gap: 10px; }
.bc-stat {
    display: flex;
     justify-content: space-between; 
     align-items: center;
    padding: 10px 14px;
    background: rgba(255,255,255,.08);
    border-radius: 10px;
    backdrop-filter: blur(6px);
    border: 1px solid rgba(255,255,255,.1);
}
.bc-stat .lbl { font-size: 11.5px; color: rgba(255, 255, 255, 0.85); }
.bc-stat .val { font-size: 15px; font-weight: 700; }
.budget-card.purple .bc-stat .val { color: #fecaca; }
.budget-card.green  .bc-stat .val { color: #fde68a; }
.bc-stat .val small { font-size: 11px; font-weight: 500; color: rgba(255,255,255,.75); margin-left: 4px; }

.bc-foot {
    display: grid; grid-template-columns:   1fr 1fr 1fr; gap: 10px;
    position: relative; z-index: 1;    
    margin-top: 10px;

}
.bc-foot .bf-item {
    background: rgba(0,0,0,.25);
    border-radius: 12px;
    padding: 14px;
    text-align: center;
}
.bc-foot .bf-lbl { font-size: 11px; color: rgba(255,255,255,.72); margin-bottom: 4px; }
.bc-foot .bf-val { font-size: 18px; font-weight: 700; }
.budget-card.purple .bf-val { color: #fecaca; }
.budget-card.green  .bf-val { color: #fde68a; }
.bc-foot .bf-val small { font-size: 11px; font-weight: 500; color: rgba(255,255,255,.75); margin-left: 4px; }

.bc-foot-2 {
    grid-template-columns: 1fr 1fr 1fr;
     gap: 10px;
    position: relative; z-index: 1;    
    margin-top: 10px;

}
.bc-foot-2 .bf-item {
    background: rgba(0,0,0,.25);
    border-radius: 12px;
    padding: 10px;
    text-align: center;
}
.bc-foot-2 .bf-lbl { font-size: 11px; color: rgba(255,255,255,.72); margin-bottom: 4px; }
.bc-foot-2 .bf-val { font-size: 18px; font-weight: 700; }
.budget-card.purple .bf-val { color: #fecaca; }
.budget-card.green  .bf-val { color: #fde68a; }
.bc-foot-2 .bf-val small { font-size: 11px; font-weight: 500; color: rgba(255,255,255,.75); margin-left: 4px; }

/* ============================================================
   ANIMATIONS
   ============================================================ */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}
.fade { animation: fadeUp .5s ease both; }
.d1 { animation-delay: .05s; } .d2 { animation-delay: .12s; }
.d3 { animation-delay: .2s; }  .d4 { animation-delay: .28s; }
.d5 { animation-delay: .36s; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1200px) {
    .bento-kpi { grid-template-columns: 1fr 1fr; }
    .bento.col-2 { grid-template-columns: 1fr; }
    .budget-grid { grid-template-columns: 1fr; }
    .donut-wrap { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
    .bc-body { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
    .bento-kpi { grid-template-columns: 1fr; }
    .main { padding: 16px; }
    .page-title { font-size: 22px; }
    .kpi-hero .kh-value { font-size: 48px; }
}
  /* ====================================================================
               Budget Card V4 — Hero-focused readability
               แนวคิด: ตัวเลขรวมเด่นที่สุด → status panel เคียงกัน → progress bar
                        → แยกรายประเภท (มีข้อมูล=ใหญ่ ไม่มีข้อมูล=กระชับ)
               ==================================================================== */
    .budget-grid.v2 {
        display: grid;
        grid-template-columns: 1fr;
        gap: 20px;
    }

    /* Desktop: cards split into 2 columns side-by-side */
    @media (min-width: 1024px) {
        .budget-grid.v2 {
            grid-template-columns: 1fr 1fr;
        }
    }

    .budget-card-v2 {
        position: relative;
        overflow: hidden;
        border-radius: 22px;
        padding: 26px 30px 24px;
        color: #fff;
        box-shadow: 0 18px 40px rgba(15, 23, 42, .18), 0 2px 6px rgba(15, 23, 42, .10);
        border: 1px solid rgba(255, 255, 255, .08);
        /* Container queries: inner layout adapts to card width */
        container-type: inline-size;
        container-name: bcv2card;
    }

    /* Top accent border — adds a colored highlight strip */
    .budget-card-v2::before {
        content: "";
        position: absolute;
        left: 0;
        right: 0;
        top: 0;
        height: 4px;
        z-index: 2;
        pointer-events: none;
        border-top-left-radius: 22px;
        border-top-right-radius: 22px;
    }

    /* ============================================================
               Colored Cards (NO dark base) — สีอิ่มทั้งใบ + อ่านชัดด้วย
               panel overlay ที่บริเวณตัวอักษร
               ============================================================ */

    /* ╔═══ วงเงินงบประมาณ — Refined Gold (สวยงาม นุ่มนวล อ่านง่าย) ═══╗ */
    .budget-card-v2.purple {
        background: linear-gradient(135deg, #dba834 0%, #c2922a 40%, #a37715 70%, #7a5709 100%);
        border: 1px solid rgba(255, 245, 200, .35);
        box-shadow:
            inset 0 1px 0 rgba(255, 245, 200, .55),
            inset 0 -1px 0 rgba(0, 0, 0, .12),
            0 22px 45px rgba(194, 146, 42, .38),
            0 4px 14px rgba(15, 23, 42, .16);
    }

    .budget-card-v2.purple::before {
        background: linear-gradient(90deg, #fef3c7 0%, #fde68a 30%, #fbbf24 60%, #D4AF37 100%);
        height: 5px;
        box-shadow: 0 2px 12px rgba(251, 191, 36, .58);
    }

    .budget-card-v2.purple .bcv2-hero-panel {
        background: rgba(0, 0, 0, .38) !important;
        border-color: rgba(255, 245, 200, .32);
        backdrop-filter: blur(8px);
    }

    .budget-card-v2.purple .bcv2-types {
        background: rgba(0, 0, 0, .25) !important;
        border-color: rgba(255, 245, 200, .26);
    }

    .budget-card-v2.purple .bcv2-type {
        background: rgba(0, 0, 0, .38) !important;
        border-color: rgba(255, 245, 200, .20);
    }

    .budget-card-v2.purple .bcv2-type:hover {
        background: rgba(0, 0, 0, .45) !important;
        border-color: rgba(255, 245, 200, .38);
    }

    .budget-card-v2.purple .bcv2-head {
        border-bottom-color: rgba(255, 245, 200, .28);
    }

    .budget-card-v2.purple .bcv2-head-icon {
        background: rgba(0, 0, 0, .24);
        border-color: rgba(255, 245, 200, .42);
        color: #fffbeb;
    }

    .budget-card-v2.purple .bcv2-hero-main-num {
        color: #ffffff !important;
        text-shadow:
            0 2px 12px rgba(0, 0, 0, .55),
            0 1px 3px rgba(0, 0, 0, .45);
    }

    .budget-card-v2.purple .bcv2-hero-status-val,
    .budget-card-v2.purple .bcv2-row-stat-num,
    .budget-card-v2.purple .bcv2-type-stat-num {
        color: #ffffff !important;
        text-shadow: 0 1px 5px rgba(0, 0, 0, .48), 0 1px 2px rgba(0, 0, 0, .35);
    }

    /* ╔═══ พื้นที่ทรัพยากรธรรมชาติ — Refined Teal (สวยงาม นุ่มนวล อ่านง่าย) ═══╗ */
    .budget-card-v2.green {
        background: linear-gradient(135deg, #23c4af 0%, #16ad9c 40%, #0e8a7d 70%, #095f56 100%);
        border: 1px solid rgba(204, 251, 241, .35);
        box-shadow:
            inset 0 1px 0 rgba(204, 251, 241, .55),
            inset 0 -1px 0 rgba(0, 0, 0, .12),
            0 22px 45px rgba(22, 173, 156, .38),
            0 4px 14px rgba(15, 23, 42, .16);
    }

    .budget-card-v2.green::before {
        background: linear-gradient(90deg, #ccfbf1 0%, #99f6e4 30%, #5eead4 60%, #2dd4bf 100%);
        height: 5px;
        box-shadow: 0 2px 12px rgba(94, 234, 212, .58);
    }

    .budget-card-v2.green .bcv2-hero-panel {
        background: rgba(0, 0, 0, .38) !important;
        border-color: rgba(204, 251, 241, .32);
        backdrop-filter: blur(8px);
    }

    .budget-card-v2.green .bcv2-types {
        background: rgba(0, 0, 0, .25) !important;
        border-color: rgba(204, 251, 241, .26);
    }

    .budget-card-v2.green .bcv2-type {
        background: rgba(0, 0, 0, .38) !important;
        border-color: rgba(204, 251, 241, .20);
    }

    .budget-card-v2.green .bcv2-type:hover {
        background: rgba(0, 0, 0, .45) !important;
        border-color: rgba(204, 251, 241, .38);
    }

    .budget-card-v2.green .bcv2-head {
        border-bottom-color: rgba(204, 251, 241, .28);
    }

    .budget-card-v2.green .bcv2-head-icon {
        background: rgba(0, 0, 0, .24);
        border-color: rgba(204, 251, 241, .42);
        color: #f0fdfa;
    }

    .budget-card-v2.green .bcv2-hero-main-num {
        color: #ffffff !important;
        text-shadow:
            0 2px 12px rgba(0, 0, 0, .55),
            0 1px 3px rgba(0, 0, 0, .45);
    }

    .budget-card-v2.green .bcv2-hero-status-val,
    .budget-card-v2.green .bcv2-row-stat-num,
    .budget-card-v2.green .bcv2-type-stat-num {
        color: #ffffff !important;
        text-shadow: 0 1px 5px rgba(0, 0, 0, .48), 0 1px 2px rgba(0, 0, 0, .35);
    }

    /* ===== Text shadow ตัวเลขใหญ่ เพิ่มความลึก อ่านชัดบนพื้นเข้ม ===== */
    .budget-card-v2 .bcv2-hero-main-num {
        text-shadow: 0 2px 8px rgba(0, 0, 0, .45), 0 1px 2px rgba(0, 0, 0, .30);
    }

    .budget-card-v2 .bcv2-hero-status-val {
        text-shadow: 0 1px 4px rgba(0, 0, 0, .40);
    }

    .budget-card-v2 .bcv2-row-stat-num,
    .budget-card-v2 .bcv2-type-stat-num {
        text-shadow: 0 1px 4px rgba(0, 0, 0, .35);
    }

    /* Glow tint ของหัวข้อให้เข้ากับสีกรอบ */
    .budget-card-v2.purple .bcv2-head-title {
        text-shadow: 0 1px 3px rgba(0, 0, 0, .30);
    }

    .budget-card-v2.green .bcv2-head-title {
        text-shadow: 0 1px 3px rgba(0, 0, 0, .30);
    }

    /* === Text contrast boost — ทำให้อ่านชัดบนพื้นสีอิ่ม === */
    .budget-card-v2 .bcv2-head-title {
        color: #ffffff;
    }

    .budget-card-v2 .bcv2-head-sub {
        color: rgba(255, 255, 255, .92) !important;
    }

    .budget-card-v2 .bcv2-hero-main-label {
        color: rgba(255, 255, 255, .85) !important;
        font-weight: 700;
    }

    .budget-card-v2 .bcv2-hero-main-unit {
        color: rgba(255, 255, 255, .96) !important;
    }

    .budget-card-v2 .bcv2-hero-main-meta {
        color: rgba(255, 255, 255, .80) !important;
    }

    .budget-card-v2 .bcv2-hero-main-meta b {
        color: #ffffff;
    }

    .budget-card-v2 .bcv2-hero-status-info {
        color: rgba(255, 255, 255, .95) !important;
        font-weight: 600;
    }

    .budget-card-v2 .bcv2-hero-status-val small {
        color: rgba(255, 255, 255, .82) !important;
    }

    .budget-card-v2 .bcv2-master-bar-cap {
        color: rgba(255, 255, 255, .88) !important;
    }

    .budget-card-v2 .bcv2-master-bar-foot {
        color: rgba(255, 255, 255, .92) !important;
    }

    .budget-card-v2 .bcv2-master-bar-track .seg .seg-pct {
        color: rgba(0, 0, 0, .65);
        text-shadow: 0 1px 0 rgba(255, 255, 255, .35);
        font-weight: 800;
    }

    .budget-card-v2 .bcv2-section {
        color: rgba(255, 255, 255, .88) !important;
    }

    .budget-card-v2 .bcv2-type-label {
        color: #ffffff !important;
    }

    .budget-card-v2 .bcv2-type-stat-lbl {
        color: rgba(255, 255, 255, .85) !important;
    }

    .budget-card-v2 .bcv2-type-empty-msg {
        color: rgba(255, 255, 255, .75) !important;
    }

    .budget-card-v2 .bcv2-type-progress-text {
        color: rgba(255, 255, 255, .90) !important;
    }

    .budget-card-v2 .bcv2-row-stat-lbl {
        color: rgba(255, 255, 255, .85) !important;
    }

    /* Tile background — ทำให้มืดขึ้นเล็กน้อยเพื่อให้ข้อความข้างในชัดยิ่งขึ้น */
    .budget-card-v2 .bcv2-hero-panel {
        background: rgba(0, 0, 0, .32) !important;
    }

    .budget-card-v2 .bcv2-types {
        background: rgba(0, 0, 0, .18) !important;
    }

    .budget-card-v2 .bcv2-type {
        background: rgba(0, 0, 0, .30) !important;
    }

    /* Decorative radial overlays */
    .budget-card-v2::after {
        content: "";
        position: absolute;
        border-radius: 50%;
        pointer-events: none;
        width: 380px;
        height: 380px;
        top: -190px;
        right: -120px;
        background: radial-gradient(circle, rgba(255, 255, 255, .14), transparent 65%);
    }

    .budget-card-v2 .bg-orb {
        position: absolute;
        border-radius: 50%;
        pointer-events: none;
        width: 260px;
        height: 260px;
        bottom: -130px;
        left: -80px;
        background: radial-gradient(circle, rgba(255, 255, 255, .08), transparent 60%);
    }

    /* ===== Card Header ===== */
    .bcv2-head {
        display: flex;
        align-items: center;
        gap: 14px;
        margin-bottom: 20px;
        padding-bottom: 18px;
        border-bottom: 1px solid rgba(255, 255, 255, .10);
        position: relative;
        z-index: 1;
    }

    .bcv2-head-icon {
        width: 50px;
        height: 50px;
        border-radius: 14px;
        background: rgba(255, 255, 255, .16);
        border: 1px solid rgba(255, 255, 255, .18);
        display: grid;
        place-items: center;
        font-size: 22px;
        flex-shrink: 0;
        backdrop-filter: blur(6px);
    }

    .bcv2-head-text {
        flex: 1;
        min-width: 0;
    }

    .bcv2-head-title {
        font-size: 18px;
        font-weight: 700;
        margin: 0 0 3px;
        line-height: 1.3;
    }

    .bcv2-head-sub {
        font-size: 12.5px;
        color: rgba(255, 255, 255, .7);
        margin: 0;
    }

    /* ===== HERO PANEL: total stat + status breakdown + master progress ===== */
    .bcv2-hero-panel {
        position: relative;
        z-index: 1;
        background: rgba(0, 0, 0, .24);
        border: 1px solid rgba(255, 255, 255, .16);
        border-radius: 18px;
        padding: 26px 30px;
        backdrop-filter: blur(8px);
        margin-bottom: 22px;
    }

    .bcv2-hero-grid {
        display: grid;
        grid-template-columns: 1.05fr 1px 1fr;
        gap: 28px;
        align-items: center;
    }

    .bcv2-hero-main {
        text-align: center;
        padding: 4px 0;
    }

    .bcv2-hero-main-label {
        font-size: 11.5px;
        font-weight: 600;
        color: rgba(255, 255, 255, .65);
        letter-spacing: 1.2px;
        text-transform: uppercase;
        margin-bottom: 10px;
    }

    .bcv2-hero-main-num {
        font-size: 68px;
        font-weight: 800;
        line-height: 1;
        letter-spacing: -0.025em;
    }

    .budget-card-v2.purple .bcv2-hero-main-num {
        color: #ffffff;
        text-shadow: 0 2px 4px rgba(0, 0, 0, .18);
    }

    .budget-card-v2.green .bcv2-hero-main-num {
        color: #ffffff;
        text-shadow: 0 2px 4px rgba(0, 0, 0, .18);
    }

    .bcv2-hero-main-unit {
        margin-top: 8px;
        font-size: 15px;
        font-weight: 600;
        color: rgba(255, 255, 255, .88);
    }

    .bcv2-hero-main-meta {
        margin-top: 10px;
        font-size: 12.5px;
        color: rgba(255, 255, 255, .55);
    }

    .bcv2-hero-main-meta b {
        color: rgba(255, 255, 255, .85);
        font-weight: 700;
    }

    .bcv2-hero-divider {
        width: 1px;
        height: 100px;
        background: linear-gradient(180deg, transparent, rgba(255, 255, 255, .18), transparent);
        margin: 0 auto;
    }

    /* Hero donut — DISABLED (replaced by master progress bar) */
    .bcv2-hero-grid.with-donut {
        grid-template-columns: 1fr 1px 1fr;
        gap: 28px;
    }

    .bcv2-hero-donut {
        display: none;
    }

    .bcv2-hero-status {
        display: flex;
        flex-direction: column;
        gap: 14px;
    }

    .bcv2-hero-status-row {
        display: flex;
        align-items: center;
        /* justify-content: space-between; */
        gap: 14px;
    }

    .bcv2-hero-status-info {
        display: flex;
        align-items: center;
        gap: 10px;
        font-size: 13.5px;
        color: rgba(255, 255, 255, .85);
        font-weight: 500;
    }

    .bcv2-hero-status-info .dot {
        width: 11px;
        height: 11px;
        border-radius: 50%;
        box-shadow: 0 0 0 3px rgba(255, 255, 255, .08);
    }

    .bcv2-hero-status-val {
        font-size: 24px;
        font-weight: 800;
        color: #fff;
        white-space: nowrap;
    }

    .bcv2-hero-status-val small {
        font-size: 12px;
        font-weight: 500;
        color: rgba(255, 255, 255, .6);
        margin-left: 6px;
    }

    /* Master progress bar — full-width line chart at bottom of hero */
    .bcv2-master-bar {
        margin-top: 22px;
        padding-top: 18px;
        border-top: 1px solid rgba(255, 255, 255, .10);
    }

    .bcv2-master-bar-cap {
        display: flex;
        align-items: center;
        justify-content: space-between;
        margin-bottom: 10px;
        font-size: 11.5px;
        color: rgba(255, 255, 255, .7);
        font-weight: 600;
        letter-spacing: 0.5px;
        text-transform: uppercase;
    }

    .bcv2-master-bar-cap .pct {
        color: #fff;
        font-size: 13px;
        font-weight: 800;
        letter-spacing: 0;
        text-transform: none;
    }

    .bcv2-master-bar-track {
        display: flex;
        height: 16px;
        background: rgba(0, 0, 0, .32);
        border-radius: 999px;
        overflow: hidden;
        box-shadow: inset 0 1px 3px rgba(0, 0, 0, .25);
    }

    .bcv2-master-bar-track .seg {
        height: 100%;
        position: relative;
        transition: width .6s ease;
        display: grid;
        place-items: center;
    }

    .bcv2-master-bar-track .seg .seg-pct {
        font-size: 10.5px;
        font-weight: 700;
        color: rgba(0, 0, 0, .55);
        text-shadow: 0 1px 0 rgba(255, 255, 255, .25);
        letter-spacing: 0.2px;
    }

    .bcv2-master-bar-foot {
        display: flex;
        justify-content: space-between;
        gap: 12px;
        margin-top: 10px;
        font-size: 12px;
        color: rgba(255, 255, 255, .78);
    }

    .bcv2-master-bar-foot .item {
        display: flex;
        align-items: center;
        gap: 7px;
    }

    .bcv2-master-bar-foot .item .dot {
        width: 9px;
        height: 9px;
        border-radius: 50%;
    }

    .bcv2-master-bar-foot .item b {
        color: #fff;
        font-weight: 700;
        margin: 0 3px;
    }

    /* ===== Section divider ===== */
    .bcv2-section {
        position: relative;
        z-index: 1;
        display: flex;
        align-items: center;
        gap: 14px;
        margin: 0 0 14px 4px;
        font-size: 11.5px;
        font-weight: 700;
        color: rgba(255, 255, 255, .7);
        letter-spacing: 1.5px;
        text-transform: uppercase;
    }

    .bcv2-section::after {
        content: "";
        flex: 1;
        height: 1px;
        background: rgba(255, 255, 255, .10);
    }

    /* ===== Category rows ===== */
    .bcv2-rows {
        display: flex;
        flex-direction: column;
        gap: 10px;
        position: relative;
        z-index: 1;
    }

    /* Row with data — full layout */
    .bcv2-row {
        background: rgba(255, 255, 255, .07);
        border: 1px solid rgba(255, 255, 255, .14);
        border-radius: 14px;
        padding: 16px 20px;
        backdrop-filter: blur(8px);
        transition: background .2s, transform .2s;
    }

    .bcv2-row:hover {
        background: rgba(255, 255, 255, .10);
    }

    .bcv2-row-head {
        display: flex;
        align-items: center;
        gap: 12px;
        margin-bottom: 10px;
    }

    .bcv2-row-icon {
        width: 38px;
        height: 38px;
        border-radius: 10px;
        background: rgba(255, 255, 255, .16);
        border: 1px solid rgba(255, 255, 255, .14);
        display: grid;
        place-items: center;
        font-size: 16px;
        flex-shrink: 0;
    }

    .bcv2-row-label {
        flex: 1;
        font-size: 15px;
        font-weight: 700;
        color: #fff;
        line-height: 1.25;
    }

    .bcv2-row-tag {
        font-size: 10.5px;
        font-weight: 700;
        padding: 4px 11px;
        border-radius: 999px;
        background: rgba(16, 185, 129, .22);
        color: #86efac;
        border: 1px solid rgba(16, 185, 129, .30);
        letter-spacing: 0.3px;
        white-space: nowrap;
    }

    .bcv2-row-tag.empty {
        background: rgba(255, 255, 255, .06);
        color: rgba(255, 255, 255, .55);
        border-color: rgba(255, 255, 255, .10);
    }

    .bcv2-row-body {
        display: grid;
        grid-template-columns: minmax(220px, auto) 1fr;
        gap: 26px;
        align-items: center;
        padding-left: 50px;
    }

    .bcv2-row-stats {
        display: flex;
        gap: 22px;
    }

    .bcv2-row-stat {
        display: flex;
        align-items: baseline;
        gap: 5px;
    }

    .bcv2-row-stat-num {
        font-size: 26px;
        font-weight: 800;
        line-height: 1;
    }

    .budget-card-v2.purple .bcv2-row-stat-num {
        color: #ffffff;
        text-shadow: 0 1px 2px rgba(0, 0, 0, .18);
    }

    .budget-card-v2.green .bcv2-row-stat-num {
        color: #ffffff;
        text-shadow: 0 1px 2px rgba(0, 0, 0, .18);
    }

    .bcv2-row-stat-lbl {
        font-size: 12px;
        color: rgba(255, 255, 255, .7);
        font-weight: 500;
    }

    .bcv2-row-stat-meta {
        font-size: 11px;
        color: rgba(255, 255, 255, .55);
        margin-left: 6px;
    }

    .bcv2-row-stat-meta b {
        color: #fff;
        font-weight: 700;
    }

    /* Row donut — DISABLED (replaced by horizontal progress bar) */
    .bcv2-row-donut {
        display: none;
    }

    /* Row progress bar (horizontal line chart) */
    .bcv2-row-progress {
        min-width: 0;
    }

    .bcv2-row-progress-bar {
        display: flex;
        height: 12px;
        background: rgba(0, 0, 0, .32);
        border-radius: 999px;
        overflow: hidden;
        box-shadow: inset 0 1px 2px rgba(0, 0, 0, .25);
    }

    .bcv2-row-progress-bar .seg {
        height: 100%;
        transition: width .5s ease;
    }

    .bcv2-row-progress-text {
        display: flex;
        justify-content: space-between;
        gap: 12px;
        margin-top: 8px;
        font-size: 11.5px;
        color: rgba(255, 255, 255, .78);
    }

    .bcv2-row-progress-text .item {
        display: flex;
        align-items: center;
        gap: 6px;
    }

    .bcv2-row-progress-text .dot {
        display: inline-block;
        width: 8px;
        height: 8px;
        border-radius: 50%;
    }

    .bcv2-row-progress-text b {
        color: #fff;
        font-weight: 700;
    }

    /* Empty row — slim 1-line variant */
    .bcv2-row.empty {
        background: rgba(255, 255, 255, .035);
        border-style: dashed;
        padding: 12px 20px;
        opacity: .82;
    }

    .bcv2-row.empty:hover {
        background: rgba(255, 255, 255, .06);
    }

    .bcv2-row.empty .bcv2-row-head {
        margin-bottom: 0;
    }

    .bcv2-row.empty .bcv2-row-icon {
        width: 32px;
        height: 32px;
        font-size: 13px;
        background: rgba(255, 255, 255, .08);
    }

    .bcv2-row.empty .bcv2-row-label {
        font-size: 14px;
        font-weight: 500;
        color: rgba(255, 255, 255, .70);
    }

    /* keep legend in DOM for offline parser (used elsewhere) */
    .bcv2-tile-legend.hidden-legend {
        display: none;
    }

    /* ===== Combined types panel — 3 mini-cards in one container ===== */
    .bcv2-types {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 12px;
        background: rgba(255, 255, 255, .05);
        border: 1px solid rgba(255, 255, 255, .12);
        border-radius: 16px;
        padding: 16px;
        position: relative;
        z-index: 1;
    }

    .bcv2-type {
        display: flex;
        flex-direction: column;
        gap: 10px;
        padding: 14px;
        background: rgba(0, 0, 0, .22);
        border-radius: 12px;
        border: 1px solid rgba(255, 255, 255, .08);
        transition: background .2s, border-color .2s;
    }

    .bcv2-type:hover {
        background: rgba(0, 0, 0, .28);
        border-color: rgba(255, 255, 255, .18);
    }

    .bcv2-type.empty {
        opacity: .58;
    }

    .bcv2-type.empty:hover {
        opacity: .85;
    }

    .bcv2-type-head {
        display: flex;
        align-items: center;
        gap: 9px;
        min-height: 32px;
    }

    .bcv2-type-icon {
        width: 30px;
        height: 30px;
        border-radius: 8px;
        background: rgba(255, 255, 255, .14);
        display: grid;
        place-items: center;
        font-size: 14px;
        flex-shrink: 0;
    }

    .bcv2-type-label {
        flex: 1;
        font-size: 12.5px;
        font-weight: 600;
        color: #fff;
        line-height: 1.25;
    }

    .bcv2-type-stats {
        display: flex;
        gap: 14px;
        padding: 4px 0;
    }

    .bcv2-type-stat {
        display: flex;
        align-items: baseline;
        gap: 4px;
    }

    .bcv2-type-stat-num {
        font-size: 22px;
        font-weight: 800;
        line-height: 1;
    }

    .budget-card-v2.purple .bcv2-type-stat-num {
        color: #ffffff;
        text-shadow: 0 1px 2px rgba(0, 0, 0, .18);
    }

    .budget-card-v2.green .bcv2-type-stat-num {
        color: #ffffff;
        text-shadow: 0 1px 2px rgba(0, 0, 0, .18);
    }

    .bcv2-type-stat-lbl {
        font-size: 10.5px;
        color: rgba(255, 255, 255, .65);
    }

    .bcv2-type-progress {
        display: flex;
        height: 8px;
        background: rgba(0, 0, 0, .30);
        border-radius: 999px;
        overflow: hidden;
        box-shadow: inset 0 1px 2px rgba(0, 0, 0, .22);
    }

    .bcv2-type-progress .seg {
        height: 100%;
        transition: width .5s ease;
    }

    .bcv2-type-progress-text {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 4px;
        margin-top: 2px;
        font-size: 11px;
        color: rgba(255, 255, 255, .78);
        text-align: center;
    }

    .bcv2-type-progress-text span {
        display: inline-flex;
        align-items: center;
    }

    .bcv2-type-progress-text .dot {
        display: inline-block;
        width: 7px;
        height: 7px;
        border-radius: 50%;
        margin-right: 6px;
        vertical-align: middle;
    }

    .bcv2-type-progress-text b {
        color: #fff;
        font-weight: 700;
        margin: 0 3px;
    }

    .bcv2-type-empty-msg {
        font-size: 11px;
        color: rgba(255, 255, 255, .55);
        font-style: italic;
        padding: 6px 0;
    }
    .bcv2-type-progress-text-new {
        display: flex;
        align-items: center;
        gap: 20px;
        margin-top: 2px;
        font-size: 14px;
        color: rgba(15, 14, 14, 0.78);
        text-align: center;
        margin-bottom: 10px;
    }
    .bcv2-type-progress-text-new .dot {
        display: inline-block;
        width: 14px;
        height: 14px;
        border-radius: 50%;
        margin-right: 6px;
        vertical-align: middle;
    }