/* ============================================================
   Year (รายปี) Report styles — pivot table 12 เดือน
   ============================================================ */

.year-report-container {
    padding: 16px 20px;
    background: #fafafa;
    min-height: 200px;
}

.year-report-header {
    margin-bottom: 12px;
    border-bottom: 2px solid #2196f3;
    padding-bottom: 6px;
}

.year-report-header h2 {
    margin: 0;
    font-size: 18px;
    color: #1565c0;
}

.year-report-sub {
    font-size: 13px;
    color: #666;
    margin-top: 2px;
}

.year-loading,
.year-error {
    padding: 30px;
    text-align: center;
    color: #888;
    font-size: 14px;
}
.year-error { color: #c62828; }

/* ----- Pivot table ----- */
.year-pivot-wrap {
    overflow-x: auto;
    background: white;
    border-radius: 6px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.08);
    padding: 8px;
}

.year-pivot-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    font-family: 'Sarabun', 'Tahoma', sans-serif;
}

.year-pivot-table th {
    background: linear-gradient(135deg, #1976d2 0%, #1565c0 100%);
    color: white;
    padding: 8px 6px;
    text-align: center;
    font-weight: 600;
    border: 1px solid #0d47a1;
    position: sticky;
    top: 0;
    white-space: nowrap;
    font-size: 12px;
}

.year-pivot-table td {
    padding: 6px 8px;
    border: 1px solid #e0e0e0;
    white-space: nowrap;
}

.year-pivot-table td.idx {
    text-align: center;
    color: #999;
    width: 36px;
    font-size: 12px;
}

.year-pivot-table td.name {
    font-weight: 500;
    color: #333;
    min-width: 140px;
}

.year-pivot-table td.num {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.year-pivot-table td.total {
    background: #fff3e0;
    font-weight: 600;
    color: #e65100;
}

.year-pivot-table td.grand-total {
    background: #ffe0b2;
    font-weight: 700;
    color: #bf360c;
}

.year-pivot-table td.diff {
    color: #5d4037;
    font-style: italic;
}

.year-pivot-table tr:nth-child(even) td:not(.total):not(.grand-total) {
    background: #fafafa;
}

.year-pivot-table tr:hover td:not(.total):not(.grand-total) {
    background: #e3f2fd;
}

.year-pivot-table tfoot td {
    border-top: 2px solid #2196f3;
    background: #fff8e1;
    font-weight: 600;
}

/* heatmap mode */
.year-pivot-table.heatmap td.num {
    transition: background 0.2s;
}

/* ----- Sidebar tab "รายปี" ----- */
.sidebar-tab[data-sidebar="year"] {
    /* ใช้ style เดิมจาก .sidebar-tab — ไม่ต้องเพิ่ม */
}

.year-list .tree-item.leaf.active > .tree-label {
    background: #2196f3;
    color: white;
    border-radius: 4px;
    padding: 2px 6px;
}

.year-list .tree-item.leaf {
    cursor: pointer;
    padding: 2px 0;
}

.year-list .tree-item.leaf:hover > .tree-label {
    background: #e3f2fd;
    border-radius: 4px;
}

/* ----- Responsive ----- */
@media (max-width: 768px) {
    .year-pivot-table { font-size: 11px; }
    .year-pivot-table th { padding: 4px 3px; font-size: 10px; }
    .year-pivot-table td { padding: 4px 5px; }
}
