<style>
        /* --- MODERN RESET & VARS --- */
        * { box-sizing: border-box; outline: none; }
        
        :root {
            /* Primary Brand Colors - Refined */
            --pt-green: #006837;
            --pt-green-light: #008f4c;
            --pt-gold: #C5A059;
            --pt-gold-light: #e0be75;
            --pt-dark: #111827;
            
            
            /* Export safety colors */
            --iot-color: #059669;
            --workforce-color: #d97706;
            --happy-color: #f59e0b;
            --co2-color: #16a34a;
/* UI Colors */
            --bg-body: #E5E7EB; /* Darker gray for contrast outside slides */
            --bg-slide: #FFFFFF;
            --bg-panel: #F3F4F6;
            --bg-hover: #F9FAFB;
            
            /* Status Colors (Modern Muted) */
            --success-bg: #DCFCE7; --success-text: #14532D; --success-border: #86EFAC;
            --danger-bg: #FEE2E2; --danger-text: #7F1D1D; --danger-border: #FECACA;
            
            /* Chart Colors (Vibrant) */
            --chart-prev: #9CA3AF;
            --chart-curr: #10B981; /* Green */
            --chart-cost: #0EA5E9; /* Blue */
            --chart-warn: #F59E0B; /* Orange */
            --chart-danger: #EF4444; /* Red */
            --chart-purple: #8B5CF6;
            
            /* Shadows */
            --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
            --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
            --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
            
            /* Borders */
            --border-light: #E5E7EB;
            --border-focus: #C5A059;
        }

        body { 
            background-color: var(--bg-body); 
            display: flex; 
            flex-direction: column; 
            align-items: center; 
            margin: 0; 
            padding: 40px 0; 
            min-height: 100vh; 
            font-family: 'Sarabun', sans-serif; 
            gap: 40px; 
            color: #374151;
        }
        
        /* --- SLIDE CONTAINER (MODERN CARD) --- */
/* ค้นหา class นี้แล้วแก้เป็นแบบนี้ครับ */

