/* Copied style.css into assets for better file management */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');

:root {
    --bg-color: #fdfcf7; /* Soft cream */
    --primary-color: #f4f0e8; /* Lighter beige for cards/modules */
    --accent-color: #d4af37; /* Muted gold for highlights - not used directly, but for reference */
    --text-color: #333333;
    --border-color: #e0e0e0;
    --shadow-color: rgba(0, 0, 0, 0.05);
    --sidebar-bg: #ffffff;
    --header-bg: #ffffff;
}

body {
    font-family: 'Poppins', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    font-size: 14px;
    display: flex;
    min-height: 100vh; /* allow natural page growth and scrolling */
}

h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
}

a {
    text-decoration: none;
    color: var(--text-color);
}

.login-container {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 100vh;
    background-color: var(--bg-color);
}

.login-box {
    background-color: var(--primary-color);
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 10px 25px var(--shadow-color);
    text-align: center;
    width: 320px;
    position: relative;
}

.login-box .logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 30px;
}

.login-box .logo img {
    height: 40px;
    flex-shrink: 0;
}

.login-box .logo span {
    font-weight: 600;
    font-size: 16px;
    line-height: 1.2;
    text-align: left;
}

.login-box input {
    width: 100%;
    padding: 12px;
    margin-bottom: 15px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-sizing: border-box;
    background-color: #fff;
}

.password-field-wrapper {
    position: relative;
    width: 100%;
    margin-bottom: 15px;
}

.password-field-wrapper input {
    width: 100%;
    padding: 12px 45px 12px 12px;
    margin-bottom: 0;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    box-sizing: border-box;
    background-color: #fff;
    line-height: normal;
}

.toggle-password {
    position: absolute;
    right: 4px;
    top: 22px;
    bottom: 0;
    margin: auto 0;
    height: fit-content;
    background: none !important;
    border: none !important;
    cursor: pointer;
    padding: 6px 8px !important;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #888 !important;
    transition: color 0.2s ease;
    width: auto !important;
    border-radius: 4px !important;
}

.toggle-password:hover {
    color: #333 !important;
    background-color: rgba(0,0,0,0.05) !important;
}

.toggle-password:focus {
    outline: 2px solid #d4af37;
    outline-offset: 2px;
}

.login-box button[type="submit"] {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 8px;
    background-color: var(--text-color);
    color: #fff;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s, opacity 0.3s;
}

.login-box button[type="submit"]:hover {
    background-color: #555;
}

.login-box button[type="submit"]:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

/* Loading overlay for login */
.loading-overlay {
    display: none;
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0.95);
    border-radius: 12px;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 12px;
    z-index: 50;
    backdrop-filter: blur(2px);
}
.loading-overlay.visible { 
    display: flex; 
    animation: fadeIn 0.3s ease-in;
}

