.chart-panel {
    height: 33%;
    min-height: 250px;
    display: flex;
    flex-direction: column;
}

.panel-header {
    padding: 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.6);
    background-color: rgba(255, 255, 255, 0.4);
}

.panel-header h3 {
    font-size: 1rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.chart-container {
    flex: 1;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
}

.bar-chart {
    flex: 1;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    position: relative;
    padding: 0 0.5rem;
    gap: 0.5rem;
}

.chart-grid-lines {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding-bottom: 1.5rem;
    z-index: 0;
    pointer-events: none;
}

.chart-grid-lines div {
    border-bottom: 1px solid #e5e7eb;
    height: 1px;
    width: 100%;
}

.bar {
    width: 16%;
    border-radius: 0.375rem 0.375rem 0 0;
    position: relative;
    z-index: 10;
}

.bar:hover::after {
    content: attr(data-label);
    position: absolute;
    top: -1.5rem;
    left: 50%;
    transform: translateX(-50%);
    background: #1f2937;
    color: white;
    font-size: 0.625rem;
    padding: 0.125rem 0.25rem;
    border-radius: 0.25rem;
}

/* Bar Heights & Colors */
.bar-1 {
    height: 30%;
    background-color: #dbeafe;
}

.bar-2 {
    height: 45%;
    background-color: #bfdbfe;
}

.bar-3 {
    height: 60%;
    background-color: #fde047;
}

.bar-4 {
    height: 40%;
    background-color: #fb923c;
}

.bar-5 {
    height: 75%;
    background-color: #f87171;
}

.bar-6 {
    height: 25%;
    background-color: #4ade80;
}

.chart-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 0.5rem;
    font-size: 0.625rem;
    color: #6b7280;
    padding: 0 0.25rem;
}

/* ==================================
    Bar Chart สีส้ม
   ==================================*/
.bar-chart-container {
    height: 12rem;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    padding: 0 0.5rem;
}

.bar-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    opacity: 1;
    transition:
        opacity 0.2s;
}

.bar-group:hover {
    opacity: 0.8;
}

.bars {
    width: 100%;
    display: flex;
    gap: 0.25rem;
    align-items: flex-end;
    height: 8rem;
    justify-content: center;
}

.bar {
    width: 0.75rem;
    border-top-left-radius: 2px;
    border-top-right-radius: 2px;
}

.bar.gray {
    background-color: #D1D5DB;
}

.bar.primary {
    background-color: var(--primary);
}

.h-40 {
    height: 40%;
}

.h-50 {
    height: 50%;
}

.h-55 {
    height: 55%;
}

.h-60 {
    height: 60%;
}

.h-65 {
    height: 65%;
}

.h-70 {
    height: 70%;
}

.h-80 {
    height: 80%;
}

.h-85 {
    height: 85%;
}

.h-90 {
    height: 90%;
}

.h-95 {
    height: 95%;
}

.bar-group span {
    font-size: 0.75rem;
    color: #9CA3AF;
}

.bar-group.active span {
    color: var(--text-main);
    font-weight: 600;
}

/* Donut Chart */
.donut-container {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    margin-bottom: 1rem;
}

