/* =====================================================================
   PENSA Core — gaya visual
   Mengikuti sistem desain prototipe UI: neumorphism, navy + merah,
   font Mona Sans / Saira Condensed (dengan fallback sistem).
   ===================================================================== */

:root {
    --brand: #114c9e;
    --brand-strong: #0e3d7e;
    --brand-soft: #e7edf5;
    --brand-light: #5b8ff9;
    --brand-dark: #1747a6;

    --signal: #dd332b;
    --signal-strong: #b12922;
    --signal-soft: #fcebea;

    --bg: #e9edf3;
    --surface: #ffffff;
    --line: #d6dee8;

    --ink: #101828;
    --ink-soft: #344054;
    --ink-faint: #667085;

    --positive: #157347;
    --positive-soft: #e6f4ec;
    --warning: #b54708;
    --warning-soft: #fef0c7;

    --radius: 16px;
    --neu: 6px 6px 14px rgba(16, 24, 40, .10), -6px -6px 14px rgba(255, 255, 255, .9);
    --neu-sm: 4px 4px 10px rgba(16, 24, 40, .12), -4px -4px 10px rgba(255, 255, 255, .9);
    --neu-inset: inset 3px 3px 8px rgba(16, 24, 40, .08), inset -3px -3px 8px rgba(255, 255, 255, .85);
}

* { box-sizing: border-box; }

html, body {
    margin: 0; padding: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: "Mona Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- Topbar ---------- */
.topbar {
    position: sticky; top: 0; z-index: 40;
    display: flex; align-items: center; gap: 16px;
    height: 64px; padding: 0 20px;
    background: var(--brand); color: #fff;
    box-shadow: 0 4px 0 rgba(0,0,0,.08), 0 7px 16px rgba(16,24,40,.18);
}
.topbar .brand { display: flex; flex-direction: column; line-height: 1.1; }
.topbar .brand .name { font-weight: 700; font-size: 21px; letter-spacing: .5px; }
.topbar .brand .name span { font-weight: 200; }
.topbar .brand .tag { font-size: 10px; font-weight: 600; letter-spacing: .08em; color: rgba(255,255,255,.75); }
.topbar .spacer { flex: 1; }

.global-search {
    display: flex; align-items: center; gap: 8px;
    width: 280px; padding: 8px 14px; border-radius: 999px;
    background: var(--brand);
    box-shadow: inset 3px 3px 6px rgba(0,0,0,.25), inset -3px -3px 6px rgba(255,255,255,.06);
}
.global-search input {
    width: 100%; border: 0; background: transparent; outline: none;
    color: #fff; font-size: 13px; font-weight: 500;
}
.global-search input::placeholder { color: rgba(255,255,255,.45); }

.icon-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 40px; height: 40px; border-radius: 999px; border: 0; cursor: pointer;
    background: var(--brand); color: rgba(255,255,255,.78);
    box-shadow: 4px 4px 8px rgba(0,0,0,.25), -4px -4px 8px rgba(255,255,255,.06);
}
.icon-btn:hover { color: #fff; }

.user-menu { position: relative; }
.user-btn {
    display: flex; align-items: center; gap: 8px; cursor: pointer;
    padding: 4px 12px 4px 4px; border-radius: 999px; border: 0;
    background: var(--brand); color: #fff;
    box-shadow: 4px 4px 8px rgba(0,0,0,.22), -4px -4px 8px rgba(255,255,255,.05);
}
.user-btn .avatar {
    display: flex; align-items: center; justify-content: center;
    width: 32px; height: 32px; border-radius: 999px;
    background: var(--brand-dark); color: #fff; font-size: 11px; font-weight: 800;
}
.user-btn .meta { text-align: left; line-height: 1.15; }
.user-btn .meta .nm { font-size: 12.5px; font-weight: 700; }
.user-btn .meta .em { font-size: 10.5px; color: rgba(255,255,255,.55); }

.dropdown {
    position: absolute; right: 0; top: calc(100% + 8px); z-index: 50;
    min-width: 220px; padding: 6px; border-radius: var(--radius);
    background: var(--surface); border: 1px solid var(--line);
    box-shadow: 0 10px 24px rgba(16,24,40,.14);
    display: none;
}
.dropdown.open { display: block; }
.dropdown a, .dropdown button {
    display: flex; align-items: center; gap: 10px; width: 100%;
    padding: 8px 12px; border: 0; border-radius: 10px; background: none;
    font-size: 13px; font-weight: 600; color: var(--ink-soft);
    text-align: left; cursor: pointer; text-decoration: none;
}
.dropdown a:hover, .dropdown button:hover { background: var(--bg); color: var(--ink); text-decoration: none; }
.dropdown .danger { color: var(--signal-strong); }
.dropdown hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }

/* ---------- Shell ---------- */
.shell { display: flex; min-height: calc(100vh - 64px); }