.spinner {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 4px solid rgba(0,0,0,0.1);
    border-top-color: var(--text-color);
    animation: spin 0.8s linear infinite;
}
.loader-text { 
    color: #333; 
    font-weight: 600; 
    font-size: 14px;
}

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeIn { 
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Notification styles */
.notify-success, .notify {
    max-width: 720px;
    margin: 0 auto 18px;
    padding: 14px 20px;
    border-radius: 8px;
    font-weight: 600;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    animation: slideInDown 0.4s ease-out;
}
.notify-success { 
    background: linear-gradient(135deg, #e6ffed 0%, #d4f5dc 100%); 
    color: #0b6a2e; 
    border: 1px solid #bff0c9;
}
.notify { 
    background: linear-gradient(135deg, #fff8e6 0%, #ffe8c3 100%); 
    color: #7a5b00; 
    border: 1px solid #ffe8a8; 
}

@keyframes slideInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.admin-login {
    margin-top: 20px;
    font-size: 12px;
}

.admin-login a {
    color: #888;
    text-decoration: none;
}

.admin-login a:hover {
    text-decoration: underline;
}

.sidebar {
    width: 240px;
    background-color: var(--sidebar-bg);
    padding: 20px;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border-color);
    box-shadow: 5px 0 15px var(--shadow-color);
    z-index: 10;
}

/* Ensure sidebar is a positioned container so we can pin the version to the bottom */
.sidebar {
    /* Keep the sidebar visible while the main content scrolls */
    position: sticky;
    top: 0;
    align-self: flex-start;
    height: 100vh;
    padding-bottom: 72px; /* room for bottom-aligned version (give a bit more space)	*/
    overflow-y: auto;
    box-sizing: border-box; /* include padding in height calculation to avoid tiny overflow */
    /* Hide native scrollbar visually but keep scrolling functional */
    -ms-overflow-style: none; /* IE and Edge */
    scrollbar-width: none; /* Firefox */
}

.sidebar::-webkit-scrollbar { display: none; }

.sidebar .logo {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 10px 20px 10px;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 20px;
}

.sidebar .logo img {
    height: 35px;
    flex-shrink: 0;
}

/* Skeleton / shimmer placeholder for logos */
.skeleton-img-wrapper {
    position: relative;
    display: inline-block;
    vertical-align: middle;
    overflow: hidden;
    border-radius: 6px;
    background: linear-gradient(90deg, rgba(255,255,255,0.02), rgba(0,0,0,0.02));
}
.skeleton-img-wrapper .skeleton-shimmer {
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, #f3f3f3 0%, #e9e9e9 50%, #f3f3f3 100%);
    background-size: 200% 100%;
    animation: shimmer 1.2s linear infinite;
    z-index: 1;
}
.skeleton-img-wrapper .skeleton-shimmer.hidden {
    opacity: 0;
    transition: opacity 0.25s ease-out;
    pointer-events: none;
}
.skeleton-img {
    display: block;
    position: relative;
    z-index: 2;
    opacity: 0;
    transform: translateZ(0);
    transition: opacity 0.35s ease-in, transform 0.35s ease-in;
}
.skeleton-img.loaded {
    opacity: 1;
}

@keyframes shimmer {
    0% { background-position: -100% 0; }
    100% { background-position: 100% 0; }
}

/* Small error state: show a subtle border if logo fails to load */
.skeleton-img-wrapper.error {
    border: 1px dashed #e0b4b4;
}

.sidebar .logo span {
    font-weight: 600;
    font-size: 14px;
    line-height: 1.2;
}

.sidebar nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.sidebar nav li a {
    display: block;
    padding: 12px 15px;
    border-radius: 8px;
    margin-bottom: 5px;
    font-weight: 500;
    transition: background-color 0.2s, color 0.2s;
}

.sidebar nav li a.active,
.sidebar nav li a:hover {
    background-color: var(--primary-color);
    color: var(--text-color);
}

/* Sidebar version badge positioned at the bottom-left of the sidebar */
.sidebar-version {
    position: absolute;
    bottom: 12px;
    left: 12px;
    right: 12px;
    font-size: 0.9em;
    color: #666;
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: visible; /* allow inner <main> to scroll while sidebar stays fixed */
}

header.top-nav {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    padding: 15px 30px;
    background-color: var(--header-bg);
    border-bottom: 1px solid var(--border-color);
    height: 50px;
}

.user-menu {
    font-weight: 500;
}

.user-menu a {
    color: #888;
    margin-left: 15px;
}

main {
    flex: 1;
    padding: 30px;
    overflow-y: auto;
}

.page-header {
    margin-bottom: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
}

.page-header h1 {
    font-size: 28px;
    margin: 0;
    flex: 1;
}

/* Date status badge shown next to the page date (Recorded / Not recorded) */
.page-header .date-status {
    margin-left: 12px;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    vertical-align: middle;
}
.page-header .date-status.recorded {
    background: #e6ffed;
    color: #0b6a2e;
    border: 1px solid #bff0c9;
}
.page-header .date-status.not-recorded {
    background: #fff4f4;
    color: #8a1d1d;
    border: 1px solid #f5c6c6;
}

/* Confirmation modal for final submit */
.confirm-modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    overflow-y: auto;
}
.confirm-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(2px);
    z-index: 9998;
}
.confirm-modal-panel {
    position: relative;
    background: #fff;
    padding: 24px 28px;
    border-radius: 12px;
    box-shadow: 0 12px 40px rgba(0,0,0,0.2);
    max-width: 480px;
    width: 90%;
    margin: 20px;
    z-index: 10000;
    text-align: left;
    animation: modalFadeIn 0.2s ease-out;
}
@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(-10px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}
.confirm-modal-panel h3 { margin-top: 0; margin-bottom: 8px; font-size: 20px; }
.confirm-actions { display:flex; gap:12px; justify-content:flex-end; margin-top:20px; }

