@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap");

:root {
    --app-bg: #f5f7fb;
    --app-surface: #ffffff;
    --app-surface-soft: #f8fafc;
    --app-border: #e5e7eb;
    --app-text: #172033;
    --app-muted: #667085;
    --app-primary: #0f8f5f;
    --app-primary-dark: #086947;
    --app-primary-soft: #e9f8f1;
    --app-accent: #2563eb;
    --app-warning: #f59e0b;
    --app-danger: #dc2626;
    --app-shadow: 0 16px 40px rgba(15, 23, 42, 0.08);
    --app-shadow-sm: 0 8px 22px rgba(15, 23, 42, 0.06);
    --app-radius: 16px;
    --app-sidebar: 280px;
}

* {
    letter-spacing: 0 !important;
}

html {
    min-height: 100%;
    background: var(--app-bg);
}

body {
    min-height: 100vh;
    background:
        radial-gradient(circle at top left, rgba(15, 143, 95, 0.10), transparent 34rem),
        linear-gradient(180deg, #fbfcfe 0%, var(--app-bg) 46%, #eef2f7 100%) !important;
    color: var(--app-text) !important;
    font-family: "Inter", Arial, sans-serif !important;
}

a,
button,
input,
select {
    font-family: inherit !important;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(15, 23, 42, 0.025) 1px, transparent 1px),
        linear-gradient(90deg, rgba(15, 23, 42, 0.025) 1px, transparent 1px);
    background-size: 32px 32px;
    mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.65), transparent 62%);
    z-index: -1;
}

.wrapper {
    align-items: stretch;
}

.sidebar {
    width: var(--app-sidebar) !important;
    background: linear-gradient(180deg, #063f32 0%, #07553f 48%, #063b33 100%) !important;
    color: #fff !important;
    padding: 24px 18px !important;
    box-shadow: 18px 0 45px rgba(4, 47, 46, 0.16);
    border-right: 1px solid rgba(255, 255, 255, 0.08);
    z-index: 20;
}

.logo-box {
    text-align: left !important;
    margin-bottom: 24px !important;
    padding: 12px 10px 22px !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.14) !important;
}

.logo-box img {
    width: 64px !important;
    height: 64px !important;
    object-fit: contain;
    background: rgba(255, 255, 255, 0.96) !important;
    border-radius: 14px !important;
    padding: 7px !important;
    margin: 0 0 14px !important;
    box-shadow: 0 14px 28px rgba(0, 0, 0, 0.18) !important;
}

.logo-box h2 {
    margin: 0 0 5px !important;
    color: #fff !important;
    font-size: 21px !important;
    line-height: 1.2 !important;
    font-weight: 800 !important;
}

.logo-box p {
    margin: 0 !important;
    color: rgba(255, 255, 255, 0.72) !important;
    font-size: 13px !important;
}

.menu-title {
    margin: 22px 10px 9px !important;
    color: rgba(255, 255, 255, 0.58) !important;
    font-size: 11px !important;
    font-weight: 800 !important;
    text-transform: uppercase !important;
}

.menu a {
    display: flex !important;
    align-items: center;
    min-height: 44px;
    padding: 11px 13px !important;
    margin-bottom: 7px !important;
    color: rgba(255, 255, 255, 0.88) !important;
    background: transparent !important;
    border: 1px solid transparent;
    border-radius: 12px !important;
    text-decoration: none !important;
    font-size: 14px !important;
    font-weight: 650 !important;
    transition: background 0.18s ease, color 0.18s ease, border-color 0.18s ease, transform 0.18s ease !important;
}

.menu a:hover,
.menu a.is-active {
    color: #fff !important;
    background: rgba(255, 255, 255, 0.12) !important;
    border-color: rgba(255, 255, 255, 0.16);
    transform: translateX(2px) !important;
}

.menu a.is-active {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.20), rgba(255, 255, 255, 0.10)) !important;
    box-shadow: inset 3px 0 0 #5ee6a9;
}

.content,
.main-content {
    padding: 32px !important;
}

.main-content {
    margin-left: var(--app-sidebar) !important;
}

body:has(.sidebar[style*="fixed"]) .content,
.content {
    margin-left: var(--app-sidebar);
}

.wrapper .content {
    margin-left: 0;
    min-width: 0;
}

.page-title,
.topbar {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 252, 0.94)) !important;
    border: 1px solid rgba(229, 231, 235, 0.86);
    border-radius: var(--app-radius) !important;
    box-shadow: var(--app-shadow-sm) !important;
    padding: 26px 28px !important;
    margin-bottom: 22px !important;
}