.sidebar {
    position: sticky; top: 64px; align-self: flex-start;
    width: 270px; height: calc(100vh - 64px); flex-shrink: 0;
    overflow-y: auto; padding: 18px 14px;
    background: var(--bg);
    box-shadow: 8px 0 20px rgba(16,24,40,.06);
}
.nav-group { margin-bottom: 4px; }
.nav-item {
    display: flex; align-items: center; gap: 10px; width: 100%;
    padding: 11px 14px; border: 0; border-radius: var(--radius);
    font-size: 13.5px; font-weight: 500; color: var(--ink-soft);
    background: var(--bg); cursor: pointer; text-align: left;
    box-shadow: 3px 3px 7px rgba(16,24,40,.08), -3px -3px 7px rgba(255,255,255,.75);
    margin-bottom: 2px;
}
.nav-item:hover { color: var(--ink); }
.nav-item.active {
    background: linear-gradient(to bottom, var(--brand-light), var(--brand) 55%, var(--brand-dark));
    color: #fff; font-weight: 700;
    box-shadow: inset 2px 2px 4px rgba(10,16,32,.25), inset -2px -2px 4px rgba(255,255,255,.06);
}
.nav-item .chev { margin-left: auto; transition: transform .2s; font-size: 11px; opacity: .7; }
.nav-item.expanded .chev { transform: rotate(90deg); }

.nav-sub { display: none; margin: 2px 0 6px 26px; padding-left: 10px; border-left: 2px solid var(--line); }
.nav-sub.open { display: block; }
.nav-sub a {
    display: block; padding: 6px 8px; border-radius: 8px;
    font-size: 12px; font-weight: 500; color: var(--ink-soft); text-decoration: none;
}
.nav-sub a:hover { color: var(--ink); background: rgba(255,255,255,.5); text-decoration: none; }
.nav-sub a.active {
    background: var(--signal-soft); color: var(--signal-strong); font-weight: 700;
}
.nav-sub a .num { display: inline-block; width: 26px; color: var(--ink-faint); font-variant-numeric: tabular-nums; }

/* ---------- Main ---------- */
.main { flex: 1; min-width: 0; padding: 22px 28px 60px; }
.main-inner { max-width: 1240px; margin: 0 auto; }

.page-label {
    font-size: 12px; font-weight: 700; letter-spacing: .08em;
    text-transform: uppercase; color: var(--ink-faint); margin: 0 0 2px;
}
.breadcrumb { font-size: 12px; font-weight: 600; margin: 0 0 6px; color: var(--ink-faint); }
.breadcrumb .sep { margin: 0 6px; opacity: .6; }
.breadcrumb .cur { color: var(--ink); }
.page-desc { font-size: 13px; color: var(--ink-soft); margin: 0 0 18px; }

/* ---------- Cards ---------- */
.card {
    background: var(--bg); border-radius: var(--radius); padding: 20px;
    box-shadow: var(--neu); margin-bottom: 16px;
}
.card.flat { background: var(--surface); border: 1px solid var(--line); box-shadow: none; }
.card-title { font-size: 15px; font-weight: 800; margin: 0 0 14px; letter-spacing: -.01em; }
.card-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.card-head .card-title { margin: 0; }
.card-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }

/* KPI */
.kpi { background: var(--bg); border-radius: 20px; padding: 18px; box-shadow: var(--neu); }
.kpi .lbl { font-size: 10.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-faint); }
.kpi .val { font-size: 28px; font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; margin-top: 4px; }
.kpi .sub { font-size: 11.5px; color: var(--ink-faint); margin-top: 2px; }
.kpi.brand { background: var(--brand); color: #fff; }
.kpi.brand .lbl, .kpi.brand .sub { color: rgba(255,255,255,.7); }
.kpi.signal { background: var(--signal); color: #fff; }
.kpi.signal .lbl, .kpi.signal .sub { color: rgba(255,255,255,.75); }
/* kartu KPI yang dapat diklik (mis. filter status kepesertaan) */
a.kpi { display: block; text-decoration: none; color: inherit; transition: box-shadow .15s ease; }
a.kpi:hover { box-shadow: 0 8px 20px rgba(17,76,158,.16); }
a.kpi.aktif { outline: 2px solid var(--brand); outline-offset: 2px; }

/* ---------- Tabel ---------- */
.table-wrap {
    margin-top: 14px; overflow-x: auto; border-radius: 12px;
    background: var(--surface); padding: 4px; box-shadow: var(--neu-inset);
}
table.data { width: 100%; border-collapse: collapse; text-align: left; font-size: 12.5px; }
table.data thead th {
    padding: 10px 12px; border-bottom: 1px solid var(--line);
    font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
    color: var(--ink-soft); white-space: nowrap;
}
table.data tbody td { padding: 10px 12px; border-bottom: 1px solid rgba(214,222,232,.7); vertical-align: middle; }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data tbody tr:hover { background: rgba(231,237,245,.35); }
table.data .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.data .mono { font-family: "SFMono-Regular", Consolas, monospace; font-size: 12px; }
.empty { text-align: center; padding: 40px 16px; color: var(--ink-faint); font-size: 12.5px; }

/* ---------- Badge ---------- */
.badge {
    display: inline-block; padding: 3px 9px; border-radius: 7px;
    font-size: 11px; font-weight: 700; white-space: nowrap;
    background: #f2f4f7; color: var(--ink-soft);
}
.badge.ok { background: var(--positive-soft); color: var(--positive); }
.badge.warn { background: var(--warning-soft); color: var(--warning); }
.badge.bad { background: var(--signal-soft); color: var(--signal-strong); }
.badge.info { background: var(--brand-soft); color: var(--brand-strong); }
.badge.gray { background: #eaecf0; color: var(--ink-faint); }

/* ---------- Tombol ---------- */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 9px 14px; border: 0; border-radius: 12px;
    font-size: 12.5px; font-weight: 700; cursor: pointer;
    text-decoration: none; white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn-primary { background: var(--signal); color: #fff; box-shadow: 4px 4px 10px rgba(16,24,40,.2); }
.btn-primary:hover { background: var(--signal-strong); }
.btn-brand { background: var(--brand); color: #fff; box-shadow: 4px 4px 10px rgba(16,24,40,.2); }
.btn-brand:hover { background: var(--brand-strong); }
.btn-ghost { background: var(--bg); color: var(--ink-soft); box-shadow: var(--neu-sm); }
.btn-ghost:hover { color: var(--brand); }
.btn-sm { padding: 6px 10px; font-size: 11.5px; border-radius: 9px; }
.btn:disabled, .btn.disabled { opacity: .45; cursor: not-allowed; }

/* ---------- Form ---------- */
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.field > label, .field .lbl { font-size: 12px; font-weight: 600; color: var(--ink-soft); }
.field .hint { font-size: 11.5px; color: var(--ink-faint); }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=month],
input[type=number], input[type=search], input[type=file], select, textarea {
    width: 100%; padding: 9px 12px; border: 0; border-radius: 12px;
    background: var(--bg); color: var(--ink);
    font-size: 13px; font-weight: 600; font-family: inherit;
    outline: none; box-shadow: var(--neu-inset);
}
input:focus, select:focus, textarea:focus { box-shadow: var(--neu-inset), 0 0 0 2px var(--brand-soft); }
input::placeholder, textarea::placeholder { color: var(--ink-faint); font-weight: 500; }
select { appearance: none; background-image: none; }
textarea { resize: vertical; font-weight: 500; }

.form-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 4px; }
.toolbar .field { margin-bottom: 0; min-width: 170px; flex: 1 1 170px; }
.toolbar .field.wide { flex: 2 1 260px; }

/* ---------- Alert ---------- */
.alert {
    padding: 11px 15px; border-radius: var(--radius); margin-bottom: 14px;
    font-size: 12.5px; font-weight: 600;
    background: var(--surface); border-left: 4px solid var(--brand); box-shadow: var(--neu-sm);
}
.alert.ok { border-left-color: var(--positive); background: var(--positive-soft); color: #0b5132; }
.alert.info { border-left-color: var(--brand); background: var(--brand-soft); color: var(--brand-strong); }
.alert.warn { border-left-color: var(--warning); background: var(--warning-soft); color: #7a3000; }
.alert.err { border-left-color: var(--signal); background: var(--signal-soft); color: #8a1f19; }
.alert ul { margin: 6px 0 0; padding-left: 18px; }

/* ---------- Login ---------- */
.login-wrap {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    padding: 24px; background: var(--bg);
}
.login-card {
    width: 100%; max-width: 400px; padding: 34px;
    border-radius: 24px; background: var(--bg); box-shadow: var(--neu);
}
.login-card .logo { font-size: 30px; font-weight: 700; letter-spacing: .5px; }
.login-card .logo span { font-weight: 200; }
.login-card .sub { font-size: 12px; font-weight: 600; color: var(--ink-faint); margin: 4px 0 22px; }
.login-note {
    margin-top: 18px; padding: 12px; border-radius: 12px;
    background: var(--brand-soft); font-size: 11.5px; color: var(--brand-strong);
    box-shadow: var(--neu-inset);
}
.login-note b { display: block; margin-bottom: 4px; }

/* ---------- Pagination ---------- */
.pager { display: flex; align-items: center; justify-content: flex-end; gap: 6px; margin-top: 14px; font-size: 12px; }
.pager a, .pager span {
    padding: 6px 11px; border-radius: 9px; font-weight: 700;
    background: var(--bg); color: var(--ink-soft); box-shadow: var(--neu-sm); text-decoration: none;
}
.pager .cur { background: var(--brand); color: #fff; }
.pager .off { opacity: .4; }

/* ---------- Misc ---------- */
.muted { color: var(--ink-faint); }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.row-actions { display: flex; gap: 6px; white-space: nowrap; }
.section-title {
    font-size: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase;
    color: var(--ink-faint); margin: 22px 0 10px;
}
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.tabs a {
    padding: 8px 14px; border-radius: 11px; font-size: 12.5px; font-weight: 700;
    background: var(--bg); color: var(--ink-soft); box-shadow: var(--neu-sm); text-decoration: none;
}
.tabs a.active { background: var(--brand); color: #fff; }
.tabs a:hover { text-decoration: none; color: var(--brand); }
.tabs a.active:hover { color: #fff; }

@media (max-width: 900px) {
    .sidebar { display: none; }
    .main { padding: 16px; }
    .global-search { display: none; }
}
