:root {
    --bg: #f4f7fb;
    --card: #ffffff;
    --primary: #0f766e;
    --primary-dark: #0b2f35;
    --primary-soft: #dff7f3;
    --sidebar: #071f26;
    --sidebar-soft: #0d343d;
    --muted: #64748b;
    --border: #dbe3ee;
    --success: #15803d;
    --danger: #b91c1c;
    --warning: #b45309;
    --text: #0f172a;
    --sidebar-width: 280px;
    --topbar-height: 76px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    background: var(--bg);
    color: var(--text);
}
body.sidebar-open { overflow: hidden; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font-family: inherit; }

.app { min-height: 100vh; }

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 1000;
    width: var(--sidebar-width);
    height: 100vh;
    min-height: 0;
    display: flex;
    flex-direction: column;
    padding: 22px 16px 16px;
    color: #fff;
    background:
        radial-gradient(circle at top left, rgba(45, 212, 191, .14), transparent 34%),
        linear-gradient(180deg, var(--sidebar) 0%, #06191f 100%);
    border-right: 1px solid rgba(255, 255, 255, .08);
    box-shadow: 16px 0 40px rgba(2, 16, 23, .12);
    overflow: hidden;
}

.brand {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 2px 8px 20px;
    margin-bottom: 6px;
    border-bottom: 1px solid rgba(255, 255, 255, .09);
}
.brand-icon {
    width: 46px;
    height: 46px;
    flex: 0 0 46px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    color: #063c3b;
    background: linear-gradient(135deg, #ffffff, #99f6e4);
    box-shadow: 0 10px 24px rgba(45, 212, 191, .18);
    font-size: 16px;
    font-weight: 900;
    letter-spacing: .04em;
}
.brand-copy { min-width: 0; }
.brand-copy strong {
    display: block;
    font-size: 18px;
    line-height: 1.2;
    letter-spacing: .01em;
}
.brand-copy span {
    display: block;
    margin-top: 4px;
    color: #9fb8be;
    font-size: 11px;
    line-height: 1.2;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.sidebar nav {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 6px 5px 20px 2px;
    margin-right: -5px;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: rgba(153, 246, 228, .38) transparent;
}
.sidebar nav::-webkit-scrollbar { width: 6px; }
.sidebar nav::-webkit-scrollbar-track { background: transparent; }
.sidebar nav::-webkit-scrollbar-thumb {
    background: rgba(153, 246, 228, .32);
    border-radius: 999px;
}
.sidebar nav::-webkit-scrollbar-thumb:hover { background: rgba(153, 246, 228, .55); }

.sidebar-section-title {
    margin: 18px 12px 8px;
    color: #72949b;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .15em;
    text-transform: uppercase;
}
.sidebar-section-title:first-child { margin-top: 8px; }


.sidebar-menu-group {
    margin: 5px 0 8px;
}
.sidebar-group-toggle {
    width: 100%;
    min-height: 38px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin: 0 0 5px;
    padding: 8px 12px;
    border: 1px solid transparent;
    border-radius: 10px;
    color: #7f9fa6;
    background: transparent;
    font: inherit;
    font-size: 10.5px;
    font-weight: 800;
    letter-spacing: .12em;
    text-align: left;
    text-transform: uppercase;
    cursor: pointer;
    transition: color .18s ease, background .18s ease, border-color .18s ease;
}
.sidebar-group-toggle:hover,
.sidebar-menu-group.open > .sidebar-group-toggle {
    color: #d8f7f2;
    background: rgba(255, 255, 255, .055);
    border-color: rgba(153, 246, 228, .10);
}
.sidebar-group-chevron {
    width: 16px;
    height: 16px;
    flex: 0 0 16px;
    transition: transform .18s ease;
}
.sidebar-menu-group.open .sidebar-group-chevron {
    transform: rotate(180deg);
}
.sidebar-group-items {
    padding-left: 3px;
}
.sidebar-menu-group:not(.open) .sidebar-group-items {
    display: none;
}
.sidebar-group-items .sidebar-link {
    min-height: 43px;
}

.sidebar-link {
    position: relative;
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    gap: 11px;
    min-height: 46px;
    margin-bottom: 5px;
    padding: 8px 11px;
    border: 1px solid transparent;
    border-radius: 12px;
    color: #c7d7db;
    font-size: 13.5px;
    font-weight: 600;
    transition: background .18s ease, color .18s ease, border-color .18s ease, transform .18s ease;
}
.sidebar-link:hover {
    color: #fff;
    background: rgba(255, 255, 255, .07);
    transform: translateX(2px);
}
.sidebar-link.active {
    color: #fff;
    background: linear-gradient(90deg, rgba(20, 184, 166, .28), rgba(20, 184, 166, .10));
    border-color: rgba(94, 234, 212, .22);
    box-shadow: inset 3px 0 0 #5eead4, 0 8px 20px rgba(2, 16, 23, .16);
}
.sidebar-icon {
    width: 34px;
    height: 34px;
    min-width: 34px;
    max-width: 34px;
    min-height: 34px;
    max-height: 34px;
    overflow: hidden;
    flex: 0 0 34px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    color: #9cc1c5;
    background: rgba(255, 255, 255, .055);
    transition: color .18s ease, background .18s ease;
}
.sidebar-link:hover .sidebar-icon,
.sidebar-link.active .sidebar-icon {
    color: #5eead4;
    background: rgba(94, 234, 212, .12);
}
.sidebar-label {
    min-width: 0;
    line-height: 1.25;
}
.menu-icon {
    display: block !important;
    width: 18px !important;
    height: 18px !important;
    min-width: 18px !important;
    max-width: 18px !important;
    min-height: 18px !important;
    max-height: 18px !important;
    flex: 0 0 18px !important;
    overflow: visible;
}
.sidebar-icon > .menu-icon,
.sidebar-link svg {
    width: 18px !important;
    height: 18px !important;
    min-width: 18px !important;
    max-width: 18px !important;
    min-height: 18px !important;
    max-height: 18px !important;
}
.sidebar-version {
    flex: 0 0 auto;
    padding: 12px 10px 2px;
    color: #5f8087;
    border-top: 1px solid rgba(255, 255, 255, .08);
    font-size: 10px;
    text-align: center;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.sidebar-overlay { display: none; }

.content {
    min-height: 100vh;
    min-width: 0;
    margin-left: var(--sidebar-width);
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 900;
    height: var(--topbar-height);
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 0 26px;
    background: rgba(255, 255, 255, .94);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 5px 18px rgba(15, 23, 42, .045);
    backdrop-filter: blur(10px);
}
.sidebar-toggle {
    display: none;
    width: 42px;
    height: 42px;
    place-items: center;
    border: 1px solid var(--border);
    border-radius: 12px;
    color: var(--text);
    background: #fff;
    cursor: pointer;
}
.topbar-title {
    min-width: 0;
    display: grid;
    gap: 3px;
}
.topbar-title strong {
    font-size: 15px;
    line-height: 1.2;
}
.topbar-title span {
    color: var(--muted);
    font-size: 12px;
    line-height: 1.2;
}
.topbar-user {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 11px;
    min-width: 0;
}
.user-avatar {
    width: 40px;
    height: 40px;
    flex: 0 0 40px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    color: #fff;
    background: linear-gradient(135deg, #0f766e, #14b8a6);
    box-shadow: 0 7px 16px rgba(15, 118, 110, .2);
    font-size: 15px;
    font-weight: 800;
}
.user-identity {
    min-width: 0;
    display: grid;
    gap: 3px;
    text-align: right;
}
.user-identity strong {
    max-width: 210px;
    overflow: hidden;
    color: #172033;
    font-size: 13px;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.user-identity span {
    max-width: 290px;
    overflow: hidden;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.topbar-password {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 40px;
    padding: 9px 13px;
    border: 1px solid #bfdbfe;
    border-radius: 11px;
    color: #1d4ed8;
    background: #eff6ff;
    font-size: 12px;
    font-weight: 800;
    transition: background .18s ease, border-color .18s ease, transform .18s ease;
}
.topbar-password:hover {
    background: #dbeafe;
    border-color: #93c5fd;
    transform: translateY(-1px);
}
.topbar-password .menu-icon,
.topbar-password svg {
    width: 17px !important;
    height: 17px !important;
    min-width: 17px !important;
    max-width: 17px !important;
    min-height: 17px !important;
    max-height: 17px !important;
    flex: 0 0 17px !important;
}

.topbar-logout {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 40px;
    padding: 9px 13px;
    border: 1px solid #fecaca;
    border-radius: 11px;
    color: #991b1b;
    background: #fff7f7;
    font-size: 12px;
    font-weight: 800;
    transition: background .18s ease, border-color .18s ease, transform .18s ease;
}
.topbar-logout:hover {
    background: #fee2e2;
    border-color: #fca5a5;
    transform: translateY(-1px);
}
.topbar-logout .menu-icon,
.topbar-logout svg {
    width: 17px !important;
    height: 17px !important;
    min-width: 17px !important;
    max-width: 17px !important;
    min-height: 17px !important;
    max-height: 17px !important;
    flex: 0 0 17px !important;
}

.page-body {
    width: 100%;
    padding: 26px;
}
.page-title {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 20px;
}
.page-title h1 { margin: 0 0 6px; font-size: 28px; }
.page-title p { margin: 0; color: var(--muted); }
.card {
    margin-bottom: 18px;
    padding: 18px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: 0 8px 20px rgba(15, 23, 42, .04);
}
.grid { display: grid; gap: 16px; }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.stat h3 { margin: 0 0 8px; color: var(--muted); font-size: 14px; font-weight: 600; }
.stat .value { font-size: 25px; font-weight: 800; }
.stat.success .value { color: var(--success); }
.stat.danger .value { color: var(--danger); }
.stat.primary .value { color: var(--primary); }
.form-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-group { margin-bottom: 14px; }
label { display: block; margin-bottom: 7px; font-weight: 700; font-size: 14px; }
input, select, textarea {
    width: 100%;
    padding: 11px 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff;
    font-size: 14px;
}
input:focus, select:focus, textarea:focus {
    outline: 0;
    border-color: #5eead4;
    box-shadow: 0 0 0 3px rgba(20, 184, 166, .12);
}
textarea { min-height: 90px; resize: vertical; }
.btn {
    display: inline-block;
    padding: 10px 14px;
    border: 0;
    border-radius: 10px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 700;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-secondary { background: #e2e8f0; color: #0f172a; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-sm { padding: 7px 10px; font-size: 12px; border-radius: 8px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td {
    padding: 12px 10px;
    border-bottom: 1px solid var(--border);
    vertical-align: top;
    text-align: left;
    font-size: 14px;
}
th { background: #f8fafc; color: #334155; font-size: 13px; }
tfoot th, tfoot td { font-weight: 800; background: #f8fafc; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.badge {
    display: inline-block;
    padding: 5px 8px;
    border-radius: 99px;
    font-size: 12px;
    font-weight: 700;
}
.badge-success { background: #dcfce7; color: #166534; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-muted { background: #e2e8f0; color: #334155; }
.alert {
    padding: 12px 14px;
    border-radius: 12px;
    margin-bottom: 16px;
    font-weight: 600;
}
.alert-success { background: #dcfce7; color: #166534; border: 1px solid #86efac; }
.alert-danger { background: #fee2e2; color: #991b1b; border: 1px solid #fecaca; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.filter-box {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    align-items: end;
}
.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: linear-gradient(135deg, #083344, #164e63);
}
.login-card { width: 100%; max-width: 420px; }
.login-card .card { padding: 28px; }
.login-title { margin: 0 0 8px; }
.muted { color: var(--muted); }
.report-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    margin-bottom: 12px;
}
.help-text { margin-top: 6px; color: var(--muted); font-size: 12px; }

@media (max-width: 980px) {
    .sidebar {
        width: min(86vw, 290px);
        transform: translateX(-105%);
        transition: transform .24s ease;
    }
    body.sidebar-open .sidebar { transform: translateX(0); }
    .sidebar-overlay {
        position: fixed;
        inset: 0;
        z-index: 950;
        display: block;
        background: rgba(2, 16, 23, .56);
        opacity: 0;
        visibility: hidden;
        transition: opacity .24s ease, visibility .24s ease;
    }
    body.sidebar-open .sidebar-overlay {
        opacity: 1;
        visibility: visible;
    }
    .content { margin-left: 0; }
    .sidebar-toggle { display: grid; }
    .topbar { padding: 0 18px; }
    .topbar-title span { display: none; }
    .grid-3, .grid-2, .form-row, .filter-box { grid-template-columns: 1fr; }
}

@media (max-width: 680px) {
    :root { --topbar-height: 68px; }
    .topbar { gap: 10px; padding: 0 12px; }
    .topbar-title { display: none; }
    .topbar-user { gap: 8px; }
    .user-avatar { width: 36px; height: 36px; flex-basis: 36px; }
    .user-identity strong { max-width: 100px; font-size: 12px; }
    .user-identity span { max-width: 150px; font-size: 10px; }
    .topbar-password, .topbar-logout { min-height: 38px; padding: 8px 10px; }
    .topbar-password span, .topbar-logout span { display: none; }
    .page-body { padding: 18px 14px; }
    .page-title { align-items: stretch; flex-direction: column; }
    .page-title h1 { font-size: 24px; }
}

@media (max-width: 430px) {
    .user-identity span { max-width: 118px; }
    .user-identity span { font-size: 0; }
    .user-identity span::before {
        content: "ID: " attr(data-user-id);
        font-size: 10px;
    }
}

.global-print-letterhead {
    display: none;
}

@media print {
    .global-print-letterhead {
        display: block !important;
    }
    .sidebar, .sidebar-overlay, .topbar, .no-print, .btn { display: none !important; }
    .content { margin: 0; width: 100%; }
    .page-body { padding: 0; }
    .card { box-shadow: none; border: none; }
    body { background: #fff; }
}


/* Fallback agar ikon tidak pernah membesar meski cache CSS lama masih tertahan. */
.sidebar svg,
.topbar svg {
    display: block;
    width: 18px;
    height: 18px;
    max-width: 18px;
    max-height: 18px;
}
.sidebar-link,
.topbar-password,
.topbar-logout {
    white-space: nowrap;
}

/* Pembaruan v19: laporan pengeluaran unit dan role direktur. */
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.badge-primary { background: #ccfbf1; color: #115e59; }
.report-print-heading { display: none; text-align: center; margin-bottom: 18px; }
.report-print-heading h2 { margin: 0 0 6px; }
.report-print-heading p { margin: 0; color: var(--muted); }
.report-unit-filter { grid-template-columns: repeat(5, minmax(0, 1fr)); }

@media (max-width: 1180px) {
    .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .report-unit-filter { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 680px) {
    .grid-4, .report-unit-filter { grid-template-columns: 1fr; }
}

@media print {
    .report-print-heading { display: block; }
}

/* Pembaruan v20: dashboard khusus direktur. */
.director-eyebrow {
    display: inline-block;
    margin-bottom: 7px;
    color: var(--primary);
    font-size: 11px;
    font-weight: 900;
    letter-spacing: .12em;
    text-transform: uppercase;
}
.director-dashboard-filter {
    grid-template-columns: minmax(170px, 240px) minmax(140px, 190px) auto;
}
.director-dashboard-filter .form-group { margin-bottom: 0; }
.director-dashboard-filter .actions { align-items: end; }
.director-stat {
    position: relative;
    min-height: 142px;
    overflow: hidden;
}
.director-stat::after {
    position: absolute;
    right: -24px;
    bottom: -34px;
    width: 104px;
    height: 104px;
    border-radius: 50%;
    background: rgba(15, 118, 110, .06);
    content: "";
}
.director-stat.danger::after { background: rgba(185, 28, 28, .06); }
.director-stat.success::after { background: rgba(21, 128, 61, .06); }
.director-stat-label {
    display: block;
    margin-bottom: 12px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}
.director-stat .value {
    position: relative;
    z-index: 1;
    margin-bottom: 10px;
    font-size: clamp(21px, 2vw, 28px);
}
.director-stat small {
    position: relative;
    z-index: 1;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.45;
}
.trend-up { color: var(--danger) !important; }
.trend-down { color: var(--success) !important; }
.negative-value { color: var(--danger) !important; }
.director-chart-card h2,
.director-secondary-grid h2,
.director-shortcuts h2,
.card > .report-head h2 {
    margin: 0;
    font-size: 18px;
}
.director-chart-card .report-head { align-items: flex-start; }
.chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    color: var(--muted);
    font-size: 11px;
}
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend i { width: 10px; height: 10px; border-radius: 3px; }
.legend-income { background: #0f766e; }
.legend-expense { background: #dc2626; }
.monthly-chart {
    display: grid;
    grid-template-columns: repeat(12, minmax(28px, 1fr));
    gap: 8px;
    min-height: 270px;
    padding: 20px 4px 0;
    border-bottom: 1px solid var(--border);
}
.month-column {
    display: grid;
    grid-template-rows: 1fr auto;
    gap: 8px;
    min-width: 0;
    padding: 0 2px 9px;
    border-radius: 8px 8px 0 0;
}
.month-column.selected { background: #f0fdfa; }
.month-bars {
    display: flex;
    align-items: end;
    justify-content: center;
    gap: 3px;
    min-height: 220px;
}
.month-bars span {
    width: min(13px, 42%);
    min-height: 3px;
    border-radius: 5px 5px 2px 2px;
    transition: opacity .18s ease;
}
.month-column:hover .month-bars span { opacity: .76; }
.bar-income { background: linear-gradient(180deg, #14b8a6, #0f766e); }
.bar-expense { background: linear-gradient(180deg, #f87171, #dc2626); }
.month-label {
    overflow: hidden;
    color: var(--muted);
    font-size: 10px;
    font-weight: 800;
    text-align: center;
    text-overflow: clip;
    text-transform: uppercase;
}
.director-year-summary {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    margin-top: 15px;
}
.director-year-summary div {
    padding: 11px 12px;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: #f8fafc;
}
.director-year-summary span {
    display: block;
    margin-bottom: 5px;
    color: var(--muted);
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
}
.director-year-summary strong { font-size: 13px; }
.horizontal-ranking { display: grid; gap: 15px; }
.ranking-row { min-width: 0; }
.ranking-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 7px;
    font-size: 12px;
}
.ranking-heading > span {
    min-width: 0;
    overflow: hidden;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.ranking-heading b {
    display: inline-grid;
    width: 23px;
    height: 23px;
    margin-right: 8px;
    place-items: center;
    border-radius: 7px;
    color: var(--primary);
    background: var(--primary-soft);
    font-size: 10px;
}
.ranking-heading strong { flex: 0 0 auto; color: #334155; font-size: 12px; }
.ranking-track {
    height: 8px;
    overflow: hidden;
    border-radius: 99px;
    background: #e8eef5;
}
.ranking-track span {
    display: block;
    height: 100%;
    min-width: 3px;
    border-radius: inherit;
    background: linear-gradient(90deg, #14b8a6, #0f766e);
}
.ranking-row small {
    display: block;
    margin-top: 5px;
    color: var(--muted);
    font-size: 10px;
}
.text-link { color: var(--primary); font-size: 12px; font-weight: 800; }
.text-link:hover { text-decoration: underline; }
.empty-state {
    display: grid;
    min-height: 250px;
    place-items: center;
    color: var(--muted);
    border: 1px dashed var(--border);
    border-radius: 12px;
    font-size: 13px;
}
.compact-table th,
.compact-table td { padding-top: 10px; padding-bottom: 10px; }
.shortcut-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}
.shortcut-grid a {
    display: grid;
    gap: 5px;
    min-height: 86px;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #f8fafc;
    transition: border-color .18s ease, background .18s ease, transform .18s ease;
}
.shortcut-grid a:hover {
    border-color: #99f6e4;
    background: #f0fdfa;
    transform: translateY(-2px);
}
.shortcut-grid strong { color: #172033; font-size: 13px; }
.shortcut-grid span { color: var(--muted); font-size: 11px; line-height: 1.35; }
.director-print-heading { display: none; }

@media (max-width: 1180px) {
    .director-main-grid,
    .director-secondary-grid { grid-template-columns: 1fr; }
}

@media (max-width: 980px) {
    .director-dashboard-filter { grid-template-columns: 1fr 1fr; }
    .director-dashboard-filter .actions { grid-column: 1 / -1; }
    .monthly-chart { overflow-x: auto; grid-template-columns: repeat(12, minmax(44px, 1fr)); }
}

@media (max-width: 680px) {
    .director-dashboard-filter,
    .director-year-summary,
    .shortcut-grid { grid-template-columns: 1fr; }
    .director-dashboard-filter .actions { grid-column: auto; }
    .director-stat { min-height: 126px; }
    .monthly-chart { min-height: 240px; }
    .month-bars { min-height: 190px; }
    .chart-legend { width: 100%; }
}

@media print {
    .director-filter { display: none !important; }
    .director-print-heading { display: block; }
    .director-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .director-main-grid,
    .director-secondary-grid { grid-template-columns: 1fr; }
    .shortcut-grid { display: none; }
    .monthly-chart { min-height: 230px; }
    .month-bars { min-height: 180px; }
}

/* Pembaruan v21: modul penjamin dan piutang. */
.badge-warning { background: #fef3c7; color: #92400e; }
.btn:disabled { cursor: not-allowed; opacity: .55; }
.info-list { display: grid; gap: 10px; margin-top: 18px; }
.info-list div {
    display: grid;
    gap: 4px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: #f8fafc;
}
.info-list strong { font-size: 13px; }
.info-list span { color: var(--muted); font-size: 12px; line-height: 1.45; }
.receivable-filter { grid-template-columns: minmax(240px, 1fr) minmax(170px, 220px) auto; }
.receivable-filter-wide { grid-template-columns: minmax(230px, 1fr) minmax(220px, 1fr) minmax(150px, 190px) auto; }
.receivable-period-filter { grid-template-columns: minmax(180px, 240px) minmax(180px, 240px) auto; }
.receivable-period-filter .actions,
.receivable-filter .actions,
.receivable-filter-wide .actions { align-items: end; }
.receivable-analysis-grid,
.receivable-report-grid { align-items: start; }
.aging-list { display: grid; gap: 16px; }
.aging-row { min-width: 0; }
.aging-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 7px;
}
.aging-heading > span { display: grid; gap: 3px; font-size: 13px; font-weight: 800; }
.aging-heading small,
.aging-row > small { color: var(--muted); font-size: 10px; font-weight: 500; }
.aging-heading strong { flex: 0 0 auto; font-size: 13px; }
.aging-track {
    height: 10px;
    overflow: hidden;
    margin-bottom: 5px;
    border-radius: 99px;
    background: #e8eef5;
}
.aging-track span {
    display: block;
    height: 100%;
    min-width: 3px;
    border-radius: inherit;
    background: linear-gradient(90deg, #f59e0b, #b45309);
}
.receivable-note { border-left: 4px solid var(--primary); }
.receivable-note p { margin-bottom: 0; color: #334155; line-height: 1.65; }

@media (max-width: 1180px) {
    .receivable-filter-wide { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .receivable-filter-wide .actions { grid-column: 1 / -1; }
}

@media (max-width: 980px) {
    .receivable-filter,
    .receivable-filter-wide,
    .receivable-period-filter { grid-template-columns: 1fr; }
    .receivable-filter-wide .actions { grid-column: auto; }
}

/* Pembaruan v30: Dashboard Kabag. */
.kabag-year-filter {
    grid-template-columns: minmax(210px, 280px) auto;
    align-items: end;
}
.kabag-year-filter .actions { align-items: end; }
.kabag-summary-grid { margin-top: 0; }
.kabag-chart-grid,
.kabag-table-grid { align-items: start; }
.kabag-chart-wide { min-width: 0; }
.kabag-monthly-chart { margin-top: 4px; }
.compact-monthly-chart {
    min-height: 245px;
    overflow-x: auto;
    grid-template-columns: repeat(12, minmax(34px, 1fr));
}
.compact-monthly-chart .month-bars { min-height: 190px; }
.legend-receivable { background: #2563eb; }
.legend-receivable-payment { background: #16a34a; }
.legend-debt { background: #d97706; }
.legend-debt-payment { background: #7c3aed; }
.bar-receivable { background: linear-gradient(180deg, #60a5fa, #2563eb); }
.bar-receivable-payment { background: linear-gradient(180deg, #4ade80, #16a34a); }
.bar-debt { background: linear-gradient(180deg, #fbbf24, #d97706); }
.bar-debt-payment { background: linear-gradient(180deg, #a78bfa, #7c3aed); }
.kabag-ranking-scroll {
    max-height: 520px;
    overflow-y: auto;
    padding-right: 6px;
}
.kabag-unit-ranking {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px 24px;
    max-height: none;
}
.ranking-track.ranking-income span { background: linear-gradient(90deg, #34d399, #047857); }
.ranking-track.ranking-expense span { background: linear-gradient(90deg, #fb7185, #be123c); }
.ranking-track.ranking-unit span { background: linear-gradient(90deg, #60a5fa, #1d4ed8); }
.kabag-table-scroll { max-height: 560px; overflow: auto; }
.kabag-table-scroll table { min-width: 760px; }

@media (max-width: 1180px) {
    .kabag-chart-grid,
    .kabag-table-grid { grid-template-columns: 1fr; }
}

@media (max-width: 980px) {
    .kabag-year-filter { grid-template-columns: 1fr; }
    .kabag-unit-ranking { grid-template-columns: 1fr; }
    .kabag-monthly-chart { grid-template-columns: repeat(12, minmax(44px, 1fr)); overflow-x: auto; }
}

@media print {
    .kabag-ranking-scroll,
    .kabag-table-scroll { max-height: none; overflow: visible; }
    .kabag-chart-grid,
    .kabag-table-grid { grid-template-columns: 1fr; }
    .kabag-unit-ranking { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .compact-monthly-chart { min-height: 220px; }
    .compact-monthly-chart .month-bars { min-height: 165px; }
}

/* Pembaruan v31: grafik akun dan unit per bulan pada Dashboard Kabag. */
.monthly-category-list {
    display: grid;
    gap: 16px;
}
.monthly-category-row {
    min-width: 0;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #f8fafc;
}
.monthly-category-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 12px;
}
.monthly-category-heading > div {
    display: grid;
    min-width: 0;
    gap: 4px;
}
.monthly-category-heading strong {
    overflow: hidden;
    color: #172033;
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.monthly-category-heading small {
    color: var(--muted);
    font-size: 10px;
}
.monthly-category-heading > span {
    flex: 0 0 auto;
    color: #334155;
    font-size: 12px;
    font-weight: 800;
}
.mini-monthly-chart {
    display: grid;
    grid-template-columns: repeat(12, minmax(24px, 1fr));
    gap: 5px;
    min-width: 440px;
    padding-top: 6px;
    border-top: 1px solid #e2e8f0;
}
.mini-month-column {
    display: grid;
    min-width: 0;
    gap: 4px;
    text-align: center;
}
.mini-month-column > span {
    color: var(--muted);
    font-size: 8px;
    font-weight: 700;
    text-transform: uppercase;
}
.mini-month-bar-wrap {
    display: flex;
    height: 72px;
    align-items: end;
    justify-content: center;
    overflow: hidden;
    border-radius: 5px 5px 2px 2px;
    background: linear-gradient(180deg, rgba(226,232,240,.35), rgba(226,232,240,.8));
}
.mini-month-bar {
    display: block;
    width: min(15px, 62%);
    min-height: 0;
    border-radius: 4px 4px 1px 1px;
}
.mini-income-bar { background: linear-gradient(180deg, #34d399, #047857); }
.mini-expense-bar { background: linear-gradient(180deg, #fb7185, #be123c); }
.mini-unit-bar { background: linear-gradient(180deg, #60a5fa, #1d4ed8); }
.monthly-unit-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-height: 700px;
}

@media (max-width: 1180px) {
    .monthly-unit-list { grid-template-columns: 1fr; }
}

@media (max-width: 680px) {
    .monthly-category-heading { display: grid; }
    .monthly-category-heading > span { justify-self: start; }
    .monthly-category-row { overflow-x: auto; }
}

@media print {
    .monthly-category-list,
    .monthly-unit-list { max-height: none; overflow: visible; }
    .monthly-unit-list { grid-template-columns: 1fr; }
    .monthly-category-row { break-inside: avoid; }
    .mini-monthly-chart { min-width: 0; }
    .mini-month-bar-wrap { height: 58px; }
}

/* Pembaruan v32: filter akun dan unit pada grafik bulanan Kabag. */
.kabag-chart-filter {
    display: grid;
    grid-template-columns: minmax(230px, 1fr) auto;
    align-items: end;
    gap: 12px;
    margin: 0 0 16px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #f8fafc;
}
.kabag-chart-filter .form-group { margin: 0; }
.kabag-chart-filter .btn { white-space: nowrap; }
.selected-monthly-chart {
    overflow-x: auto;
    background: #fff;
}
.selected-monthly-chart .mini-monthly-chart {
    min-width: 520px;
}
.selected-monthly-chart .mini-month-bar-wrap {
    height: 150px;
}
.selected-monthly-chart .mini-month-column > span {
    font-size: 9px;
}
.chart-empty-note {
    margin: 12px 0 0;
    text-align: center;
}
.selected-unit-chart { max-width: none; }

@media (max-width: 680px) {
    .kabag-chart-filter { grid-template-columns: 1fr; }
    .kabag-chart-filter .btn { width: 100%; }
}

@media print {
    .selected-monthly-chart { overflow: visible; }
    .selected-monthly-chart .mini-monthly-chart { min-width: 0; }
}

/* Pembaruan v33: nominal filter, grafik tahunan akun, dan bar akun per unit Kabag. */
.kabag-chart-filter {
    grid-template-columns: minmax(260px, 1fr) minmax(170px, auto) auto;
}
.kabag-filter-total {
    display: grid;
    align-content: center;
    min-height: 42px;
    gap: 3px;
    padding: 8px 12px;
    border: 1px solid #dbe4ee;
    border-radius: 10px;
    background: #fff;
}
.kabag-filter-total span {
    color: var(--muted);
    font-size: 9px;
    font-weight: 800;
    letter-spacing: .03em;
    text-transform: uppercase;
}
.kabag-filter-total strong {
    color: #172033;
    font-size: 12px;
    white-space: nowrap;
}
.selected-monthly-chart .mini-month-value {
    display: block;
    min-height: 14px;
    overflow: visible;
    color: #334155;
    font-size: 8px;
    font-weight: 800;
    line-height: 1.15;
    text-transform: none;
    white-space: nowrap;
}
.annual-account-chart {
    max-height: 520px;
    overflow-y: auto;
    padding-right: 5px;
}
.unit-account-breakdown {
    overflow: visible;
    background: #fff;
}
.unit-account-bars {
    max-height: 560px;
    overflow-y: auto;
    padding: 4px 6px 4px 0;
}
.unit-account-bars .ranking-track {
    height: 12px;
}

@media (max-width: 860px) {
    .kabag-chart-filter { grid-template-columns: 1fr; }
    .kabag-filter-total { min-height: auto; }
    .kabag-chart-filter .btn { width: 100%; }
}

@media print {
    .annual-account-chart,
    .unit-account-bars { max-height: none; overflow: visible; }
    .selected-monthly-chart .mini-month-value { font-size: 7px; }
}

/* Pembaruan v41: modul pengajuan obat, BHP, dan kebutuhan lainnya. */
.request-summary { margin-bottom: 20px; }
.request-form-card, .request-detail-card { margin-bottom: 20px; }
.request-items-heading { display:flex; align-items:center; justify-content:space-between; gap:16px; margin:20px 0 10px; }
.request-items-heading h3 { margin:0 0 4px; }
.request-items-heading p { margin:0; }
.request-items-table input, .request-items-table select { min-width: 0; }
.request-items-table td { vertical-align: top; }
.request-filter { grid-template-columns:minmax(220px,1fr) minmax(170px,220px) minmax(170px,220px) auto; }
.request-filter .actions { align-items:end; }
.request-detail-grid { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:14px; margin-bottom:16px; }
.request-detail-grid > div, .request-purpose { border:1px solid var(--border); background:#f8fafc; border-radius:12px; padding:14px; }
.request-detail-grid span, .request-purpose > span { display:block; color:var(--muted); font-size:12px; font-weight:700; text-transform:uppercase; letter-spacing:.04em; margin-bottom:6px; }
.request-detail-grid strong { display:block; }
.request-purpose { margin-bottom:14px; }
.request-purpose p { margin:0; line-height:1.65; }
.request-approval-box { margin-top:20px; border:1px solid #a7f3d0; background:#ecfdf5; border-radius:14px; padding:18px; }
.request-approval-box h3 { margin:0 0 6px; }
.request-approval-box p { margin-top:0; }
.request-decision { margin-top:18px; padding:16px; border-radius:12px; background:#f8fafc; border-left:4px solid var(--muted); }
.request-decision.approved { background:#ecfdf5; border-left-color:var(--success); }
.request-decision.rejected { background:#fef2f2; border-left-color:var(--danger); }
.request-decision strong, .request-decision span { display:block; }
.request-decision span { color:var(--muted); margin-top:4px; font-size:13px; }
.request-decision p { margin:10px 0 0; }
.request-cancel-form { margin-top:14px; }
.request-history { margin-top:24px; }
.request-history h3 { margin-bottom:14px; }
.request-history-item { display:grid; grid-template-columns:18px 1fr; gap:10px; position:relative; padding-bottom:18px; }
.request-history-item:not(:last-child)::before { content:""; position:absolute; left:5px; top:12px; bottom:0; width:2px; background:var(--border); }
.request-history-dot { width:12px; height:12px; border-radius:50%; background:var(--primary); margin-top:4px; z-index:1; }
.request-history-item strong, .request-history-item span { display:block; }
.request-history-item span { color:var(--muted); font-size:13px; margin-top:3px; }
.request-history-item p { margin:7px 0 0; }
.text-right { text-align:right; }

@media (max-width: 980px) {
    .request-filter { grid-template-columns:repeat(2,minmax(0,1fr)); }
    .request-filter .actions { grid-column:1 / -1; }
    .request-detail-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
}
@media (max-width: 640px) {
    .request-items-heading { align-items:stretch; flex-direction:column; }
    .request-filter, .request-detail-grid { grid-template-columns:1fr; }
    .request-filter .actions { grid-column:auto; }
}
@media print {
    .request-form-card, .request-summary, .request-history { break-inside:avoid; }
}


/* Pembaruan v49: modul inventaris medis/non medis dan elektronik/non elektronik. */
.inventory-classification {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}
.inventory-parent-card {
    border: 1px solid var(--border, #dfe5ec);
    border-radius: 14px;
    background: var(--card, #fff);
    padding: 18px;
    box-shadow: 0 8px 22px rgba(15, 23, 42, .05);
}
.inventory-parent-card h3 {
    margin: 0 0 4px;
    font-size: 18px;
}
.inventory-parent-card > p {
    margin: 0 0 14px;
}
.inventory-child-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}
.inventory-child-link {
    display: block;
    border: 1px solid var(--border, #dfe5ec);
    border-radius: 11px;
    padding: 12px;
    text-decoration: none;
    color: inherit;
    background: rgba(248, 250, 252, .8);
    transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.inventory-child-link:hover {
    transform: translateY(-1px);
    border-color: #8ea7c4;
    box-shadow: 0 6px 16px rgba(15, 23, 42, .08);
}
.inventory-child-link span,
.inventory-child-link small {
    display: block;
}
.inventory-child-link strong {
    display: block;
    margin-top: 5px;
    font-size: 22px;
}
.inventory-overview {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}
.inventory-overview > div {
    min-width: 0;
    padding: 12px 14px;
    border-radius: 10px;
    background: rgba(248, 250, 252, .8);
    border: 1px solid var(--border, #dfe5ec);
}
.inventory-overview span,
.inventory-overview strong {
    display: block;
}
.inventory-overview span {
    color: var(--muted, #64748b);
    font-size: 12px;
    margin-bottom: 4px;
}
.inventory-form-card,
.inventory-table {
    margin-bottom: 16px;
}
.inventory-form-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}
.inventory-span-2 {
    grid-column: span 2;
}
.inventory-filter {
    display: grid;
    grid-template-columns: repeat(6, minmax(140px, 1fr));
    gap: 12px;
    align-items: end;
}
.inventory-filter .inventory-search {
    grid-column: span 2;
}
.inventory-filter .actions {
    grid-column: 1 / -1;
}
.inventory-code {
    display: block;
    margin-top: 4px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    color: var(--muted, #64748b);
}
.inventory-table td small {
    display: block;
    margin-top: 4px;
}
.inventory-classification-help {
    margin: -4px 0 12px;
    padding: 10px 12px;
    border-left: 4px solid #2563eb;
    background: #eff6ff;
    border-radius: 8px;
    color: #1e3a5f;
}
@media (max-width: 1100px) {
    .inventory-form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .inventory-filter { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .inventory-overview { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
    .inventory-classification,
    .inventory-child-grid,
    .inventory-form-grid,
    .inventory-filter,
    .inventory-overview { grid-template-columns: 1fr; }
    .inventory-span-2,
    .inventory-filter .inventory-search { grid-column: auto; }
}