.donut-chart {
    width: 8rem;
    height: 8rem;
    border-radius: 50%;
    background: conic-gradient(var(--primary) 0% 40%, #d0ff2c 40% 70%, #464545 70% 90%, #DCDCDC 90% 100%);
    position: relative;
}

.donut-center {
    position: absolute;
    top: 1rem;
    left: 1rem;
    right: 1rem;
    bottom: 1rem;
    background-color: var(--card-light);
    border-radius: 50%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.donut-legend {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.legend-row {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
}

/* Finance dashboard theme alignment: chart colors only */
.panel-header {
    border-bottom-color: var(--synto-line, rgba(102, 102, 102, 0.22)) !important;
    background-color: rgba(255, 244, 230, 0.55) !important;
}

.chart-grid-lines div {
    border-bottom-color: var(--synto-line, rgba(102, 102, 102, 0.22)) !important;
}

.bar:hover::after {
    background: var(--synto-text, #333333) !important;
}

.bar-1,
.bar-2,
.bar-3,
.bar-4,
.bar-5,
.bar-6,
.bar.primary {
    background-color: var(--synto-primary, #FF6B00) !important;
}

.bar.gray {
    background-color: var(--synto-line, #DCDCDC) !important;
}

.chart-labels,
.bar-group span {
    color: var(--synto-muted, #666666) !important;
}

.legend-val {
    font-family: var(--font-sans);
    font-weight: 500;
}

/* เพิ่มส่วนนี้เพื่อให้มีจุดสีกลมๆ หน้าตัวหนังสือ */
.dot {
    display: inline-block;
    width: 0.5rem;   /* หรือ 8px */
    height: 0.5rem;
    border-radius: 50%;
    margin-right: 0.5rem;
}

/* ตรวจสอบว่าสีเหล่านี้มีค่าถูกต้องตาม CSS ที่คุณแนบมา */
.bg-primary { background-color: var(--primary); }
.bg-green   { background-color: #d0ff2c; } /* ตรงกับสีในกราฟ */
.bg-blue    { background-color: #464545; } /* ตรงกับสีในกราฟ */
.bg-yellow  { background-color: #DCDCDC; } /* ตรงกับสีในกราฟ */

/* ==========================================================================
   Cashflow Summary (Replicated form Payroll Dashboard 100%)
   ========================================================================== */

/* 1. Header & Text */
.card-header-simple {
    margin-bottom: 1.5rem;
    /* mb-6 in Tailwind */
}

.card-header-simple h3 {
    font-size: 1.125rem;
    /* text-lg */
    font-weight: 600;
    color: #464545;
    /* text-charcoal */
    margin: 0;
    line-height: 1.25;
}

.card-header-simple p {
    font-size: 0.75rem;
    /* text-xs */
    color: rgba(70, 69, 69, 0.6);
    /* text-charcoal/60 */
    margin: 0.25rem 0 0 0;
}

/* 2. List Structure */
.cashflow-list {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    /* space-y-4 */
}

.cashflow-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.cf-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    /* gap-3 */
}

/* 3. Icon Box (ปรับสีให้ตรงต้นฉบับ: Lime & Primary/10) */
.icon-box {
    width: 2.5rem;
    /* w-10 */
    height: 2.5rem;
    /* h-10 */
    border-radius: 0.5rem;
    /* rounded-lg */
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Mapping Class HTML เดิม -> สีต้นฉบับใหม่ */
/* "เงินเข้า" ใช้สีเขียวมะนาว (Lime) แบบต้นฉบับ */
.icon-box.bg-green-soft {
    background-color: #d0ff2c !important;
    /* bg-lime */
    color: #464545 !important;
    /* text-charcoal */
}

/* "เงินออก" ใช้สีส้มจางๆ (Primary/10) แบบต้นฉบับ */
.icon-box.bg-red-soft {
    background-color: rgba(252, 91, 8, 0.1) !important;
    /* bg-primary/10 */
    color: #fc5b08 !important;
    /* text-primary */
}

/* 4. Labels & Values */
.cashflow-item .label {
    font-size: 0.75rem;
    /* text-xs */
    color: rgba(70, 69, 69, 0.6);
    /* text-charcoal/60 */
    margin-bottom: 0;
}

.cashflow-item .val {
    font-weight: 700;
    font-family: 'Inter', sans-serif;
    /* font-sans */
    font-size: 1rem;
    /* text-base (default) */
    color: #464545;
    /* text-charcoal */
}

/* 5. Badges (ปรับสีให้ตรงต้นฉบับ) */
.badge {
    font-size: 0.75rem;
    /* text-xs */
    font-weight: 700;
    /* font-bold */
    padding: 0.25rem 0.5rem;
    /* py-1 px-2 */
    border-radius: 0.375rem;
    /* rounded-md */
    color: #464545 !important;
    /* text-charcoal */
}

/* Badge +12% (สีเขียวมะนาว) */
.badge.green {
    background-color: #d0ff2c !important;
    /* bg-lime */
}

/* Badge +5% (สีเทาเงินจางๆ ตามต้นฉบับ) */
.badge.red {
    background-color: rgba(220, 220, 220, 0.5) !important;
    /* bg-silver/50 */
    /* ต้นฉบับ badge อันล่างเป็นสีเงิน ไม่ใช่สีแดงครับ */
}

/* 6. Footer: Net Flow (สุทธิ) */
.net-flow {
    margin-top: 3.5rem;
    /* mt-6 */
    padding-top: 1rem;
    /* pt-4 */
    border-top: 1px solid rgba(220, 220, 220, 0.5);
    /* border-silver/50 */
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
}

.net-flow .label {
    font-size: 0.75rem;
    /* text-xs */
    color: rgba(70, 69, 69, 0.6);
    /* text-charcoal/60 */
    margin-bottom: 0.25rem;
}

.net-flow .val {
    font-size: 1.25rem;
    /* text-xl */
    font-weight: 700;
    font-family: 'Inter', sans-serif;
    color: #fc5b08 !important;
    /* text-primary */
}

/* 7. Mini Bar Chart */
.mini-bar-chart {
    display: flex;
    align-items: flex-end;
    gap: 0.25rem;
    /* gap-1 */
    height: 2rem;
    /* h-8 */
}

.mini-bar {
    width: 0.5rem;
    /* w-2 */
    background: #DCDCDC;
    /* bg-silver */
    border-top-left-radius: 2px;
    border-top-right-radius: 2px;
}

.mini-bar.active {
    background: #fc5b08;
    /* bg-primary */
}

/* Height utilities for bars */
.h-30 {
    height: 30%;
}

.h-40 {
    height: 40%;
}

.h-50 {
    height: 50%;
}

.h-60 {
    height: 60%;
}

.h-65 {
    height: 65%;
}

.h-70 {
    height: 70%;
}

.h-80 {
    height: 80%;
}

.h-85 {
    height: 85%;
}

.h-90 {
    height: 90%;
}

.h-95 {
    height: 95%;
}
