* {
    box-sizing: border-box;
}

:root {
    --primary: #047857;
    --primary-dark: #065f46;
    --primary-soft: #d1fae5;
    --secondary: #0f172a;
    --danger: #dc2626;
    --danger-dark: #991b1b;
    --warning: #d97706;
    --warning-dark: #b45309;
    --success: #16a34a;
    --success-soft: #dcfce7;
    --bg: #f4f7fb;
    --white: #ffffff;
    --text: #1f2937;
    --muted: #6b7280;
    --border: #e5e7eb;
    --shadow: 0 10px 25px rgba(15, 23, 42, 0.08);
    --radius: 16px;
}

html,
body {
    margin: 0;
    width: 100%;
    min-height: 100%;
    overflow-x: hidden;
}

body {
    font-family: Arial, Helvetica, sans-serif;
    background: var(--bg);
    color: var(--text);
}

a {
    text-decoration: none;
}

/* ================= LOGIN ================= */

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(circle at top left, #bbf7d0, transparent 35%),
        linear-gradient(135deg, #ecfdf5, #f8fafc);
}

.login-box {
    width: 380px;
    background: var(--white);
    padding: 34px;
    border-radius: 24px;
    box-shadow: var(--shadow);
    text-align: center;
}

.login-logo {
    width: 70px;
    height: 70px;
    object-fit: contain;
    display: block;
    margin: 0 auto 14px;
    border-radius: 12px;
    background: #ffffff;
    padding: 6px;
    border: 1px solid var(--border);
}

.login-logo-placeholder {
    width: 70px;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 14px;
    border-radius: 12px;
    background: var(--primary-soft);
    color: var(--primary-dark);
    font-size: 36px;
    border: 1px solid var(--border);
}

.login-box h2 {
    margin-bottom: 6px;
    color: var(--primary-dark);
}

.login-box p {
    color: var(--muted);
    margin-bottom: 22px;
}

.login-box input,
.login-box select,
.login-box button {
    width: 100%;
    margin-top: 12px;
    padding: 13px;
    border-radius: 12px;
    border: 1px solid var(--border);
}

.login-box input:focus,
.login-box select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-soft);
}

/* ================= LAYOUT ================= */

.layout {
    display: grid;
    grid-template-columns: 270px minmax(0, 1fr);
    min-height: 100vh;
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
}

.sidebar {
    width: 270px;
    min-width: 270px;
    max-width: 270px;
    background: linear-gradient(180deg, #064e3b, #022c22);
    color: white;
    padding: 24px 18px;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar h2 {
    margin: 0 0 18px;
    font-size: 24px;
    line-height: 1.2;
}

.user-info {
    background: rgba(255, 255, 255, 0.12);
    padding: 14px;
    border-radius: 14px;
    margin-bottom: 16px;
}

.user-info p {
    margin: 4px 0;
}

.sidebar hr {
    border: none;
    border-top: 1px solid rgba(255, 255, 255, 0.18);
    margin: 18px 0;
}

.sidebar a {
    display: flex;
    align-items: center;
    gap: 8px;
    color: white;
    padding: 11px 13px;
    border-radius: 12px;
    margin-bottom: 7px;
    transition: all 0.2s ease;
}

.sidebar a:hover {
    background: rgba(255, 255, 255, 0.14);
    transform: translateX(4px);
}

.menu-icon {
    display: inline-flex;
    width: 24px;
    min-width: 24px;
    height: 24px;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.sidebar a span:last-child {
    flex: 1;
}

.content {
    min-width: 0;
    width: 100%;
    max-width: 100%;
    padding: 30px;
    overflow-x: hidden;
}

.content h1 {
    margin-top: 0;
    margin-bottom: 20px;
    color: var(--secondary);
    font-size: 30px;
}

/* ================= CARD ================= */

.card {
    background: var(--white);
    padding: 22px;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 20px;
    border: 1px solid rgba(229, 231, 235, 0.7);
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
}

.card h3 {
    margin-top: 0;
    color: var(--secondary);
}

/* ================= FORM ================= */

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 13px;
    align-items: start;
    width: 100%;
    max-width: 100%;
    min-width: 0;
}

.form-grid > * {
    min-width: 0;
}

input,
select,
textarea {
    padding: 11px 12px;
    border: 1px solid var(--border);
    border-radius: 12px;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    background: white;
    color: var(--text);
    transition: all 0.2s ease;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-soft);
}

textarea {
    min-height: 88px;
    resize: vertical;
}

.filter-field {
    width: 100%;
    max-width: 100%;
    min-width: 0;
}

/* ================= BUTTON ================= */

button,
.btn,
.btn-small {
    display: inline-block;
    background: var(--primary);
    color: white;
    padding: 10px 14px;
    border-radius: 12px;
    border: none;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.2s ease;
    text-align: center;
}

button:hover,
.btn:hover,
.btn-small:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 8px 18px rgba(4, 120, 87, 0.25);
}

button:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.btn-small {
    font-size: 13px;
    padding: 7px 10px;
    margin: 2px;
}

.btn.warning,
.btn-small.warning {
    background: var(--warning);
}

.btn.warning:hover,
.btn-small.warning:hover {
    background: var(--warning-dark);
}

.btn.danger,
.btn-small.danger {
    background: var(--danger);
}

.btn.danger:hover,
.btn-small.danger:hover {
    background: var(--danger-dark);
}

/* ================= ALERT ================= */

.alert {
    background: #fee2e2;
    color: #991b1b;
    padding: 12px 14px;
    border-radius: 12px;
    margin: 12px 0 18px;
    border-left: 5px solid var(--danger);
}

.success {
    background: var(--success-soft);
    color: #166534;
    padding: 12px 14px;
    border-radius: 12px;
    margin: 12px 0 18px;
    border-left: 5px solid var(--success);
}

/* ================= TABLE ================= */

.table-responsive,
div[style*="overflow-x"] {
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    border-radius: 14px;
    -webkit-overflow-scrolling: touch;
}

table {
    width: 100%;
    min-width: 900px;
    border-collapse: collapse;
    background: white;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.rekap-table {
    min-width: 1100px;
}

.user-table {
    min-width: 850px;
}

th,
td {
    padding: 13px 12px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: top;
}

th {
    background: #ecfdf5;
    color: #064e3b;
    font-size: 14px;
    white-space: nowrap;
}

td {
    font-size: 14px;
}

tbody tr {
    transition: background 0.2s ease;
}

tbody tr:hover {
    background: #f0fdf4;
}

.row-selected {
    background: #dcfce7 !important;
}

/* ================= BADGE ================= */

.badge-role {
    display: inline-block;
    padding: 5px 9px;
    border-radius: 999px;
    background: #d1fae5;
    color: #065f46;
    font-size: 12px;
    font-weight: bold;
    white-space: nowrap;
}

.badge-baru {
    display: inline-block;
    padding: 5px 9px;
    border-radius: 999px;
    background: #d1fae5;
    color: #065f46;
    font-size: 12px;
    font-weight: bold;
    white-space: nowrap;
}

.badge-murajaah {
    display: inline-block;
    padding: 5px 9px;
    border-radius: 999px;
    background: #fef3c7;
    color: #92400e;
    font-size: 12px;
    font-weight: bold;
    white-space: nowrap;
}

.text-muted {
    color: var(--muted);
    font-size: 13px;
}

/* ================= LOGO PROFIL LEMBAGA ================= */

.profil-logo-preview {
    width: 75px;
    height: 75px;
    object-fit: contain;
    border-radius: 12px;
    background: #ffffff;
    padding: 6px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

/* ================= STATS ================= */

.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 20px;
    width: 100%;
    max-width: 100%;
}

.stats .card {
    position: relative;
    overflow: hidden;
    min-height: 100px;
}

.stats .card::after {
    content: "";
    position: absolute;
    right: -30px;
    top: -30px;
    width: 90px;
    height: 90px;
    background: var(--primary-soft);
    border-radius: 50%;
}

.stats .card h3 {
    color: var(--muted);
    font-size: 15px;
    margin-bottom: 12px;
    position: relative;
    z-index: 1;
}

.stats .card p {
    font-size: 30px;
    font-weight: bold;
    margin: 0;
    color: var(--primary);
    position: relative;
    z-index: 1;
}

/* ================= PAGINATION ================= */

.pagination {
    margin-top: 20px;
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
}

.pagination a {
    background: var(--primary);
    color: white;
    padding: 9px 13px;
    border-radius: 10px;
    transition: 0.2s;
}

.pagination a:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.pagination span {
    color: var(--muted);
}

/* ================= FILTER DASHBOARD FORM ================= */

.filter-dashboard-form {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
}

.filter-dashboard-form .filter-row {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 12px;
    align-items: center;
    margin-bottom: 14px;
    width: 100%;
    max-width: 100%;
    min-width: 0;
}

.filter-dashboard-form .filter-date-row {
    grid-template-columns: repeat(5, minmax(0, 1fr));
}

.filter-dashboard-form select,
.filter-dashboard-form input,
.filter-dashboard-form button,
.filter-dashboard-form .btn {
    width: 100%;
    max-width: 100%;
    min-width: 0;
}

.filter-dashboard-form .btn {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ================= UTILITIES ================= */

.text-center {
    text-align: center;
}

.mt-1 {
    margin-top: 8px;
}

.mt-2 {
    margin-top: 16px;
}

.mb-1 {
    margin-bottom: 8px;
}

.mb-2 {
    margin-bottom: 16px;
}

/* ================= RESPONSIVE ================= */

@media (max-width: 1200px) {
    .filter-dashboard-form .filter-row,
    .filter-dashboard-form .filter-date-row {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 900px) {
    .layout {
        grid-template-columns: 1fr;
    }

    .sidebar {
        width: 100%;
        min-width: 100%;
        max-width: 100%;
        height: auto;
        position: relative;
        padding: 18px;
    }

    .sidebar h2 {
        font-size: 22px;
    }

    .sidebar a {
        display: inline-flex;
        margin-right: 5px;
        margin-bottom: 8px;
        font-size: 14px;
    }

    .content {
        width: 100%;
        max-width: 100%;
        padding: 18px;
        overflow-x: hidden;
    }

    .content h1 {
        font-size: 24px;
    }

    .form-grid {
        grid-template-columns: 1fr;
    }

    .stats {
        grid-template-columns: 1fr;
    }

    table {
        min-width: 900px;
    }

    .rekap-table {
        min-width: 1100px;
    }

    .user-table {
        min-width: 850px;
    }

    .login-box {
        width: 92%;
    }
}

@media (max-width: 700px) {
    .filter-dashboard-form .filter-row,
    .filter-dashboard-form .filter-date-row {
        grid-template-columns: 1fr;
    }

    .card {
        padding: 16px;
    }

    button,
    .btn,
    .btn-small {
        width: 100%;
        margin-bottom: 6px;
    }

    .pagination {
        flex-direction: column;
        align-items: stretch;
    }

    .pagination a,
    .pagination span {
        width: 100%;
        text-align: center;
    }

    .login-logo,
    .login-logo-placeholder {
        width: 64px;
        height: 64px;
    }

    .profil-logo-preview {
        width: 68px;
        height: 68px;
    }
}

.login-subtitle {
    margin: 4px 0 8px;
    color: var(--primary-dark);
    font-size: 16px;
    font-weight: bold;
}

/* ================= PAGE TRANSITION ================= */

.content {
    animation: pageSlideUp 0.45s ease both;
}

@keyframes pageSlideUp {
    from {
        opacity: 0;
        transform: translateY(28px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card {
    animation: cardFadeUp 0.5s ease both;
}

@keyframes cardFadeUp {
    from {
        opacity: 0;
        transform: translateY(18px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.card:nth-of-type(1) {
    animation-delay: 0.03s;
}

.card:nth-of-type(2) {
    animation-delay: 0.07s;
}

.card:nth-of-type(3) {
    animation-delay: 0.11s;
}

.card:nth-of-type(4) {
    animation-delay: 0.15s;
}

.card:nth-of-type(5) {
    animation-delay: 0.19s;
}

.login-box {
    animation: loginSlideUp 0.5s ease both;
}

@keyframes loginSlideUp {
    from {
        opacity: 0;
        transform: translateY(35px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.content {
    animation: pageFadeIn 0.3s ease both;
}

.card {
    animation: pageFadeIn 0.3s ease both;
}

@keyframes pageFadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}