: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-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-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-logout { min-height: 38px; padding: 8px 10px; }
    .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;
    }
}

@media print {
    .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-logout {
    white-space: nowrap;
}