.page-title h1,
.topbar h1 {
    color: var(--app-text) !important;
    font-size: 28px !important;
    line-height: 1.18 !important;
    margin: 0 0 8px !important;
    font-weight: 800 !important;
}

.page-title p,
.topbar p {
    color: var(--app-muted) !important;
    line-height: 1.7 !important;
    max-width: 880px;
}

.card,
.chart-card,
.summary-card,
.login-box {
    background: rgba(255, 255, 255, 0.96) !important;
    border: 1px solid rgba(229, 231, 235, 0.9);
    border-radius: var(--app-radius) !important;
    box-shadow: var(--app-shadow-sm) !important;
}

.card,
.chart-card {
    padding: 24px !important;
    margin-bottom: 22px !important;
}

.card h3,
.chart-card h3 {
    color: var(--app-text) !important;
    font-size: 18px !important;
    font-weight: 800 !important;
    margin-bottom: 18px !important;
}

.menu-grid,
.summary-grid,
.chart-grid {
    gap: 18px !important;
}

.menu-grid .card {
    min-height: 170px;
    border-top: 4px solid var(--app-primary);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.menu-grid .card:hover {
    transform: translateY(-3px) !important;
    box-shadow: var(--app-shadow) !important;
}

.menu-grid .card h3 {
    color: var(--app-text) !important;
}

.menu-grid .card p {
    color: var(--app-muted) !important;
}

.card a,
.btn,
.login-box button,
.btn-tambah,
.btn-update {
    border: 0 !important;
    border-radius: 11px !important;
    background: linear-gradient(135deg, var(--app-primary), var(--app-primary-dark)) !important;
    color: #fff !important;
    box-shadow: 0 10px 20px rgba(15, 143, 95, 0.18);
    font-weight: 750 !important;
    transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease !important;
}

.card a:hover,
.btn:hover,
.login-box button:hover,
.btn-tambah:hover,
.btn-update:hover {
    transform: translateY(-1px);
    filter: brightness(1.02);
    box-shadow: 0 14px 26px rgba(15, 143, 95, 0.24);
}

.btn-batal {
    background: #6b7280 !important;
}

.btn-edit {
    background: #fff7ed !important;
    color: #9a3412 !important;
    border: 1px solid #fed7aa;
    box-shadow: none !important;
}

.btn-hapus {
    background: #fef2f2 !important;
    color: #b91c1c !important;
    border: 1px solid #fecaca;
    box-shadow: none !important;
}

input,
select,
input[type="file"] {
    min-height: 46px;
    border: 1px solid #d8dee8 !important;
    border-radius: 11px !important;
    background: #fff !important;
    color: var(--app-text) !important;
    box-shadow: 0 1px 0 rgba(15, 23, 42, 0.03);
}

input:focus,
select:focus {
    border-color: rgba(15, 143, 95, 0.72) !important;
    box-shadow: 0 0 0 4px rgba(15, 143, 95, 0.12) !important;
}

label {
    color: var(--app-text) !important;
    font-weight: 700 !important;
}

table {
    border-collapse: separate !important;
    border-spacing: 0 !important;
    overflow: hidden;
    border: 1px solid var(--app-border);
    border-radius: 14px !important;
    background: #fff;
}

table th {
    background: #f1f5f9 !important;
    color: #334155 !important;
    border-bottom: 1px solid var(--app-border);
    font-size: 13px !important;
    font-weight: 800 !important;
    text-transform: uppercase;
}

table td {
    color: #27364a !important;
    border-bottom: 1px solid #eef2f7 !important;
}

table tr:nth-child(even) {
    background: #fbfdff !important;
}

table tr:hover {
    background: var(--app-primary-soft) !important;
}

.badge-benefit,
.badge-cost,
.tag,
.badge-rank {
    border-radius: 999px !important;
    font-weight: 800 !important;
}

.badge-benefit,
.tag {
    background: #dcfce7 !important;
    color: #166534 !important;
}

.badge-cost {
    background: #fee2e2 !important;
    color: #991b1b !important;
}

.badge-rank {
    background: var(--app-primary) !important;
}

.rank-1 {
    background: #f59e0b !important;
}

.rank-2 {
    background: #64748b !important;
}

.rank-3 {
    background: #ea580c !important;
}

.summary-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
}

.summary-card {
    padding: 20px !important;
}

.summary-icon {
    background: linear-gradient(135deg, var(--app-primary), var(--app-accent)) !important;
    border-radius: 14px !important;
}

.summary-text h4 {
    color: var(--app-muted) !important;
}

.summary-text h2 {
    color: var(--app-text) !important;
    font-weight: 800 !important;
}

.footer {
    color: var(--app-muted) !important;
    font-size: 13px !important;
}

body:has(.login-box) {
    background: #f4f7fb !important;
}

