:root {
    /* BMA CI Colors */
    --color-primary: #00744B;
    --color-primary-dark: #004D33;
    --color-primary-light: #E8F5E9;
    --color-accent: #D4A843;
    --color-danger: #E53935;
    --color-warning: #FFB300;
    
    /* Neutral Colors */
    --color-bg: #F4F6F8;
    --color-surface: rgba(255, 255, 255, 0.95);
    --color-text-main: #1F2937;
    --color-text-muted: #6B7280;
    --color-border: rgba(229, 231, 235, 0.8);
    
    /* Effects */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --radius-md: 0.5rem;
    --radius-lg: 1rem;
    --transition-fast: 0.15s ease-in-out;
    --transition-normal: 0.3s ease-in-out;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Noto Sans Thai', 'Inter', sans-serif;
    background-color: var(--color-bg);
    color: var(--color-text-main);
    line-height: 1.5;
    min-height: 100vh;
}

/* Header */
.app-header {
    background: linear-gradient(135deg, var(--color-primary-dark) 0%, var(--color-primary) 100%);
    color: white;
    padding: 1.75rem 1.5rem 2.5rem;
    box-shadow: var(--shadow-md);
}

.header-container {
    max-width: 1280px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1.25rem;
}

.header-brand {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.header-logo {
    height: 65px;
    width: 65px;
    object-fit: cover;
    border-radius: 50%;
    background: #ffffff;
    padding: 2px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

.header-titles h1 {
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 0.2rem;
    text-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

.header-titles h2 {
    font-size: 1.05rem;
    font-weight: 400;
    color: var(--color-primary-light);
}

.header-meta {
    font-size: 0.875rem;
}

.live-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(5px);
    padding: 0.4rem 0.85rem;
    border-radius: 20px;
    font-size: 0.825rem;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.live-dot {
    width: 8px;
    height: 8px;
    background-color: #00E676;
    border-radius: 50%;
    display: inline-block;
    box-shadow: 0 0 8px #00E676;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(0, 230, 118, 0.7); }
    70% { transform: scale(1); box-shadow: 0 0 0 8px rgba(0, 230, 118, 0); }
    100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(0, 230, 118, 0); }
}

/* Main Layout */
.dashboard-container {
    max-width: 1280px;
    margin: -1.75rem auto 2.5rem;
    padding: 0 1.5rem;
    position: relative;
    z-index: 10;
}

/* Cards & Glassmorphism */
.card {
    background: var(--color-surface);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

/* Summary Cards */
.summary-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.75rem;
}

.summary-card {
    display: flex;
    align-items: center;
    padding: 1.35rem 1.25rem;
    gap: 1rem;
}

.summary-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

.card-icon {
    font-size: 2.25rem;
    background: var(--color-primary-light);
    width: 54px;
    height: 54px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    flex-shrink: 0;
}

.summary-card.success .card-icon { background: rgba(0, 116, 75, 0.12); }
.summary-card.warning .card-icon { background: rgba(255, 179, 0, 0.12); }
.summary-card.danger .card-icon { background: rgba(229, 57, 53, 0.12); }

.card-content {
    flex: 1;
}

.card-content h3 {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    font-weight: 600;
    margin-bottom: 0.2rem;
}

.card-value {
    font-size: 1.85rem;
    font-weight: 700;
    line-height: 1.2;
}

.card-subtext {
    font-size: 0.75rem;
    color: var(--color-text-muted);
    margin-top: 0.2rem;
}

.card-trend {
    font-size: 0.8rem;
    margin-top: 0.25rem;
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-weight: 500;
}

.trend-up { color: var(--color-primary); }
.trend-down { color: var(--color-danger); }
.trend-neutral { color: var(--color-text-muted); }

/* Content Grid */
.content-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
}

@media (max-width: 1024px) {
    .content-grid {
        grid-template-columns: 1fr;
    }
}

/* Sections */
.division-section, .chart-section {
    padding: 1.5rem;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.section-header h3, .chart-section h3 {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--color-primary-dark);
}

.chart-section h3 {
    margin-bottom: 1.25rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem;
    border: none;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-primary {
    background-color: var(--color-primary);
    color: white;
    box-shadow: 0 2px 4px rgba(0, 116, 75, 0.2);
}

.btn-primary:hover {
    background-color: var(--color-primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 116, 75, 0.3);
}

/* Tables */
.table-container {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    text-align: left;
}

th, td {
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--color-border);
}

th {
    background-color: rgba(243, 244, 246, 0.8);
    font-weight: 700;
    color: var(--color-text-main);
    font-size: 0.825rem;
    white-space: nowrap;
}

tbody tr.summary-row:hover {
    background-color: rgba(0, 116, 75, 0.04);
}

/* Progress Bar */
.progress-cell {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 130px;
}

.progress-bar-bg {
    flex: 1;
    height: 10px;
    background-color: #E5E7EB;
    border-radius: 5px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #00744B 0%, #00A86B 100%);
    border-radius: 5px;
    transition: width 0.8s ease-out;
}

.progress-text {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--color-primary-dark);
    min-width: 42px;
}

/* Chart Container */
.chart-container {
    position: relative;
    height: 320px;
    width: 100%;
}

.text-center { text-align: center; }

@media (max-width: 640px) {
    .header-brand {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
    .header-logo {
        height: 50px;
        width: 50px;
    }
    .header-titles h1 {
        font-size: 1.35rem;
    }
    .summary-cards {
        grid-template-columns: 1fr;
    }
}
