:root {
    --bg: #f3f8fb;
    --surface: #ffffff;
    --ink: #17324d;
    --muted: #5d7388;
    --line: #dbe6ee;
    --brand: #1b7fc4;
    --brand-dark: #14639b;
    --ok: #1f9d63;
    --warn: #d98a00;
    --danger: #d64545;
    --radius: 16px;
    --shadow: 0 4px 18px rgba(23, 50, 77, 0.08);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 17px;
    line-height: 1.55;
    color: var(--ink);
    background: var(--bg);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

a { color: var(--brand-dark); }

h1 { font-size: 1.8rem; line-height: 1.2; margin: 0 0 .5rem; }
h2 { font-size: 1.15rem; margin: 0 0 .35rem; }

.wrap { width: 100%; max-width: 1040px; margin: 0 auto; padding: 24px 16px 48px; flex: 1; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
.center { text-align: center; }

/* ---------- Topbar ---------- */
.topbar {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 12px 20px; background: var(--surface); border-bottom: 1px solid var(--line);
    position: sticky; top: 0; z-index: 10;
}
.brand { font-weight: 800; font-size: 1.2rem; text-decoration: none; color: var(--brand-dark); }
.topnav { display: flex; align-items: center; gap: 10px; }
.who { font-weight: 600; }
.who small { color: var(--muted); font-weight: 400; }

/* ---------- Tombol ---------- */
.btn {
    display: inline-block; padding: 11px 20px; border: 2px solid var(--brand); border-radius: 999px;
    background: var(--brand); color: #fff; font: inherit; font-weight: 700; text-decoration: none;
    cursor: pointer; text-align: center; transition: background .15s, transform .05s;
}
.btn:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-ghost { background: transparent; color: var(--brand-dark); }
.btn-ghost:hover { background: #e6f2fa; color: var(--brand-dark); }
.btn-lg { padding: 14px 28px; font-size: 1.05rem; }
.btn-block { display: block; width: 100%; }
.btn-sm { padding: 6px 14px; font-size: .88rem; }
.btn-ok { background: var(--ok); border-color: var(--ok); }
.btn-ok:hover { background: #167a4d; border-color: #167a4d; }
.btn-danger { background: transparent; color: var(--danger); border-color: var(--danger); }
.btn-danger:hover { background: var(--danger); border-color: var(--danger); color: #fff; }

/* ---------- Kartu & form ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); margin-bottom: 20px; }
.narrow { max-width: 460px; margin-left: auto; margin-right: auto; }

form label { display: block; font-weight: 600; margin-bottom: 14px; }
form label .muted { font-weight: 400; }
input[type=text], input[type=email], input[type=password], select {
    display: block; width: 100%; margin-top: 6px; padding: 12px 14px; font: inherit;
    border: 2px solid var(--line); border-radius: 12px; background: #fff; color: var(--ink);
}
input:focus, select:focus, .btn:focus-visible, a:focus-visible { outline: 3px solid #9fd0f0; outline-offset: 2px; border-color: var(--brand); }

/* ---------- Alert ---------- */
.alert { padding: 12px 16px; border-radius: 12px; margin-bottom: 18px; border: 1px solid; }
.alert ul { margin: 0; padding-left: 20px; }
.alert-success { background: #e7f7ef; border-color: #a9dfc4; color: #14573a; }
.alert-error { background: #fdecec; border-color: #f2b8b8; color: #8a2222; }

/* ---------- Landing ---------- */
.hero { text-align: center; padding: 48px 8px; }
.hero h1 { font-size: 2.3rem; max-width: 640px; margin: 0 auto 14px; }
.hero p { max-width: 560px; margin: 0 auto 22px; color: var(--muted); }
.hero-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-bottom: 18px; }

/* ---------- Statistik admin ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin: 18px 0 20px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); display: flex; flex-direction: column; color: var(--muted); }
.stat-num { font-size: 2rem; font-weight: 800; color: var(--ink); line-height: 1.1; }
.stat-pending .stat-num { color: var(--warn); }
.stat-ok .stat-num { color: var(--ok); }
.stat-no .stat-num { color: var(--danger); }

/* ---------- Tab & tabel ---------- */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; border-bottom: 2px solid var(--line); }
.tab { padding: 10px 14px; text-decoration: none; color: var(--muted); font-weight: 700; border-bottom: 3px solid transparent; margin-bottom: -2px; }
.tab.active { color: var(--brand-dark); border-bottom-color: var(--brand); }
.pill { display: inline-block; min-width: 24px; padding: 1px 8px; border-radius: 999px; background: #e8f0f6; font-size: .8rem; text-align: center; }

.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: .85rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.actions form { display: flex; gap: 8px; flex-wrap: wrap; }
.empty { text-align: center; color: var(--muted); padding: 28px 0; margin: 0; }

.badge { display: inline-block; padding: 3px 12px; border-radius: 999px; font-size: .85rem; font-weight: 700; }
.badge-pending { background: #fff3d6; color: #8a5a00; }
.badge-approved { background: #dff5ea; color: #14573a; }
.badge-rejected { background: #fde1e1; color: #8a2222; }

/* ---------- Dashboard siswa ---------- */
.welcome { background: linear-gradient(135deg, #e3f3fc, #f2fbf4); }
.islands { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 18px; margin-bottom: 20px; }
.island { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 6px; }
.island p { margin: 0 0 10px; color: var(--muted); font-size: .95rem; }
.island-icon { font-size: 2.6rem; line-height: 1; }
.island.locked { background: #eef3f7; box-shadow: none; }
.island.locked .island-icon { filter: grayscale(1); opacity: .6; }
.lock-note { margin-top: auto !important; font-size: .88rem !important; }
.island .btn { margin-top: auto; }
.bar { height: 12px; background: #e5eef5; border-radius: 999px; overflow: hidden; margin-top: auto; margin-bottom: 8px; }
.bar span { display: block; height: 100%; background: linear-gradient(90deg, #35b6e8, #1fa36a); border-radius: 999px; }

.footer { text-align: center; padding: 18px; color: var(--muted); font-size: .85rem; }

/* ---------- Responsif: tabel jadi kartu di layar kecil ---------- */
@media (max-width: 720px) {
    body { font-size: 16px; }
    .hero h1 { font-size: 1.8rem; }
    .who { display: none; }
    table, thead, tbody, tr, td, th { display: block; }
    thead { position: absolute; left: -9999px; }
    tr { border: 1px solid var(--line); border-radius: 12px; margin-bottom: 12px; padding: 6px 4px; }
    td { border: 0; padding: 6px 10px; display: flex; justify-content: space-between; gap: 12px; }
    td::before { content: attr(data-label); font-weight: 700; color: var(--muted); }
    td.actions { justify-content: flex-end; }
}
