:root {
    --primary: #1666c4;
    --primary-dark: #0a3f86;
    --primary-deep: #062b63;
    --primary-soft: #eaf3fd;
    --accent: #38bdf8;
    --bg: #f3f7fc;
    --card: #ffffff;
    --text: #0f1d2e;
    --muted: #5b6b80;
    --border: #e4ecf5;
    --success: #0f9d58;
    --danger: #dc4444;
    --ring: rgba(22, 102, 196, 0.14);
    --radius: 16px;
    --grad: linear-gradient(135deg, #1666c4 0%, #0a3f86 55%, #062b63 100%);
    --grad-soft: linear-gradient(135deg, #eaf3fd 0%, #d8eafc 100%);
    --grad-side: linear-gradient(180deg, #0a3f86 0%, #062b63 100%);
    --shadow-sm: 0 1px 2px rgba(15, 29, 46, 0.04), 0 1px 3px rgba(15, 29, 46, 0.06);
    --shadow-md: 0 6px 24px rgba(15, 29, 46, 0.07);
    --shadow-lg: 0 18px 50px rgba(10, 63, 134, 0.18);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: 'Plus Jakarta Sans', 'Segoe UI', Tahoma, sans-serif;
    background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased;
}
a { text-decoration: none; color: inherit; }

/* ===== Login ===== */
.login-page {
    position: relative; display: flex; align-items: center; justify-content: center;
    min-height: 100vh; padding: 20px; background: var(--grad); overflow: hidden;
}
.login-page::before {
    content: ""; position: absolute; inset: 0;
    background:
        radial-gradient(circle at 15% 20%, rgba(56, 189, 248, 0.35), transparent 40%),
        radial-gradient(circle at 85% 80%, rgba(255, 255, 255, 0.12), transparent 42%);
}
.login-box {
    position: relative; z-index: 1; background: #fff; width: 100%; max-width: 400px;
    padding: 44px 36px; border-radius: 22px; box-shadow: 0 30px 70px rgba(6, 43, 99, 0.4);
    text-align: center;
}
.login-logo {
    width: 70px; height: 70px; border-radius: 20px; margin: 0 auto 16px;
    background: var(--grad-soft); color: var(--primary); font-weight: 800; font-size: 22px;
    display: flex; align-items: center; justify-content: center; overflow: hidden;
    box-shadow: inset 0 0 0 1px var(--border);
}
.login-logo img { width: 100%; height: 100%; object-fit: contain; padding: 8px; }
.login-box h1 { font-size: 23px; font-weight: 800; letter-spacing: -0.02em; color: var(--text); }
.login-sub { color: var(--muted); font-size: 13.5px; margin-bottom: 24px; }
.login-box label { display: block; text-align: left; font-size: 13px; font-weight: 600; margin: 14px 0 6px; color: var(--text); }
.login-box input {
    width: 100%; padding: 13px 16px; border: 1px solid var(--border);
    border-radius: 11px; font-size: 14.5px; font-family: inherit; outline: none;
    background: #fbfcfe; transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}
.login-box input:focus { border-color: var(--primary); background: #fff; box-shadow: 0 0 0 4px var(--ring); }
.back-link { display: inline-block; margin-top: 20px; font-size: 13px; color: var(--muted); font-weight: 600; }
.back-link:hover { color: var(--primary); }

/* ===== Buttons ===== */
.btn {
    padding: 12px 22px; border: none; border-radius: 11px; cursor: pointer;
    font-size: 14px; font-weight: 600; font-family: inherit; transition: all 0.2s ease;
}
.btn-primary { background: var(--grad); color: #fff; box-shadow: 0 4px 14px rgba(22, 102, 196, 0.28); }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 10px 22px rgba(22, 102, 196, 0.34); }
.btn-block { width: 100%; margin-top: 22px; }
.btn-sm { padding: 9px 16px; font-size: 13px; border-radius: 10px; }
.btn-light { background: var(--primary-soft); color: var(--primary-dark); }
.btn-light:hover { background: #d8eafc; }
.btn-danger { background: var(--danger); color: #fff; box-shadow: 0 4px 14px rgba(220, 68, 68, 0.25); }
.btn-danger:hover { background: #c23636; transform: translateY(-1px); }

/* ===== Action bar (import / hapus) ===== */
.action-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.import-form { display: flex; align-items: center; gap: 8px; }
.import-form input[type=file] {
    font-size: 13px; border: 1px solid var(--border); border-radius: 10px;
    padding: 8px 10px; background: #fbfcfe; max-width: 260px;
}

/* ===== Alerts ===== */
.alert { padding: 14px 18px; border-radius: 12px; font-size: 14px; margin-bottom: 18px; }
.alert.error { background: #fef2f2; color: #b42318; border: 1px solid #fecdca; }
.alert.info { background: var(--grad-soft); color: var(--primary-dark); border: 1px solid rgba(22, 102, 196, 0.2); }

/* ===== Layout ===== */
.admin-wrap { display: flex; min-height: 100vh; }
.sidebar {
    width: 256px; background: var(--grad-side); color: #cfe0f3;
    display: flex; flex-direction: column; position: fixed; top: 0; bottom: 0;
    box-shadow: 4px 0 24px rgba(6, 43, 99, 0.12);
}
.sidebar-brand {
    display: flex; align-items: center; gap: 12px; padding: 22px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.logo-circle {
    width: 44px; height: 44px; border-radius: 13px; background: #fff; color: var(--primary);
    display: flex; align-items: center; justify-content: center; font-weight: 800;
    flex-shrink: 0; overflow: hidden;
}
.logo-circle img { width: 100%; height: 100%; object-fit: contain; padding: 5px; }
.sidebar-brand strong { display: block; font-size: 15px; color: #fff; font-weight: 700; }
.sidebar-brand span { font-size: 12px; opacity: 0.7; }
.sidebar-nav { flex: 1; padding: 16px 12px; display: flex; flex-direction: column; gap: 4px; }
.sidebar-nav a {
    display: flex; align-items: center; gap: 12px; padding: 12px 14px;
    font-size: 14px; font-weight: 500; border-radius: 11px; transition: all 0.18s ease;
}
.sidebar-nav a:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
.sidebar-nav a.active { background: rgba(255, 255, 255, 0.14); color: #fff; font-weight: 600; box-shadow: inset 3px 0 0 var(--accent); }
.sidebar-nav .ico { font-size: 17px; }
.sidebar-footer { padding: 16px; border-top: 1px solid rgba(255, 255, 255, 0.1); display: flex; flex-direction: column; gap: 4px; }
.sidebar-footer a { font-size: 13.5px; font-weight: 500; padding: 10px 14px; border-radius: 10px; transition: background 0.18s; }
.sidebar-footer a:hover { background: rgba(255, 255, 255, 0.08); }
.sidebar-footer .logout { color: #ffb4b4; }

.content { flex: 1; margin-left: 256px; display: flex; flex-direction: column; min-width: 0; }
.topbar {
    position: sticky; top: 0; z-index: 20;
    background: rgba(255, 255, 255, 0.85); backdrop-filter: saturate(180%) blur(12px);
    -webkit-backdrop-filter: saturate(180%) blur(12px);
    padding: 16px 30px; display: flex; align-items: center;
    justify-content: space-between; border-bottom: 1px solid var(--border);
}
.topbar h1 { font-size: 21px; font-weight: 800; letter-spacing: -0.02em; }

/* ===== Admin burger ===== */
.admin-burger {
    display: none; width: 42px; height: 42px; margin-right: 14px;
    border: 1px solid var(--border); border-radius: 11px; background: #fff;
    cursor: pointer; padding: 0; flex-direction: column; align-items: center;
    justify-content: center; gap: 5px; flex-shrink: 0; transition: all 0.2s ease;
}
.admin-burger span {
    display: block; width: 19px; height: 2px; border-radius: 2px;
    background: var(--primary); transition: transform 0.25s ease, opacity 0.2s ease;
}
.admin-burger.active span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.admin-burger.active span:nth-child(2) { opacity: 0; }
.admin-burger.active span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
.sidebar-overlay {
    display: none; position: fixed; inset: 0; z-index: 90;
    background: rgba(6, 43, 99, 0.45); opacity: 0; pointer-events: none;
    transition: opacity 0.25s ease;
}
.sidebar-overlay.show { opacity: 1; pointer-events: auto; }
.topbar-user {
    text-align: right; padding: 7px 8px 7px 18px; border-radius: 12px;
    border: 1px solid var(--border); background: #fff; display: flex;
    align-items: center; gap: 12px;
}
.topbar-user-text { display: flex; flex-direction: column; line-height: 1.25; }
.topbar-user span { font-weight: 700; font-size: 14px; }
.topbar-user small { color: var(--muted); font-size: 12px; }
.topbar-user .avatar {
    width: 38px; height: 38px; border-radius: 50%; flex-shrink: 0;
    background: var(--grad); color: #fff; display: flex; align-items: center;
    justify-content: center; font-weight: 700; font-size: 15px;
    box-shadow: 0 4px 12px rgba(22, 102, 196, 0.3);
}
.content-body { padding: 30px; flex: 1; }
.content-footer { padding: 18px 30px; text-align: center; color: var(--muted); font-size: 13px; }

/* ===== Stat cards ===== */
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.stat-card {
    background: var(--card); border-radius: var(--radius); padding: 24px;
    box-shadow: var(--shadow-sm); border: 1px solid var(--border);
    display: flex; align-items: center; gap: 18px;
    transition: transform 0.22s ease, box-shadow 0.22s ease;
}
.stat-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.stat-icon {
    width: 58px; height: 58px; border-radius: 15px; background: var(--grad); color: #fff;
    display: flex; align-items: center; justify-content: center; font-size: 26px;
    box-shadow: 0 8px 18px rgba(10, 63, 134, 0.25); flex-shrink: 0;
}
.stat-info h3 { font-size: 30px; font-weight: 800; letter-spacing: -0.02em; }
.stat-info span { color: var(--muted); font-size: 14px; }

/* ===== Data table card ===== */
.card {
    background: var(--card); border-radius: var(--radius); padding: 24px;
    box-shadow: var(--shadow-sm); border: 1px solid var(--border); margin-top: 4px;
}
.card-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; margin-bottom: 20px; }
.card-head h2 { font-size: 18px; font-weight: 700; letter-spacing: -0.01em; }
.search-bar { display: flex; gap: 8px; }
.search-bar input {
    padding: 11px 16px; border: 1px solid var(--border); border-radius: 11px;
    font-size: 14px; font-family: inherit; outline: none; min-width: 240px; background: #fbfcfe;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}
.search-bar input:focus { border-color: var(--primary); background: #fff; box-shadow: 0 0 0 4px var(--ring); }

.table-responsive { overflow-x: auto; border-radius: 12px; border: 1px solid var(--border); }
table.data { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data th, table.data td { padding: 13px 16px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
table.data th {
    background: var(--primary-soft); color: var(--primary-dark); font-weight: 600;
    position: sticky; top: 0; font-size: 12.5px; text-transform: uppercase; letter-spacing: 0.03em;
}
table.data tbody tr { transition: background 0.15s; }
table.data tbody tr:last-child td { border-bottom: none; }
table.data tbody tr:hover { background: var(--primary-soft); }
table.data td.wrap { white-space: normal; min-width: 180px; }
.muted { color: var(--muted); }
.empty { text-align: center; padding: 36px; color: var(--muted); }

/* ===== User management form ===== */
.form-grid {
    display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px 18px; align-items: end;
}
.form-field { display: flex; flex-direction: column; gap: 6px; }
.form-field label { font-size: 13px; font-weight: 600; color: var(--text); }
.form-field input {
    padding: 12px 14px; border: 1px solid var(--border); border-radius: 11px;
    font-size: 14px; font-family: inherit; outline: none; background: #fbfcfe;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}
.form-field input:focus { border-color: var(--primary); background: #fff; box-shadow: 0 0 0 4px var(--ring); }
.form-actions { grid-column: 1 / -1; }
.role-badge {
    display: inline-block; padding: 4px 12px; border-radius: 999px; font-size: 12px;
    font-weight: 600; color: var(--primary-dark); background: var(--primary-soft);
    border: 1px solid rgba(22, 102, 196, 0.18);
}
.tag-self {
    display: inline-block; margin-left: 6px; padding: 2px 9px; border-radius: 999px;
    font-size: 11px; font-weight: 700; color: var(--success); background: #e6f7ee;
}
.row-actions { display: flex; gap: 8px; }

/* ===== Pagination ===== */
.pagination { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 22px; align-items: center; }
.pagination a, .pagination span {
    padding: 9px 14px; border: 1px solid var(--border); border-radius: 10px;
    font-size: 13px; font-weight: 500; color: var(--text); background: #fff;
}
.pagination a:hover { background: var(--primary-soft); border-color: var(--primary); }
.pagination .current { background: var(--grad); color: #fff; border-color: transparent; }
.pagination .info { border: none; color: var(--muted); }

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .sidebar {
        width: 264px; z-index: 100; transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    }
    .sidebar.open { transform: translateX(0); }
    .content { margin-left: 0; }
    .admin-burger { display: flex; }
    .sidebar-overlay { display: block; }
    body.sidebar-locked { overflow: hidden; }
    .stat-grid { grid-template-columns: 1fr; }
    .topbar { padding: 14px 18px; }
    .content-body { padding: 18px; }

    /* Kelola Data: tumpuk rapi & full width */
    .action-bar { flex-direction: column; align-items: stretch; gap: 12px; }
    .action-bar > form,
    .action-bar > a { margin-left: 0 !important; width: 100%; }
    .import-form { flex-direction: column; align-items: stretch; gap: 10px; }
    .import-form input[type=file] { max-width: none; width: 100%; }
    .action-bar .btn { width: 100%; text-align: center; }

    /* Pencarian & header kartu */
    .card-head { flex-direction: column; align-items: stretch; }
    .search-bar { width: 100%; }
    .search-bar input { min-width: 0; flex: 1; }
    .topbar h1 { font-size: 18px; }
    .form-grid { grid-template-columns: 1fr; }
}