.left {
    background:
        linear-gradient(rgba(6, 63, 50, 0.78), rgba(6, 63, 50, 0.84)),
        url("../../logo.png") center/360px no-repeat,
        linear-gradient(135deg, #063f32, #0f8f5f) !important;
}

.left img {
    width: 150px !important;
    background: rgba(255, 255, 255, 0.96);
    border-radius: 22px;
    padding: 12px;
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.22);
}

.left p {
    font-size: 18px !important;
    font-weight: 700;
}

.right {
    background: transparent !important;
}

.right::before {
    display: none;
}

.login-box {
    width: min(390px, calc(100vw - 32px)) !important;
    padding: 34px !important;
}

.login-box h2 {
    color: var(--app-text) !important;
    font-size: 25px;
    font-weight: 800;
}

.app-mobile-toggle {
    display: none;
    position: fixed;
    top: 14px;
    left: 14px;
    z-index: 35;
    width: 44px;
    height: 44px;
    border: 1px solid var(--app-border);
    border-radius: 12px;
    background: #fff;
    color: var(--app-text);
    box-shadow: var(--app-shadow-sm);
    cursor: pointer;
}

.app-mobile-toggle span {
    display: block;
    width: 18px;
    height: 2px;
    margin: 4px auto;
    background: currentColor;
    border-radius: 99px;
}

.app-sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 18;
    background: rgba(15, 23, 42, 0.42);
    border: 0;
}

.edit-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 60;
    padding: 24px;
    align-items: center;
    justify-content: center;
}

.edit-modal.is-open {
    display: flex;
}

.edit-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.52);
    backdrop-filter: blur(4px);
}

.edit-modal-dialog {
    position: relative;
    width: min(560px, 100%);
    max-height: calc(100vh - 48px);
    overflow-y: auto;
    background: var(--app-surface);
    border: 1px solid rgba(229, 231, 235, 0.95);
    border-radius: 18px;
    box-shadow: 0 28px 70px rgba(15, 23, 42, 0.24);
}

.edit-modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 22px 24px 16px;
    border-bottom: 1px solid var(--app-border);
}

.edit-modal-header h3 {
    margin: 0 0 5px !important;
    color: var(--app-text) !important;
    font-size: 20px !important;
    font-weight: 800 !important;
}

.edit-modal-header p {
    margin: 0;
    color: var(--app-muted);
    font-size: 14px;
    line-height: 1.5;
}

.edit-modal-close {
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    border: 1px solid var(--app-border);
    border-radius: 11px;
    background: #fff;
    color: var(--app-muted);
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
}

.edit-modal-close:hover {
    color: var(--app-text);
    background: var(--app-surface-soft);
}

.edit-modal-body {
    padding: 22px 24px 24px;
}

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

.modal-form-grid input,
.modal-form-grid select {
    width: 100%;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
}

.modal-actions .btn {
    min-width: 120px;
    text-align: center;
}

@media (max-width: 1180px) {
    .summary-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    }

    .chart-grid {
        grid-template-columns: 1fr !important;
    }
}

@media (max-width: 860px) {
    body {
        display: block !important;
    }

    .app-mobile-toggle {
        display: block;
    }

    .app-sidebar-backdrop.is-visible {
        display: block;
    }

    .sidebar {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        height: 100vh !important;
        transform: translateX(-105%);
        transition: transform 0.22s ease;
        overflow-y: auto;
    }

    body.sidebar-open .sidebar {
        transform: translateX(0);
    }

    .content,
    .main-content,
    .wrapper .content {
        margin-left: 0 !important;
        padding: 76px 16px 22px !important;
    }

    .wrapper {
        display: block !important;
        min-height: 100vh;
    }

    .page-title,
    .topbar,
    .card,
    .chart-card {
        border-radius: 14px !important;
        padding: 20px !important;
    }

    .page-title h1,
    .topbar h1 {
        font-size: 24px !important;
    }

    .menu-grid,
    .summary-grid {
        grid-template-columns: 1fr !important;
    }

    .form-row,
    .upload-box {
        display: grid !important;
        grid-template-columns: 1fr !important;
    }

    table {
        display: block;
        width: 100%;
        overflow-x: auto;
        white-space: nowrap;
    }

    .edit-modal {
        padding: 16px;
    }

    .edit-modal-dialog {
        max-height: calc(100vh - 32px);
    }

    .modal-actions {
        display: grid;
        grid-template-columns: 1fr;
    }

    .left,
    .right {
        width: 100% !important;
        min-height: 50vh;
        height: auto !important;
    }

    .left {
        padding: 34px 22px !important;
    }

    .right {
        padding: 28px 16px !important;
    }
}
