:root {
    --bg: #f5f7fb;
    --card: #ffffff;
    --text: #1f2937;
    --muted: #6b7280;
    --line: #e5e7eb;
    --primary: #0f766e;
    --primary-dark: #115e59;
    --danger: #b91c1c;
    --warning: #b45309;
    --success-bg: #ecfdf5;
    --success-text: #166534;
    --error-bg: #fef2f2;
    --error-text: #991b1b;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.55;
}

img { max-width: 100%; height: auto; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.container {
    width: min(1100px, calc(100% - 32px));
    margin: 0 auto;
}

.site-header {
    background: #fff;
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 20;
}
.nav-wrap {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 0;
    align-items: center;
}
.brand {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text);
}
.tagline {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: .92rem;
}
.nav-links {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
}
.nav-links a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 8px 12px;
    border-radius: 10px;
}
.nav-links a:hover {
    background: #f0fdfa;
    text-decoration: none;
}

.main-content { padding: 28px 0 40px; }
.site-footer {
    border-top: 1px solid var(--line);
    background: #fff;
    color: var(--muted);
    padding: 16px 0;
}

.hero, .box, .card {
    background: var(--card);
    border-radius: 16px;
    box-shadow: 0 4px 16px rgba(15, 23, 42, .06);
}
.hero, .box { padding: 24px; }
.card { padding: 18px; }

.hero h1, .box h1, .box h2, .section-title {
    margin-top: 0;
}
.muted { color: var(--muted); }
.small { font-size: .92rem; }

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 16px;
}
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}
.page-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 16px;
}
.page-head h1,
.page-head h2,
.page-head h3,
.page-head p {
    margin-top: 0;
}
.stack-16 > * + * { margin-top: 16px; }
.stack-20 > * + * { margin-top: 20px; }

.form-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}
.form-group { margin-bottom: 14px; }
label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
}
input[type="text"],
input[type="password"],
input[type="date"],
select,
textarea {
    width: 100%;
    padding: 11px 12px;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    background: #fff;
    font: inherit;
}
textarea { min-height: 110px; resize: vertical; }
select[multiple] {
    min-height: 180px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 44px;
    padding: 11px 16px;
    border: 0;
    border-radius: 10px;
    background: var(--primary);
    color: #fff;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
}
.btn:hover { background: var(--primary-dark); text-decoration: none; }
.btn-secondary { background: #374151; }
.btn-secondary:hover { background: #111827; }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #991b1b; }
.btn-light {
    background: #fff;
    color: var(--text);
    border: 1px solid var(--line);
}
.btn-light:hover { background: #f9fafb; }

.actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}
.actions.actions-between {
    justify-content: space-between;
    align-items: center;
}

.table-wrap {
    overflow-x: auto;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 4px 16px rgba(15, 23, 42, .06);
}
.table {
    width: 100%;
    border-collapse: collapse;
}
.table th,
.table td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}
.table th {
    font-size: .9rem;
    color: var(--muted);
    background: #f9fafb;
}

.alert {
    padding: 14px 16px;
    border-radius: 12px;
    margin-bottom: 18px;
}
.alert-success {
    background: var(--success-bg);
    color: var(--success-text);
}
.alert-error {
    background: var(--error-bg);
    color: var(--error-text);
}

.meta-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}
.meta-item {
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    min-width: 0;
}
.meta-label {
    font-size: .85rem;
    color: var(--muted);
    margin-bottom: 6px;
}
.badge {
    display: inline-block;
    padding: 5px 10px;
    border-radius: 999px;
    background: #eef2ff;
    color: #3730a3;
    font-size: .8rem;
}
.empty-state {
    padding: 18px;
    border: 1px dashed #d1d5db;
    border-radius: 12px;
    color: var(--muted);
}
.search-bar {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin: 18px 0 0;
}
.search-bar input[type="text"] {
    flex: 1 1 260px;
    min-width: 0;
}
.login-box { width: min(460px, 100%); margin: 0 auto; }
.list-links {
    margin: 0;
    padding-left: 18px;
}

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

@media (max-width: 700px) {
    .container {
        width: min(100%, calc(100% - 24px));
    }
    .nav-wrap {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        padding: 14px 0;
    }
    .nav-links {
        width: 100%;
        justify-content: stretch;
    }
    .nav-links a {
        flex: 1 1 calc(50% - 10px);
    }
    .main-content {
        padding: 20px 0 32px;
    }
    .hero, .box {
        padding: 18px;
        border-radius: 14px;
    }
    .card {
        padding: 16px;
    }
    .grid,
    .form-row,
    .meta-list {
        grid-template-columns: 1fr;
    }
    .page-head,
    .actions.actions-between {
        flex-direction: column;
        align-items: stretch;
    }
    .actions > .btn,
    .actions > a.btn,
    .search-bar .btn,
    .search-bar a.btn {
        width: 100%;
    }
    .search-bar {
        flex-direction: column;
    }
    .table-wrap {
        background: transparent;
        box-shadow: none;
        overflow: visible;
    }
    .table,
    .table thead,
    .table tbody,
    .table th,
    .table td,
    .table tr {
        display: block;
        width: 100%;
    }
    .table thead {
        display: none;
    }
    .table tbody {
        display: grid;
        gap: 12px;
    }
    .table tr {
        background: #fff;
        border-radius: 14px;
        box-shadow: 0 4px 16px rgba(15, 23, 42, .06);
        overflow: hidden;
    }
    .table td {
        border-bottom: 1px solid var(--line);
        padding: 12px 14px;
    }
    .table td:last-child {
        border-bottom: 0;
    }
    .table td::before {
        content: attr(data-label);
        display: block;
        font-size: .8rem;
        color: var(--muted);
        font-weight: 700;
        margin-bottom: 4px;
        text-transform: uppercase;
        letter-spacing: .02em;
    }
    .table td[data-label="Aksi"] .actions > .btn,
    .table td[data-label="Aksi"] .actions > a.btn {
        width: 100%;
    }
}
