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

:root {
    --blue: #0876c9;
    --navy: #10284e;
    --pale: #eff6fc;
    --line: #e1eaf3;
    --text: #183153;
    --muted: #6d819b;
}

/* Grouped sidebar navigation */
.sidebar nav {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-group {
    display: flex;
    flex-direction: column;
}

.nav-group-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 11px 14px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.nav-group-toggle:hover,
.nav-group-toggle[aria-expanded="true"] {
    background: rgba(255,255,255,.10);
}

.nav-group-icon {
    width: 18px;
    flex: 0 0 18px;
    text-align: center;
}

.nav-group-label {
    flex: 1;
}

.nav-group-chevron {
    font-size: 12px;
    transition: transform .2s ease;
}

.nav-group-toggle[aria-expanded="true"] .nav-group-chevron {
    transform: rotate(180deg);
}

.nav-group-items {
    display: none;
    flex-direction: column;
    gap: 3px;
    padding: 4px 0 5px 18px;
}

.nav-group-items.is-open {
    display: flex;
}

.sidebar nav .nav-group-items a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: 7px;
    color: inherit;
    text-decoration: none;
}

.sidebar nav .nav-group-items a:hover,
.sidebar nav .nav-group-items a.active {
    background: rgba(255,255,255,.10);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: #f3f7fb;
    color: var(--text);
    font: 14px Inter, Arial, sans-serif;
}

.layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 240px;
    background: linear-gradient(180deg, #0876c9, #07569c);
    color: #fff;
    padding: 24px 14px;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}


/* Cegah logo atau dekorasi meluber */
.sidebar {
    overflow: hidden;
}

/* Hilangkan dekorasi logo berukuran besar jika berasal dari pseudo-element */
.sidebar::before,
.sidebar::after,
.sidebar .brand::before,
.sidebar .brand::after {
    background-image: none !important;
}

/* Kompatibilitas untuk logo berbentuk teks/inisial pada halaman login */
.brand-mark {
    width: 42px;
    height: 42px;
    border: 1.5px solid #fff;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-weight: 800;
    font-size: 13px;
    flex-shrink: 0;
}

nav {
    display: grid;
    gap: 6px;
}

nav a {
    color: #eaf5ff;
    text-decoration: none;
    padding: 13px 12px;
    border-radius: 9px;
    display: flex;
    gap: 13px;
    align-items: center;
}

nav a:hover,
nav a:focus {
    background: #ffffff27;
}

.sidebar-foot {
    margin-top: auto;
    padding: 24px 12px 8px;
    line-height: 1.7;
    font-weight: 600;
}

.main {
    flex: 1;
    min-width: 0;
}

.topbar {
    height: 64px;
    background: #fff;
    border-bottom: 1px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 30px;
}

.user {
    display: flex;
    gap: 18px;
    align-items: center;
    font-weight: 600;
}

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

.content {
    padding: 28px 30px;
    max-width: 1600px;
    margin: auto;
}

.footer {
    padding: 18px 30px;
    color: var(--muted);
    font-size: 11px;
}

.welcome {
    background: linear-gradient(110deg, #e4f2ff, #f8fbff);
    border: 1px solid #dcecf9;
    border-radius: 16px;
    padding: 28px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 22px;
}

.welcome h1 {
    font-size: 25px;
    margin: 5px 0 8px;
    color: #102b55;
}

.welcome p {
    color: #627d9e;
    margin: 0;
}

.eyebrow {
    font-size: 11px;
    letter-spacing: 1.4px;
    font-weight: 700;
    color: var(--blue) !important;
}

.welcome-art {
    font-size: 20px;
    color: #1262a8;
    text-align: right;
    line-height: 1.45;
}

.stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 28px;
}

.stat {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 20px;
    display: flex;
    gap: 14px;
    align-items: center;
    min-width: 0;
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    font-size: 24px;
}