.slide-container { 
    width: 1280px; 
    height: 720px; 
    background-color: var(--bg-slide); 
    box-shadow: var(--shadow-lg); 
    position: relative; 
    overflow: hidden; 
    display: flex; 
    flex-direction: column; 
    border-radius: 4px;

    /* --- ส่วนที่แก้ใหม่ --- */
    transform-origin: top center; /* ยึดด้านบนเป็นหลัก เวลาหดจะได้หดขึ้นด้านบน */
    margin: 0 auto; /* จัดกึ่งกลางแนวนอน */
    /* ลบ margin-bottom เดิมออกถ้ามี */
}


        /* --- EXPORT BUTTONS --- */

        .fab-pdf {
            position: fixed; bottom: 30px; right: 30px;
            background: linear-gradient(135deg, var(--pt-gold), var(--pt-gold-light));
            color: #fff;
            width: 36px; height: 36px; border-radius: 50%;
            display: flex; align-items: center; justify-content: center;
            box-shadow: 0 10px 25px rgba(0, 104, 55, 0.25);
            cursor: pointer; z-index: 9999;
            transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); 
            font-size: 18px; border: none;
        }
        .fab-pdf:hover { transform: scale(1.1) rotate(-5deg); box-shadow: 0 15px 30px rgba(0, 104, 55, 0.3); }

        .fab-export {
            position: fixed; bottom: 30px; right: 30px;
            background: linear-gradient(135deg, var(--pt-gold), var(--pt-gold-light));
            color: #fff;
            width: 36px; height: 36px; border-radius: 50%;
            display: flex; align-items: center; justify-content: center;
            box-shadow: 0 10px 25px rgba(197, 160, 89, 0.4);
            cursor: pointer; z-index: 9999;
            transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); 
            font-size: 18px; border: none;
        }
        .fab-export:hover { transform: scale(1.1) rotate(5deg); box-shadow: 0 15px 30px rgba(197, 160, 89, 0.5); }
        .fab-login {
    position: fixed;
    top: 20px; /* อยู่ด้านบน */
    right: 20px;
    background: linear-gradient(135deg, var(--pt-dark), #374151);
    color: #fff;
    width: 36px; height: 36px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    cursor: pointer; z-index: 10000;
    border: none; font-size: 16px;
    transition: all 0.3s;
}
.fab-login:hover { transform: scale(1.1); }

/* สไตล์สำหรับช่อง Input เมื่อไม่ได้ Login (ดูได้อย่างเดียว) */
.readonly-mode {
    pointer-events: none; /* ห้ามคลิก */
    background: transparent !important;
    border: none !important;
}
/* ซ่อน Placeholder เมื่อไม่ได้ Login จะได้ไม่รก */
.readonly-mode::placeholder {
    color: transparent !important;
}

/* ===== Floating Buttons: Scroll Up/Down (Page) ===== */
/* --- FAB YEAR BUTTON (ปุ่มลอยมุมซ้ายบน) --- */
.fab-year {
    position: fixed;
    top: 70px;
    right: 20px; /* ของเดิมอยู่ซ้าย */
    background: linear-gradient(135deg, var(--pt-gold), #b08d4d);
    border : 0;
    color: #fff;
    width: 36px; /* ของเดิมกว้าง 60 */
    height: 36px; /* ของเดิมสูง 60 */
    border-radius: 50%; /* ของเดิมเป็นสี่เหลี่ยมมน */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    box-shadow: 0 10px 20px rgba(176, 141, 77, 0.4);
    cursor: pointer;
    z-index: 9999;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    font-family: 'Poppins', sans-serif;
    line-height: 1;
}

.fab-year:hover {
    transform: scale(1.1) translateY(2px);
    box-shadow: 0 15px 30px rgba(176, 141, 77, 0.6);
}

.fab-year span {
    font-size: 18px;
    margin-top: 2px;
}

/* --- YEAR SELECTION GRID (ใน Modal) --- */
.year-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

.year-card {
    background: #f9fafb;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    padding: 15px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.year-card:hover {
    border-color: var(--pt-gold);
    background: #fff;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.05);
}

/* สถานะ Active (ปีที่เลือกอยู่) */
.year-card.active {
    background: linear-gradient(135deg, var(--pt-green), var(--pt-green-light));
    /*border-color: var(--pt-green);*/
    color: white;
    box-shadow: 0 4px 12px rgba(0, 104, 55, 0.3);
}

.year-card .year-num {
    font-size: 24px;
    font-weight: 700;
    font-family: 'Poppins', sans-serif;
}

.year-card .year-sub {
    font-size: 12px;
    margin-top: 4px;
    opacity: 0.7;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ปรับสีตัวหนังสือเมื่อ Active */
.year-card.active .year-sub { opacity: 0.9; }
.fab-scroll{
  position: fixed;
  right: 30px;
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  z-index: 9999;
  border: none;
  color: #fff;
  background: linear-gradient(135deg, var(--pt-green), var(--pt-green-light));
  box-shadow: 0 10px 25px rgba(0, 104, 55, 0.25);
  transition: all 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  font-size: 18px;
}
.fab-scroll:hover{ transform: scale(1.08); box-shadow: 0 14px 30px rgba(0, 104, 55, 0.3); }

/* Placement: stack above Highlight + Export */
.fab-scroll-up{ bottom: 120px; }
.fab-scroll-down{ bottom: 75px; }

        /* Loading Overlay */
        .loading-overlay {
            position: fixed; top: 0; left: 0; width: 100%; height: 100%;
            background: rgba(17, 24, 39, 0.9); backdrop-filter: blur(5px); z-index: 10000;
            display: none; flex-direction: column;
            align-items: center; justify-content: center; color: white;
        }
        .spinner { width: 60px; height: 60px; border: 4px solid rgba(255,255,255,0.1); border-top: 4px solid var(--pt-gold); border-radius: 50%; animation: spin 0.8s ease-in-out infinite; margin-bottom: 20px; }
        @keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

        /* --- HEADER AREA --- */
        .header-strip { 
            background: linear-gradient(90deg, var(--pt-green) 0%, var(--pt-green-light) 70%); 
            height: 8px; width: 100%; position: absolute; top: 0; left: 0; z-index: 10; 
        }
        .header-strip::after { 
            content: ''; position: absolute; top: 0; right: 0; width: 25%; height: 100%; 
            background: var(--pt-gold); 
        }
        
        .slide-header { 
            padding: 30px 40px 15px 40px; 
            border-bottom: 1px solid var(--border-light); 
            display: flex; flex-direction: column; gap: 15px; 
            background: #fff; 
        }
        
        .header-top-row { display: flex; justify-content: space-between; align-items: flex-end; }
        
        .header-title-group h2 { 
            font-size: 26px; color: var(--pt-green); margin: 5px 0 0 0; font-weight: 700; 
            letter-spacing: -0.5px;
        }
        
        .kpi-code { 
            background: linear-gradient(135deg, var(--pt-gold), #b08d4d); 
            color: white; padding: 4px 12px; border-radius: 6px; 
            font-family: 'Poppins', sans-serif; font-weight: 600; font-size: 13px; 
            letter-spacing: 0.5px; text-transform: uppercase;
            box-shadow: 0 2px 4px rgba(197, 160, 89, 0.3);
            display: inline-block;
        }

        .header-stats-group { display: flex; gap: 20px; align-items: stretch; }
        
        /* Modern Info Box */
        .target-info, .status-info { 
            padding: 8px 20px; border-radius: 12px; 
            min-width: 140px; display: flex; flex-direction: column; justify-content: center; 
            border: 1px solid transparent;
            position: relative; overflow: hidden;
        }
        
        .target-info { background: var(--bg-panel); border: 1px solid var(--border-light); }
        .target-val { font-size: 26px; color: var(--pt-dark); font-weight: 700; line-height: 1; margin-top: 4px; font-family: 'Poppins', sans-serif;}
        .target-label { font-size: 14px; color: #6B7280; text-transform: uppercase; font-weight: 700; letter-spacing: 0.5px; }
        
        .status-info { background: #fff; box-shadow: var(--shadow-sm); transition: all 0.3s; }
        .status-info.pass { background: var(--success-bg); border-color: var(--success-border); color: var(--success-text); }
        .status-info.fail { background: var(--danger-bg); border-color: var(--danger-border); color: var(--danger-text); }
        
        .status-val { font-size: 26px; font-weight: 700; line-height: 1; display: flex; align-items: center; gap: 10px; margin-top: 4px; font-family: 'Poppins', sans-serif; }
        .status-label { font-size: 14px; text-transform: uppercase; font-weight: 700; opacity: 0.8; letter-spacing: 0.5px; }

        /* --- PROJECT GRID --- */
        .project-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
        
        .project-card { 
            background: #fff; 
            border: 1px solid var(--border-light); 
            border-left: 5px solid var(--pt-green); 
            padding: 12px; 
            border-radius: 8px; 
            display: flex; align-items: center; gap: 15px; 
            box-shadow: var(--shadow-sm);
            transition: transform 0.2s, box-shadow 0.2s;
        }
        .project-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
        
        .project-icon { 
            width: 38px; height: 38px; 
            background: #dcfce7; 
            border-radius: 10px; 
            display: flex; align-items: center; justify-content: center; 
            color: var(--pt-green); font-size: 16px; 
            box-shadow: 0 2px 5px rgba(0,0,0,0.05); 
            flex-shrink: 0; 
        }
        .project-text { font-size: 14px; color: #4B5563; line-height: 1.5; font-weight: 400; }
        .project-title { font-weight: 700; color: var(--pt-dark); display: block; margin-bottom: 2px; font-size: 17px; }
        
        /* --- CONTENT AREA --- */
        .content-area { 
            padding: 15px 40px 25px 40px; 
            display: grid; grid-template-columns: 580px 1fr; gap: 30px; 
            height: 100%; background: #fff; 
        }
        
        .input-section { display: flex; flex-direction: column; height: 100%; }
        
        .section-title { 
            font-size: 15px; font-weight: 700; color: var(--pt-dark); margin-bottom: 15px; 
            display: flex; align-items: center; gap: 10px; justify-content: space-between;
        }
        .section-title i { color: var(--pt-gold); }
        
        /* Table Styling */
        .monthly-list { 
            display: flex; flex-direction: column; overflow-y: auto; 
            border: 1px solid #e5e7eb; border-top: none; 
            border-radius: 0 0 12px 12px; 
            max-height: 450px; 
            box-shadow: var(--shadow-sm);
        }
        
        .table-header { 
            background: #f8fafc; 
            padding: 10px 0; 
            font-weight: 700; font-size: 13px; 
            color: #64748b; text-transform: uppercase; letter-spacing: 0.5px;
            text-align: center; border: 1px solid #e2e8f0; border-bottom: 2px solid #e2e8f0; 
            border-radius: 12px 12px 0 0; 

        }
        
        .month-row { align-items: center; background: white; border-bottom: 1px solid var(--border-light); height: 31px; transition: background 0.1s; }
        .month-row:last-child { border-bottom: none; }
        .month-row:hover { background: var(--bg-hover); }
        
        .month-label { 
            height: 100%; display: flex; align-items: center; justify-content: center; 
            font-weight: 700; font-size: 13px; 
            color: rgb(148 163 184 / var(--tw-text-opacity, 1)); 
            border-bottom: 1px solid #f1f5f9; 

        }
        
        /* Modern Inputs */
        .month-input { 
            border: none; 
            outline: none; 
            font-size: 13px; 
            color: var(--pt-dark); 
            width: 100%; 
            background: transparent; 
            text-align: center; 
            border-right: 1px solid transparent; 
            transition: all 0.2s; 
            height: 100%;       
            line-height: 38px;  
            padding: 0;         
        }
        
        .month-input:hover { background: #f9fafb; }
        .month-input:focus { background: #fff; box-shadow: inset 0 0 0 2px var(--pt-gold); z-index: 2; position: relative; color: #0369a1}
        .month-input::placeholder { color: #D1D5DB; font-size: 13px; font-weight: 300; }
        
        .comp-result { font-size: 13px; font-weight: 700; text-align: center; display: flex; align-items: center; justify-content: center; gap: 4px; color: #0369a1;}
        .comp-result.good { color: var(--chart-curr); }
        .comp-result.bad { color: var(--chart-danger); }
.comp-result.inprogress { color: #d97706; }
        .detail-cell{
    font-size: 14px;
    color: #374151;
    text-align: left;
    padding: 0 10px;
    border-right: 1px solid var(--border-light);
    display:flex;
    align-items:center;
    line-height: 1.2;
    white-space: normal;
}
        
        
.detail-input{
    font-size: 14px;
    color: #111827;
    text-align: left;
    padding: 0 10px;
    border: none;
    outline: none;
    background: transparent;
    width: 100%;
    height: 100%;
    line-height: 32px;
    font-family: 'Sarabun','Poppins',sans-serif;
}
.detail-input:hover{ background: #f9fafb; }
.detail-input:focus{ background: #fff; box-shadow: inset 0 0 0 2px var(--pt-gold); z-index: 2; position: relative; }
.detail-input::placeholder{ color:#D1D5DB; font-weight:300; }
/* Grids (Layout Preserved) */
        .grid-kpi1 { display: grid; grid-template-columns: 50px repeat(6, 1fr); }
        .grid-kpi2 { display: grid; grid-template-columns: 50px 2fr 1.2fr; } 
        .grid-kpi3 { display: grid; grid-template-columns: 50px 2fr 1fr; } 
        .grid-kpi4 { display: grid; grid-template-columns: 50px 1fr 1fr 1fr 1fr; } 
        .grid-kpi6 { display: grid; grid-template-columns: 50px 1fr 1fr 1fr 1fr; } 
        .grid-kpi7 { display: grid; grid-template-columns: 50px 1fr 2.2fr 1fr; }
        .grid-kpi8 { display: grid; grid-template-columns: 50px 1fr 2.2fr 1fr; }
        .grid-kpi9 { display: grid; grid-template-columns: 50px 1fr 1fr; }
        .grid-kpi10 { display: grid; grid-template-columns: 50px 1fr 1fr 1fr 1fr; }
        
        /* --- VISUAL SECTION --- */
        .visual-section { 
            display: flex; flex-direction: column; gap: 20px; 
            flex-direction: column;
            gap: 20px;
            background: #dcfce8;
            border-radius: 16px;
            padding: 20px;
            border: 1px solid #86f0ad;
        }
        
        .summary-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
        
        .stat-card { 
            background: #fff; 
            padding: 15px; 
            border-radius: 12px; 
            border: 1px solid #86f1ae;
            box-shadow: var(--shadow-sm); 
            display: flex; align-items: center; gap: 15px; 
        }
        
        .stat-icon { 
            width: 44px; height: 44px; 
            background: rgba(0, 104, 55, 0.08); 
            border-radius: 12px; 
            display: flex; align-items: center; justify-content: center; 
            color: var(--pt-green); font-size: 18px; 
        }
        
        .stat-content h4 { margin: 0; font-size: 14px; color: #444; font-weight: 600; text-transform: uppercase;}
        .stat-content .stat-value { font-size: 22px; font-weight: 700; color: var(--pt-dark); line-height: 1.2; font-family: 'Poppins', sans-serif; margin-top: 2px; }
        
        .chart-header-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 5px; padding: 0 5px; }
        .chart-title { font-size: 14px; font-weight: 700; color: #374151; }
        
        .chart-controls { display: flex; background: #85f2af; padding: 4px; border-radius: 8px; }
        .chart-toggle-btn { 
            border: none; background: transparent; padding: 6px 16px; 
            font-size: 13px; font-weight: 600; cursor: pointer; 
            border-radius: 6px; color: #6B7280; transition: all 0.2s; 
            font-family: 'Poppins', sans-serif; 
        }
        .chart-toggle-btn.active { background: white; color: var(--pt-green); box-shadow: var(--shadow-sm); }
        .chart-toggle-btn.active-cost { background: white; color: var(--chart-cost); box-shadow: var(--shadow-sm); }
        
        .chart-grid { position: absolute; top: 15px; left: 35px; right: 10px; bottom: 25px; display: flex; flex-direction: column; justify-content: space-between; pointer-events: none; z-index: 1; }
        .grid-line { width: 100%; border-top: 1px dashed #E5E7EB; height: 0; position: relative; }
        .grid-label { position: absolute; left: -28px; top: -6px; font-size: 9px; color: #9CA3AF; font-family: 'Poppins', sans-serif; }
        
        .chart-group { width: 7%; height: 100%; position: relative; z-index: 2; display: flex; align-items: flex-end; justify-content: center; gap: 2px; transition: transform 0.2s; }
        .chart-group:hover { transform: scaleY(1.02); }
        
        /* Modern Bars with Gradients/Radius */
        .bar-prev { 
            width: 35%; 
            background: #D1D5DB; 
            border-radius: 4px 4px 0 0; 
            height: 0%; 
            transition: height 0.6s cubic-bezier(0.34, 1.56, 0.64, 1); 
            opacity: 0.8; 
        }
        .bar-curr { 
            width: 35%; 
            background: linear-gradient(to top, var(--pt-green), var(--pt-green-light)); 
            border-radius: 4px 4px 0 0; 
            height: 0%; 
            transition: height 0.6s cubic-bezier(0.34, 1.56, 0.64, 1); 
            box-shadow: 0 -2px 5px rgba(0,0,0,0.05);
        }
        
        .bar-curr.single { width: 50%; } 
        .bar-curr.cost-mode { background: linear-gradient(to top, #0369a1, #38bdf8); }
        .bar-curr.over-budget { background: linear-gradient(to top, #991b1b, #f87171); }
                .bar-curr.opex-warn { background: linear-gradient(to top, #f59e0b, #fbbf24); }
.bar-curr.ready-fail { background: linear-gradient(to top, #991b1b, #f87171); }
        .bar-curr.iot-mode { background: linear-gradient(to top, #065f46, #34d399); }
        .bar-curr.work-mode { background: linear-gradient(to top, #854d0e, #ca8a04); }
        .bar-curr.happy-mode { background: linear-gradient(to top, #b45309, #fbbf24); }
        .bar-curr.co2-mode { background: linear-gradient(to top, #14532d, #4ade80); }
        
        .target-line-90 { position: absolute; bottom: 90%; left: 35px; right: 10px; border-top: 2px dashed var(--pt-gold); z-index: 5; pointer-events: none; opacity: 0.8; }
        .target-line-4 { position: absolute; bottom: 40%; left: 35px; right: 10px; border-top: 2px dashed var(--pt-gold); z-index: 5; pointer-events: none; }
        .target-label-90 { position: absolute; right: 0; top: -20px; font-size: 13px; color: var(--pt-gold); font-weight: bold; background: #fff; padding: 2px 6px; border-radius: 4px; box-shadow: var(--shadow-sm); border: 1px solid #f3f4f6; }
        
        .group-label { position: absolute; bottom: -22px; left: 50%; transform: translateX(-50%); font-size: 13px; color: #6B7280; font-weight: 600; font-family: 'Poppins', sans-serif; }
        
        .tooltip { 
            position: absolute; top: -30px; left: 50%; transform: translateX(-50%); 
            background: #1F2937; color: white; 
            font-size: 13px; padding: 4px 8px; border-radius: 4px; 
            white-space: nowrap; opacity: 0; transition: opacity 0.2s; 
            pointer-events: none; z-index: 10; box-shadow: var(--shadow-md); 
        }
        .chart-group:hover .tooltip { opacity: 1; top: -35px; }
        
        .legend { position: absolute; top: 8px; right: 10px; display: flex; gap: 12px; background: rgba(255,255,255,0.8); padding: 4px 8px; border-radius: 6px; }
        .legend-item { display: flex; align-items: center; gap: 6px; font-size: 13px; color: #6B7280; font-weight: 500; }
        .dot { width: 10px; height: 10px; border-radius: 3px; }
        .line-dash-gray { width: 18px; height: 0; border-top: 2px dashed #9ca3af; }

        .dot.prev { background: #D1D5DB; }
        .dot.curr { background: var(--pt-green); }
        .dot.curr-cost { background: #0369a1; } 
        .dot.curr-ot { background: #10B981; } 
        .dot.curr-ready { background: #10B981; }
        .dot.curr-iot { background: #059669; }
        .dot.curr-work { background: #d97706; }
        .dot.curr-happy { background: #f59e0b; }
        .dot.curr-co2 { background: #16a34a; }
        .line-dash { width: 15px; height: 2px; border-bottom: 2px dashed var(--pt-gold); }
        
        /* Title Slide Modern */
        .title-slide { 
            background: rgb(0, 104, 55);
            background: linear-gradient(135deg, rgba(31, 41, 55, 0.95), rgba(0, 104, 55, 0.9)), url('https://source.unsplash.com/1600x900/?building,hospital'); 
            background-size: cover; background-position: center; 
            justify-content: center; align-items: center; text-align: center; 
        }
        .title-slide h1 { 
            color: white; font-size: 72px; margin: 0 0 20px 0; 
            text-shadow: 0 10px 30px rgba(0,0,0,0.3); 
            font-weight: 700; letter-spacing: -1px; 
        }
        .title-slide p { color: #E5E7EB; font-size: 32px; font-weight: 300; letter-spacing: 1px; }
        .title-tag { 
            background: linear-gradient(135deg, var(--pt-gold), #b08d4d); 
            color: white; padding: 12px 40px; 
            font-weight: 600; font-size: 22px; 
            border-radius: 100px; margin-top: 50px; 
            box-shadow: 0 10px 20px rgba(0,0,0,0.2); 
            text-transform: uppercase; letter-spacing: 2px;
        }

        /* --- EXPORT MODE (disable gradients/filters for html2canvas stability) --- */
        .export-no-gradient *,
        .export-no-gradient *::before,
        .export-no-gradient *::after {
            background-image: none !important;
            filter: none !important;
            backdrop-filter: none !important;
        }
        /* Keep key surfaces readable when gradients are removed */
        .export-no-gradient .title-slide { background-color: #111827 !important; }
        .export-no-gradient .slide { background-color: #ffffff !important; }
        .export-no-gradient .kpi-code { background: var(--pt-gold) !important; color: #ffffff !important; }
        .export-no-gradient .kpi-card::before { background: none !important; }
        .export-no-gradient .bar-curr { background: var(--pt-green) !important; }
        .export-no-gradient .bar-prev { background: #9CA3AF !important; }

/* ===== STANDARDIZE ALL CHARTS: USE A SINGLE PLOT AREA (Fix 100% bar not reaching 100%) ===== */
.chart-container{
  flex-grow: 1;
  background: #fff;
  border-radius: 12px;
  position: relative;
  display: flex;
  align-items: stretch;
  justify-content: stretch;
  border: 1px solid #86f1ae;
  padding: 0 !important; /* IMPORTANT: plot-area handles inner padding */
}

.plot-area{
  position: absolute;
  top: 30px;     /* formerly chart-container padding-top */
  right: 10px;   /* formerly padding-right */
  bottom: 25px;  /* formerly padding-bottom */
  left: 35px;    /* formerly padding-left */
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
}

.plot-area .chart-grid{
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  pointer-events: none;
  z-index: 1;
}

.plot-area .bars-area{
  display: flex;
  justify-content: space-between;
  width: 100%;
  height: 100%;
  position: relative;
  z-index: 2;
}

.plot-area .target-line-90{
  position: absolute;
  bottom: 90%;
  left: 0;
  right: 0;
  border-top: 2px dashed var(--pt-gold);
  z-index: 5;
  pointer-events: none;
  opacity: 0.8;
}

.plot-area .target-line-4{
  position: absolute;
  bottom: 40%;
  left: 0;
  right: 0;
  border-top: 2px dashed var(--pt-gold);
  z-index: 5;
  pointer-events: none;
}

/* ===== STAT-CARD COLOR STANDARD (Icon + Value use the same color on every slide) ===== */
.stat-card{
  --stat-color: var(--pt-green);
  --stat-bg: rgba(0, 104, 55, 0.08);
}
.stat-card .stat-icon{
  color: var(--stat-color) !important;
  background: var(--stat-bg) !important;
}
.stat-card .stat-content .stat-value{
  color: var(--stat-color) !important;
}

/* ===== Highlight Selected Month (EXPORT-SAFE) ===== */
/* ใช้ border จริง (ไม่ใช้ ::after) เพื่อให้ html2canvas วาดได้เสถียร */
.month-row.highlight-month{
  position: relative;
  z-index: 5;
  background: rgba(14, 165, 233, 0.1);
  border: 4px solid #EF4444;
  border-radius: 18px;
  overflow: hidden;          /* ให้มุมโค้งกินทุก cell */
  margin: 2px 0;             /* กันโดน clip ใน container ที่ scroll */

}

/* ทำให้ช่องเดือนซ้ายกลืนกับพื้นหลัง */
.month-row.highlight-month .month-label,
.month-row.highlight-month .month-input{
    color: #0369a1;
  font-weight: 700;
}


/* ===== Modal (Popup) ===== */
.month-modal{
  position: fixed; inset: 0;
  background: rgba(17, 24, 39, 0.65);
  display: none;
  align-items: center; justify-content: center;
  z-index: 10001;
}
.month-modal.show{ display:flex; }
.month-modal-card{
  width: 360px;
  background:#fff;
  border-radius: 16px;
  padding: 18px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
  border: 1px solid #E5E7EB;
    max-width: calc(100vw - 60px);
}
.month-modal-title{
  font-weight: 800;
  color: #111827;
  margin-bottom: 12px;
}
.month-select{
  width:93%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #E5E7EB;
  font-family: 'Poppins','Sarabun',sans-serif;
  font-size: 14px;
}
.month-modal-actions{
  display:flex;
  justify-content:flex-end;
  gap:10px;
  margin-top: 14px;
}
.btn-secondary, .btn-primary{
  border: none;
  padding: 10px 14px;
  border-radius: 10px;
  cursor:pointer;
  font-weight: 700;
}
.btn-secondary{ background:#F3F4F6; color:#374151; }
.btn-primary{ background:#006837; color:#fff; }





        /* KPI1 value labels on bars */
        .bar-prev, .bar-curr { position: relative; }
        .bar-top-label{
            position: absolute;
            top: -16px;
            left: 50%;
            transform: translateX(-50%);
            font-size: 10px;
            font-weight: 700;
            color: #374151;
            white-space: nowrap;
            pointer-events: none;
            opacity: 0.95;
        }


/* ===== Highlight Selected Month (BAR) ===== */
.chart-group.highlight-bar .bar-curr{
  background: linear-gradient(to top, var(--pt-gold), var(--pt-gold-light));
}
/* export mode (ถ้าใช้ export-no-gradient) ให้ยังเป็นทอง */
.export-no-gradient .chart-group.highlight-bar .bar-curr{
  background-image: none !important;
  background: var(--pt-gold) !important;
}

/* --- ANIMATION STYLES (เพิ่มต่อท้ายไฟล์ style.css) --- */

/* 1. ตั้งค่าเริ่มต้น: ถ้า Slide ยังไม่ Active ให้กราฟหดเหลือ 0 */
.slide-container:not(.active-slide) .bar-curr, 
.slide-container:not(.active-slide) .bar-prev {
    height: 0 !important; /* บังคับให้สูง 0 */
    transition: none; /* ไม่ต้องมี transition ตอนรีเซ็ต */
}

/* 2. เมื่อ Active: ให้กราฟค่อยๆ ยืดขึ้นมา (Growth Animation) */
.slide-container.active-slide .bar-curr,
.slide-container.active-slide .bar-prev {
    transition: height 1.5s cubic-bezier(0.22, 1, 0.36, 1); /* เอฟเฟกต์เด้งดึ๋งเล็กน้อย */
}

/* 3. ตัวเลข: เตรียม Animation แบบ Fade In + Slide Up */
.slide-container:not(.active-slide) .stat-value,
.slide-container:not(.active-slide) .status-val {
    opacity: 0;
    transform: translateY(20px); /* เลื่อนลงไปข้างล่างรอไว้ */
}

.slide-container.active-slide .stat-value,
.slide-container.active-slide .status-val {
    opacity: 1;
    transform: translateY(0);
    transition: all 0.8s ease-out;
    transition-delay: 0.3s; /* รอให้กราฟขึ้นก่อนนิดนึงค่อยโผล่ */
}

/* ===== MOBILE RESPONSIVE (< 768px) ===== */
@media (max-width: 767px) {
    body {
        padding: 0;
        gap: 0;
        align-items: flex-start;
        overflow-x: hidden;
    }

    .slide-container {
        transform-origin: top left;
        flex-shrink: 0;
    }

    /* ซ่อนปุ่ม scroll up/down บนมือถือ */
    .fab-scroll-up,
    .fab-scroll-down {
        display: none;
    }
}

</style>