/* Loading overlay reuse styles are in .loading-overlay; ensure top-level overlay covers the form area */
#report-loading-overlay.loading-overlay { position: fixed; inset: 0; border-radius: 0; z-index: 200; }

.kpi-cards {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

.card {
    background-color: #fff;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 15px var(--shadow-color);
    border: 1px solid var(--border-color);
}

.card .card-title {
    font-size: 14px;
    font-weight: 500;
    color: #666;
    margin-bottom: 10px;
}

.card .card-value {
    font-size: 28px;
    font-weight: 600;
}

/* Dashboard improvements: center KPI values and add subtle hover for cards */
.kpi-cards .card {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start; /* keep title left-aligned */
    gap: 8px;
    padding: 22px;
}
.kpi-cards .card .card-title { color: #444; }
.kpi-cards .card .card-value { font-size: 25px; color: #111; }

/* Print header is only for printed output — hide on-screen */
.print-header { display: none; }

/* Date filter controls on dashboard */
.date-filters { margin: 12px 0 20px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.filter-btn { display: inline-block; padding: 6px 6px; border-radius: 6px; border: 1px solid rgba(75, 75, 75, 0.466); background: #ffeecda2; color: #444; font-weight: 600; text-decoration: none; }
.filter-btn:hover { background: #f4f2ee; border-color: var(--border-color); }
.filter-btn.active { background: #111; color: #fff; }
.filter-current { color: #666; margin-left: 8px; font-size: 13px; }

/* Account/category filter styling (compact, pill-like, blends with date filters) */
.account-filters { display: flex; gap: 8px; align-items: center; margin-top: 6px; margin-left: 0; margin-bottom: 15px; width: 100%; justify-content: flex-start; }
.account-btn { padding: 6px 12px; border-radius: 999px; font-size: 9px; color: #555; background: #fff4df9e; border: 1px solid transparent; font-weight: 600; text-decoration: none; }
.account-btn:hover { background: #f4f2ee; border-color: var(--border-color); }
.account-btn.active { background: #111; color: #fff; box-shadow: none; }

/* When space is tight, allow account filters to wrap under date filters gracefully */
@media (max-width: 720px) {
    .date-filters { gap: 6px; }
    .account-filters { margin-left: 0; width: 100%; justify-content: flex-start; }
    .account-btn { padding: 6px 8px; font-size: 12px; }
}

/* Print styles: make reports clean and printer-friendly */
@media print {
    /* General cleanup */
    body { background: #fff !important; color: #000 !important; }
    .sidebar, header.top-nav, .notify, .notify-success, .loading-overlay, .btn, .card-actions, .admin-login { display: none !important; }
    .main-content, main { padding: 12mm !important; }
    .page-header { display: none; }

    /* Print header visible only in print */
    .print-header { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; border-bottom: 1px solid #ccc; padding-bottom: 8px; }
    .print-header img { display: inline-block; vertical-align: middle; }
    .print-title { font-size: 16pt; font-weight: 700; }
    .print-sub { font-size: 10pt; color: #333; }

    /* Cards: remove shadows, full width, conservative spacing */
    .report-grid { display: block !important; }
    .report-card { box-shadow: none !important; border: 1px solid #ddd !important; background: #fff !important; margin-bottom: 8px !important; page-break-inside: avoid; }
    .report-card h3 { font-size: 12pt; margin: 8px 12px; }
    .card-body { padding: 8px 12px !important; }

    /* KPI values slightly larger for print readability */
    .kpi-value { font-size: 14pt !important; }

    /* Small tables: make rows appear as two-column table with clear separators */
    .small-table .row { display: flex; justify-content: space-between; border-bottom: 1px solid #eee; padding: 6px 0; }
    .small-table .row span:first-child { font-weight: 600; }

    /* Ensure no awkward page breaks inside summary grid */
    .summary-grid { display: flex; flex-wrap: wrap; gap: 8px; }
    .summary-grid > div { flex: 1 1 45%; }

    /* Make text black and remove background colors */
    * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }

    /* Prevent printing of interactive elements */
    a[href]:after { content: ""; }

    /* Hide scrollbars in print preview/output */
    html, body { overflow: hidden !important; }
    /* WebKit-based browsers: explicitly hide scrollbars */
    *::-webkit-scrollbar { display: none !important; }

    /* Footer spacing: avoid cutting off last card */
    .sidebar-version { display: none; }

    /* Add top margin to body content to account for print header (if fixed) */
    @page { margin: 12mm; }
}

.card { transition: transform 0.12s ease, box-shadow 0.12s ease; }
.card:hover { transform: translateY(-4px); box-shadow: 0 12px 30px rgba(0,0,0,0.08); }

/* Chart header styling */
.chart-container .chart-header {
    font-weight: 700;
    font-size: 15px;
    color: #222;
    margin-bottom: 12px;
}

/* Slightly larger pie chart area on large screens */
.pie-charts .chart-container { height: 280px; }

/* Make canvas take available container height more reliably */
.chart-container canvas { width: 100% !important; height: 100% !important; display: block; box-sizing: border-box; }

/* Ensure chart area has a comfortable inner margin on small screens */
.chart-container { padding: 30px; }

/* On very narrow screens reduce padding slightly to keep charts usable */
@media (max-width: 700px) {
    .chart-container { padding: 14px; }
}

/* Ensure there's minimum height so charts don't shrink too small and labels remain visible */
.chart-container { min-height: 300px; }

.chart-container canvas { display: block; max-height: 520px; }

/* Make chart headers slightly smaller on narrow screens to preserve space */
@media (max-width: 700px) {
    .chart-container .chart-header { font-size: 14px; }
}

/* Admin alert for missing monthly target */
.alert-not-recorded {
    margin: 10px 0 20px;
    padding: 12px;
    border-radius: 8px;
    background: #fff4e5;
    border: 1px solid #ffd7a8;
    color: #6a4a00;
    font-weight: 500;
}
.alert-not-recorded a {
    text-decoration: underline;
    color: #6a4a00;
    font-weight: 600;
}

.charts-section {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
}

.chart-container {
    background-color: #fff;
    padding: 20px;
    border-radius: 12px;
    box-shadow: 0 4px 15px var(--shadow-color);
    border: 1px solid var(--border-color);
    height: 300px;
    display: flex;
    flex-direction: column;
}

.chart-container.full-width {
    grid-column: 1 / -1;
}

.chart-container .chart-header {
    font-weight: 600;
    margin-bottom: 15px;
}

.chart-placeholder {
    flex: 1;
    background-color: var(--primary-color);
    border-radius: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #aaa;
    font-style: italic;
}

.notify-success, .notify {
    position: fixed;
    top: 66px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 60;
    max-width: 760px;
}

.pie-charts {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

.summary-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.form-container {
    max-width: 800px;
}

.form-section {
    background-color: #fff;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 4px 15px var(--shadow-color);
    border: 1px solid var(--border-color);
    margin-bottom: 30px;
}

.form-section h3 {
    font-size: 18px;
    margin-top: 0;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 10px;
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.form-field {
    display: flex;
    flex-direction: column;
}

.form-field label {
    font-weight: 500;
    margin-bottom: 8px;
    font-size: 13px;
}

.form-field input,
.form-field select {
    padding: 10px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background-color: #fff;
    font-family: 'Poppins', sans-serif;
}

.form-field input[disabled] {
    background-color: var(--primary-color);
    cursor: not-allowed;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.btn {
    padding: 12px 25px;
    border: none;
    border-radius: 8px;
    background-color: var(--text-color);
    color: #fff;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 0.3s;
}

.btn:hover {
    background-color: #555;
}

.history-controls {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 20px;
    padding: 20px;
    background: linear-gradient(135deg, rgba(244, 240, 232, 0.4) 0%, rgba(255, 255, 255, 0.4) 100%);
    border-radius: 10px;
    border: 1px solid rgba(212, 175, 55, 0.15);
    margin-bottom: 20px;
}

.filters-header {
    padding: 20px 20px 12px 20px;
    border-bottom: 1px solid var(--border-color);
}

.filters-header h3 {
    margin: 0;
    font-size: 16px;
    color: var(--text-color);
    display: flex;
    align-items: center;
}

.filter-section {
    flex: 1;
    display: flex;
    gap: 20px;
}

.date-range {
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}

.filter-label {
    font-size: 13px;
    font-weight: 600;
    color: #555;
    display: flex;
    align-items: center;
    margin-bottom: 4px;
}

.date-inputs {
    display: flex;
    align-items: center;
    gap: 12px;
}

.date-input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background-color: #fff;
    font-size: 14px;
    transition: all 0.2s ease;
    color: var(--text-color);
}

.date-input:focus {
    outline: none;
    border-color: #d4af37;
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.1);
}

.to-sep {
    color: #d4af37;
    font-size: 18px;
    font-weight: 600;
    padding: 0 4px;
}

.filter-actions {
    display: flex;
    gap: 10px;
    align-items: flex-end;
}

.btn-filter {
    background: linear-gradient(135deg, #d4af37 0%, #c49d2e 100%);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    font-size: 14px;
}

.btn-filter:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(212, 175, 55, 0.3);
    background: linear-gradient(135deg, #c49d2e 0%, #b38d26 100%);
}

.btn-clear {
    background-color: #fff;
    color: #666;
    border: 1px solid var(--border-color);
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    font-size: 14px;
}

.btn-clear:hover {
    background-color: #f5f5f5;
    border-color: #999;
    color: #333;
}

@media (max-width: 768px) {
    .history-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .filter-section {
        flex-direction: column;
    }
    
    .filter-actions {
        width: 100%;
    }
    
    .filter-actions .btn {
        flex: 1;
        justify-content: center;
    }
    
    .date-inputs {
        flex-direction: column;
        gap: 8px;
    }
    
    .to-sep {
        display: none;
    }
}

.btn-group {
    margin-left: auto;
    display: flex;
    gap: 10px;
    align-items: end;
}

.btn-secondary {
    background-color: #e0e0e0;
    color: #333;
    border: 1px solid #d0d0d0;
}

.link-like {
    background: none;
    border: none;
    color: #d00;
    cursor: pointer;
    padding: 0;
    font-weight: 600;
}

.table-container {
    background-color: #fff;
    border-radius: 12px;
    box-shadow: 0 4px 15px var(--shadow-color);
    border: 1px solid var(--border-color);
    overflow: hidden;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 15px;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
}

th {
    background-color: var(--primary-color);
    font-weight: 600;
}

tbody tr:last-child td {
    border-bottom: none;
}

tbody tr:hover {
    background-color: #f9f9f9;
}

.view-details-btn {
    font-weight: 600;
    color: var(--text-color);
    cursor: pointer;
}

/* Report detail improvements */
.report-grid {
    display: grid;
    grid-template-columns: 360px 1fr 1fr;
    gap: 20px;
}

.report-card {
    background-color: #fff;
    padding: 18px;
    border-radius: 12px;
    box-shadow: 0 6px 20px var(--shadow-color);
    border: 1px solid var(--border-color);
}

.report-card.summary {
    grid-column: 1 / 2;
}

.report-card h3 {
    margin-top: 0;
    margin-bottom: 12px;
}

.card-head {
    display:flex;
    justify-content:space-between;
    align-items:center;
}

.card-actions .btn,
.card-actions a.btn { margin-left: 8px; }

.card-body { padding-top: 8px; }

.summary-grid {
    display: grid;
    grid-template-columns: repeat(1, 1fr);
    gap: 12px;
}

.kpi-label { font-size: 12px; color: #666; }
.kpi-value { font-size: 20px; font-weight: 700; margin-top: 4px; }

.small-table .row { display:flex; justify-content:space-between; padding:8px 0; border-bottom: 1px dashed #eee; }
.small-table .row:last-child { border-bottom: none; }

/* Truncate long account labels in small tables and expose full name via native tooltip (title) */
.small-table .row span:first-child {
    display: inline-block;
    max-width: 170px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: middle;
    cursor: help; /* indicates hover tooltip */
}

@media (max-width: 1000px) {
    .report-grid { grid-template-columns: 1fr; }
    .report-card.summary { grid-column: auto; }
    .summary-grid { grid-template-columns: repeat(2, 1fr); }
}

@media print {
    header.top-nav, .sidebar, .btn, .card-actions, .page-actions { display: none !important; }
    main { padding: 0; }
}

/* Enhanced View Report Page Styles */
.page-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.btn-icon-text {
    display: inline-flex;
    align-items: center;
    padding: 10px 18px;
    border: none;
    border-radius: 8px;
    background-color: var(--text-color);
    color: #fff;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    font-size: 14px;
}

.btn-icon-text:hover {
    background-color: #555;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.summary-card {
    grid-column: 1 / -1 !important;
}

.summary-grid-enhanced {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-top: 12px;
}

.kpi-card {
    background: linear-gradient(135deg, #fafafa 0%, #ffffff 100%);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 18px;
    display: flex;
    gap: 14px;
    align-items: flex-start;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.kpi-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--accent-color);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.08);
}

.kpi-card:hover::before {
    opacity: 1;
}

.kpi-icon {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.kpi-primary .kpi-icon {
    background: linear-gradient(135deg, rgba(139, 115, 85, 0.15) 0%, rgba(139, 115, 85, 0.08) 100%);
    color: #8b7355;
}

.kpi-warning .kpi-icon {
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.15) 0%, rgba(212, 175, 55, 0.08) 100%);
    color: #d4af37;
}

.kpi-success .kpi-icon {
    background: linear-gradient(135deg, rgba(76, 175, 80, 0.15) 0%, rgba(76, 175, 80, 0.08) 100%);
    color: #4caf50;
}

.kpi-danger .kpi-icon {
    background: linear-gradient(135deg, rgba(139, 69, 19, 0.15) 0%, rgba(139, 69, 19, 0.08) 100%);
    color: #8b4513;
}

.kpi-info .kpi-icon {
    background: linear-gradient(135deg, rgba(33, 150, 243, 0.15) 0%, rgba(33, 150, 243, 0.08) 100%);
    color: #2196f3;
}

.kpi-content {
    flex: 1;
    min-width: 0;
}

.kpi-card .kpi-label {
    font-size: 12px;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
    font-weight: 600;
}

.kpi-card .kpi-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 4px;
    line-height: 1.2;
}

.kpi-sub {
    font-size: 11px;
    color: #999;
    margin-top: 4px;
}

.text-success {
    color: #4caf50 !important;
    font-weight: 600;
}

.text-danger {
    color: #8b4513 !important;
    font-weight: 600;
}

.progress-bar-container {
    width: 100%;
    height: 6px;
    background-color: rgba(0,0,0,0.08);
    border-radius: 3px;
    overflow: hidden;
    margin-top: 8px;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #d4af37 0%, #c49d2e 100%);
    transition: width 0.5s ease;
    border-radius: 3px;
}

.detail-card h3 {
    display: flex;
    align-items: center;
    font-size: 16px;
    color: var(--text-color);
    margin-bottom: 16px;
}

.breakdown-table {
    padding-top: 4px;
}

.breakdown-row {
    display: flex;
    justify-content: space-between;
    padding: 10px 12px;
    border-bottom: 1px solid rgba(0,0,0,0.05);
    transition: background-color 0.2s ease;
}

.breakdown-row:hover {
    background-color: rgba(139, 115, 85, 0.04);
}

.breakdown-row:last-child {
    border-bottom: none;
}

.breakdown-row.breakdown-total {
    background-color: rgba(212, 175, 55, 0.08);
    border-top: 2px solid var(--border-color);
    margin-top: 6px;
    padding: 12px;
}

.breakdown-label {
    color: #555;
    font-size: 14px;
}

.breakdown-value {
    color: var(--text-color);
    font-weight: 600;
    font-size: 14px;
}

.breakdown-total .breakdown-label,
.breakdown-total .breakdown-value {
    color: var(--text-color);
    font-size: 15px;
}

@media (max-width: 1000px) {
    .summary-grid-enhanced {
        grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    }
    
    .kpi-card .kpi-value {
        font-size: 20px;
    }
}

@media (max-width: 600px) {
    .page-actions {
        width: 100%;
        flex-direction: column;
    }
    
    .page-actions .btn,
    .page-actions .btn-icon-text {
        width: 100%;
        justify-content: center;
    }
    
    .summary-grid-enhanced {
        grid-template-columns: 1fr;
    }
}

/* Action buttons for history table */
.action-buttons {
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: flex-start;
}

.btn-icon {
    width: 32px;
    height: 32px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
    background-color: transparent;
}

.btn-icon svg {
    transition: transform 0.2s ease;
}

.btn-icon:hover svg {
    transform: scale(1.1);
}

.btn-icon.btn-view {
    color: #8b7355;
    background-color: rgba(139, 115, 85, 0.08);
    border-color: rgba(139, 115, 85, 0.15);
}

.btn-icon.btn-view:hover {
    background-color: rgba(139, 115, 85, 0.15);
    border-color: rgba(139, 115, 85, 0.25);
}

.btn-icon.btn-edit {
    color: #d4af37;
    background-color: rgba(212, 175, 55, 0.08);
    border-color: rgba(212, 175, 55, 0.15);
}

.btn-icon.btn-edit:hover {
    background-color: rgba(212, 175, 55, 0.15);
    border-color: rgba(212, 175, 55, 0.25);
}

.btn-icon.btn-delete {
    color: #a67c52;
    background-color: rgba(166, 124, 82, 0.08);
    border-color: rgba(166, 124, 82, 0.15);
}

.btn-icon.btn-delete:hover {
    color: #8b4513;
    background-color: rgba(139, 69, 19, 0.12);
    border-color: rgba(139, 69, 19, 0.2);
}

.btn-danger {
    background-color: #a67c52;
    color: white;
}

.btn-danger:hover {
    background-color: #8b4513;
}

/* Pagination styles */
.pagination-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
    flex-wrap: wrap;
    gap: 15px;
}

.pagination-info {
    color: #666;
    font-size: 14px;
}

.pagination {
    display: flex;
    gap: 6px;
    align-items: center;
}

.pagination-btn {
    padding: 8px 14px;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    background-color: #fff;
    color: var(--text-color);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s ease;
    min-width: 36px;
    text-align: center;
}

.pagination-btn:hover {
    background-color: rgba(139, 115, 85, 0.08);
    border-color: rgba(139, 115, 85, 0.25);
}

.pagination-btn.active {
    background-color: #d4af37;
    color: white;
    border-color: #d4af37;
}

.pagination-btn.active:hover {
    background-color: #c49d2e;
    border-color: #c49d2e;
}

.pagination-ellipsis {
    padding: 8px 4px;
    color: #999;
}

@media (max-width: 768px) {
    .pagination-container {
        flex-direction: column;
        align-items: stretch;
    }
    
    .pagination {
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .pagination-info {
        text-align: center;
    }
}