.blue { background: #e3f1ff; color: #0876c9; }
.pink { background: #ffebf0; color: #e64e70; }
.green { background: #e1f8ef; color: #0a9d70; }
.purple { background: #f0eaff; color: #7954d5; }

.stat small {
    display: block;
    color: var(--muted);
    font-size: 12px;
}

.stat strong {
    display: block;
    font-size: 25px;
    color: #112b53;
    margin-top: 5px;
}

.section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 22px 0 14px;
    gap: 15px;
}

.section-head h1,
.section-head h2 {
    margin: 0;
    color: #112b53;
}

.section-head h1 { font-size: 23px; }
.section-head h2 { font-size: 17px; }

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

.panel,
.table-wrap {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 13px;
    padding: 18px;
    margin-bottom: 18px;
    overflow-x: auto;
}

.panel h2 {
    font-size: 16px;
    margin: 0 0 18px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 15px;
}

.form-grid .wide {
    grid-column: 1 / -1;
}

label {
    display: block;
    font-weight: 600;
    font-size: 12px;
    margin-bottom: 7px;
    color: #304968;
}

input,
select,
textarea {
    font: inherit;
    color: var(--text);
    width: 100%;
    border: 1px solid #d8e3ef;
    border-radius: 8px;
    padding: 11px 12px;
    background: #fff;
    outline: none;
}

input:focus,
select:focus,
textarea:focus {
    border-color: #328bd1;
    box-shadow: 0 0 0 3px #0876c91a;
}

input:disabled {
    background: #f3f6f9;
    color: #8b9bb0;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 8px;
    background: var(--blue);
    color: #fff;
    padding: 11px 17px;
    font: 600 13px Inter, Arial, sans-serif;
    cursor: pointer;
    text-decoration: none;
}

.btn:hover {
    background: #0563aa;
}

.btn.secondary {
    background: #edf4fb;
    color: #23669f;
    border: 1px solid #dbe8f5;
}

.full {
    width: 100%;
    margin: 18px 0;
}

.searchbar {
    display: flex;
    gap: 10px;
    margin: 18px 0;
    align-items: center;
    flex-wrap: wrap;
}

.searchbar input {
    max-width: 430px;
    flex: 1 1 280px;
}

.searchbar select {
    width: auto;
    min-width: 160px;
}

.searchbar .btn {
    white-space: nowrap;
}

table {
    border-collapse: collapse;
    width: 100%;
    min-width: 760px;
    text-align: left;
}

th {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .3px;
    color: #647b98;
    background: #f7faff;
}

th,
td {
    padding: 13px 12px;
    border-bottom: 1px solid #edf1f6;
    vertical-align: middle;
}

td {
    font-size: 12px;
}

tr:last-child td {
    border-bottom: 0;
}

.avatar {
    width: 38px;
    height: 38px;
    border-radius: 9px;
    object-fit: cover;
}

.pill {
    display: inline-block;
    border-radius: 20px;
    padding: 5px 9px;
    background: #e4f6ee;
    color: #16825d;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

.empty {
    text-align: center;
    color: var(--muted);
    padding: 28px;
}

.alert {
    padding: 12px 14px;
    border-radius: 8px;
    margin-bottom: 16px;
    background: #e5f6ed;
    color: #176d4c;
}

.alert.error {
    background: #fff0f0;
    color: #b42336;
}

.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, #e7f3ff, #f7fbff);
    padding: 20px;
}

.login-card {
    background: #fff;
    width: min(420px, 100%);
    padding: 34px;
    border: 1px solid var(--line);
    border-radius: 18px;
    box-shadow: 0 18px 55px #17436b12;
}

.login-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #1262a8;
    margin-bottom: 28px;
}

.login-brand .brand-mark {
    background: #0876c9;
    color: white;
}

.login-card h1 {
    margin: 0 0 7px;
    color: #112b53;
}

.login-card p {
    margin: 0 0 25px;
}

.login-card label {
    margin-top: 14px;
}

.login-card input {
    margin-bottom: 4px;
}

.login-card small {
    display: block;
    text-align: center;
}

/* Orphan donations module */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 22px;
}

.stats-grid .panel {
    margin: 0;
    padding: 20px;
    min-width: 0;
}

.stats-grid .panel > span {
    display: block;
    font-size: 12px;
    color: var(--muted);
}

.stats-grid .panel h2 {
    margin: 10px 0 0;
    font-size: 26px;
    color: var(--navy);
}

.panel .form-grid {
    align-items: start;
}

.form-grid textarea {
    resize: vertical;
    min-height: 80px;
}

.form-grid button {
    min-height: 40px;
}

.table-wrap {
    padding: 12px;
}

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

.table-wrap td small {
    display: inline-block;
    color: var(--muted);
    margin-top: 4px;
    font-size: 10px;
}

.pill.status-paid { background: #e1f8ef; color: #087c59; }
.pill.status-pending { background: #fff4d9; color: #9a6500; }
.pill.status-overdue { background: #ffebeb; color: #b42336; }
.pill.status-cancelled { background: #edf0f4; color: #65758a; }

.action-form {
    display: grid;
    gap: 7px;
    min-width: 145px;
    margin-bottom: 8px;
}

.action-form input,
.action-form select {
    width: 100%;
    min-width: 0;
    padding: 8px;
    font-size: 11px;
}

.action-form .btn,
td form > .btn {
    width: 100%;
    padding: 9px;
    font-size: 11px;
}

@media (max-width: 1100px) {
    .stats,
    .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .sidebar {
        width: 205px;
    }

    .brand-logo img {
        max-width: 175px;
    }

    .content {
        padding: 22px;
    }
}

@media (max-width: 700px) {
    .sidebar {
        width: 64px;
        padding: 15px 7px;
    }

    .brand {
        min-height: 55px;
        padding: 4px 0 25px;
        justify-content: center;
    }

    .brand-logo {
        justify-content: center;
    }

    .brand-logo img {
        width: 44px;
        max-width: 44px;
        height: 40px;
    }

    .brand div,
    nav a span,
    .sidebar-foot {
        display: none;
    }

    .brand-mark {
        width: 42px;
        height: 42px;
    }

    nav a {
        justify-content: center;
        font-size: 18px;
        padding: 13px 5px;
    }

    .topbar {
        padding: 0 15px;
    }

    .content {
        padding: 16px;
    }

    .welcome {
        padding: 20px;
        display: block;
    }

    .welcome-art {
        display: none;
    }

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

    .stat {
        padding: 13px;
        gap: 8px;
    }

    .stat-icon {
        width: 36px;
        height: 36px;
        font-size: 18px;
    }

    .stat strong {
        font-size: 20px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
    }

    .stats-grid .panel {
        padding: 14px;
    }

    .stats-grid .panel h2 {
        font-size: 21px;
    }

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

    .form-grid .wide {
        grid-column: auto;
    }

    .section-head {
        align-items: flex-start;
        flex-wrap: wrap;
    }

    .searchbar {
        align-items: stretch;
    }

    .searchbar input,
    .searchbar select {
        max-width: none;
        width: 100%;
        flex-basis: 100%;
    }

    .searchbar .btn {
        flex: 1;
    }
}

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