:root {
    --brand: #0d5c4b;
    --brand-2: #0a7a62;
    --brand-3: #0b3f35;
    --accent: #d7a43a;
    --ink: #12211d;
    --muted: #667a74;
    --line: #e3ebe7;
    --bg: #f4f7f5;
    --surface: #ffffff;
    --surface-2: #f8faf9;
    --danger: #b42318;
    --success: #087443;
    --warning: #a15c07;
    --shadow-sm: 0 1px 2px rgba(18, 33, 29, .05);
    --shadow: 0 12px 34px rgba(18, 33, 29, .08);
    --radius: 14px;
    --sidebar-w: 268px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    font-family: "Segoe UI", "Inter", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--ink);
    font-size: 14.5px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--brand-2); text-decoration: none; }
a:hover { color: var(--brand); }
h1, h2, h3, h4, h5, h6 { color: var(--ink); font-weight: 700; letter-spacing: -.015em; }
.skip-link {
    position: absolute; left: -999px; top: 0; z-index: 9999; padding: .75rem 1rem;
    background: #fff; color: var(--brand); border-radius: .5rem;
}
.skip-link:focus { left: 1rem; top: 1rem; }
.btn-brand {
    background: linear-gradient(135deg, var(--brand), var(--brand-2));
    border: 1px solid var(--brand);
    color: #fff;
    font-weight: 600;
    border-radius: 10px;
    box-shadow: 0 6px 16px rgba(13, 92, 75, .18);
}
.btn-brand:hover, .btn-brand:focus { background: var(--brand-3); border-color: var(--brand-3); color: #fff; }
.btn-outline-brand { border-color: var(--brand); color: var(--brand); border-radius: 10px; font-weight: 600; }
.btn-outline-brand:hover { background: var(--brand); color: #fff; }
.btn-soft {
    background: #edf6f2; color: var(--brand); border: 1px solid #d6e9e2;
    border-radius: 9px; font-weight: 600;
}
.btn-soft:hover { background: #dceee7; color: var(--brand-3); }

/* Layout */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
    width: var(--sidebar-w); flex: 0 0 var(--sidebar-w);
    background: linear-gradient(180deg, #0b3f35 0%, #0d5c4b 62%, #0b4a3e 100%);
    color: #e9f4ef; position: fixed; inset: 0 auto 0 0; z-index: 1030;
    display: flex; flex-direction: column; overflow-y: auto;
    transition: transform .22s ease;
}
.sidebar-brand { display: flex; align-items: center; gap: .75rem; padding: 1.2rem 1.25rem 1rem; }
.brand-logo { width: 42px; height: 42px; object-fit: contain; filter: drop-shadow(0 3px 7px rgba(0,0,0,.22)); }
.brand-copy { display: flex; flex-direction: column; line-height: 1.1; }
.brand-copy strong { font-size: 1.1rem; letter-spacing: .14em; }
.brand-copy span { font-size: .72rem; letter-spacing: .34em; color: #a7d5c7; }
.sidebar-user {
    display: flex; align-items: center; gap: .7rem; margin: .25rem .9rem 1rem;
    padding: .75rem; background: rgba(255,255,255,.075); border: 1px solid rgba(255,255,255,.1);
    border-radius: 12px;
}
.avatar {
    width: 38px; height: 38px; border-radius: 50%; flex: 0 0 38px;
    display: grid; place-items: center; font-weight: 700; font-size: .78rem;
    background: linear-gradient(135deg, #d7a43a, #b77c16); color: #2b1a00;
    letter-spacing: .03em;
}
.avatar-sm { width: 32px; height: 32px; flex-basis: 32px; font-size: .7rem; }
.sidebar-user-copy { display: flex; flex-direction: column; min-width: 0; }
.sidebar-user-copy strong { font-size: .84rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-copy span { font-size: .7rem; color: #a7d5c7; }
.sidebar-nav { padding: .25rem .65rem 1rem; flex: 1; }
.nav-label {
    font-size: .64rem; text-transform: uppercase; letter-spacing: .14em; color: #8cc0b1;
    margin: 1rem .65rem .35rem; font-weight: 700;
}
.sidebar-nav .nav-link {
    display: flex; align-items: center; gap: .65rem; padding: .58rem .7rem;
    color: #d6e9e2; border-radius: 9px; font-size: .86rem; font-weight: 500;
    border: 0; width: 100%; background: transparent; text-align: left;
}
.sidebar-nav .nav-link i { font-size: 1rem; width: 20px; text-align: center; color: #a7d5c7; }
.sidebar-nav .nav-link:hover { background: rgba(255,255,255,.09); color: #fff; }
.sidebar-nav .nav-link.active {
    background: #fff; color: var(--brand-3); font-weight: 700;
    box-shadow: 0 5px 14px rgba(0,0,0,.16);
}
.sidebar-nav .nav-link.active i { color: var(--brand); }
.logout-form { margin: .15rem 0 0; }
.nav-button { cursor: pointer; }
.sidebar-foot {
    padding: .9rem 1.25rem 1.1rem; font-size: .68rem; color: #8cc0b1;
    display: flex; justify-content: space-between; gap: .5rem; border-top: 1px solid rgba(255,255,255,.08);
}
.sidebar-backdrop {
    display: none; position: fixed; inset: 0; background: rgba(10, 24, 20, .5); z-index: 1020;
}
.main-area {
    margin-left: var(--sidebar-w); width: calc(100% - var(--sidebar-w));
    min-height: 100vh; display: flex; flex-direction: column;
}
.topbar {
    background: rgba(255,255,255,.94); backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--line); padding: .7rem 1.5rem;
    display: flex; align-items: center; gap: 1rem; position: sticky; top: 0; z-index: 1010;
}
.topbar-title { min-width: 0; }
.topbar-title .eyebrow { display: block; font-size: .65rem; text-transform: uppercase; letter-spacing: .13em; color: var(--muted); font-weight: 700; }
.topbar-title h1 { font-size: 1.05rem; margin: .1rem 0 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: .9rem; }
.topbar-term {
    align-items: center; gap: .4rem; font-size: .74rem; color: var(--muted);
    background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; padding: .3rem .7rem;
}
.user-chip { display: flex; align-items: center; gap: .55rem; padding: .25rem .35rem; }
.user-chip-copy { display: flex; flex-direction: column; line-height: 1.15; }
.user-chip-copy strong { font-size: .8rem; }
.user-chip-copy small { font-size: .68rem; color: var(--muted); }
.icon-button {
    border: 1px solid var(--line); background: #fff; border-radius: 9px; width: 38px; height: 38px;
    display: grid; place-items: center; color: var(--brand); font-size: 1.1rem;
}
.content { padding: 1.1rem 1.5rem 2rem; flex: 1; }
.page-heading { margin: -.1rem 0 .9rem; }
.page-heading p { margin: 0; color: var(--muted); font-size: .84rem; }
.app-footer {
    padding: .85rem 1.5rem; border-top: 1px solid var(--line); color: var(--muted);
    font-size: .7rem; display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
}

/* Cards & common */
.card-box {
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
    box-shadow: var(--shadow-sm); overflow: hidden;
}
.card-box + .card-box { margin-top: 1rem; }
.card-head {
    padding: .9rem 1.1rem; border-bottom: 1px solid var(--line);
    display: flex; align-items: center; gap: .75rem; flex-wrap: wrap;
}
.card-head h2, .card-head h3 { margin: 0; font-size: .95rem; }
.card-head .card-sub { color: var(--muted); font-size: .75rem; margin: .1rem 0 0; }
.card-head .ms-auto { margin-left: auto; }
.card-body { padding: 1.1rem; }
.card-body.p-0 { padding: 0; }
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .85rem; }
.stat-card {
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
    padding: 1rem 1.1rem; box-shadow: var(--shadow-sm); position: relative; overflow: hidden;
}
.stat-card::after {
    content: ""; position: absolute; right: -22px; bottom: -30px; width: 92px; height: 92px;
    border-radius: 50%; background: radial-gradient(circle, rgba(13,92,75,.1), transparent 68%);
}
.stat-icon {
    width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center;
    background: #eaf5f0; color: var(--brand); font-size: 1.1rem; margin-bottom: .6rem;
}
.stat-icon.gold { background: #fdf3df; color: #9b6b0a; }
.stat-icon.blue { background: #e9f1fd; color: #1f5fb8; }
.stat-icon.red { background: #fdecec; color: var(--danger); }
.stat-value { font-size: 1.45rem; font-weight: 800; letter-spacing: -.03em; line-height: 1.1; }
.stat-label { color: var(--muted); font-size: .75rem; margin-top: .15rem; }
.stat-note { font-size: .68rem; color: var(--muted); margin-top: .4rem; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.grid-main { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 1rem; }
.section-title { font-size: .9rem; font-weight: 700; margin: 0 0 .7rem; display: flex; align-items: center; gap: .45rem; }
.section-title i { color: var(--brand); }

/* Tables */
.table-wrap { overflow-x: auto; }
.table-siakad { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .82rem; }
.table-siakad thead th {
    background: var(--surface-2); color: #53655f; font-size: .68rem; text-transform: uppercase;
    letter-spacing: .06em; font-weight: 700; padding: .65rem .8rem; border-bottom: 1px solid var(--line);
    white-space: nowrap;
}
.table-siakad tbody td { padding: .6rem .8rem; border-bottom: 1px solid #eef3f0; vertical-align: middle; }
.table-siakad tbody tr:hover { background: #f8fbf9; }
.table-siakad tbody tr:last-child td { border-bottom: 0; }
.table-siakad .num { text-align: right; font-variant-numeric: tabular-nums; }
.table-siakad .center { text-align: center; }
.table-siakad .name { font-weight: 600; color: var(--ink); }
.table-siakad .sub { display: block; font-size: .7rem; color: var(--muted); margin-top: .1rem; }
.table-pager {
    display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
    padding: .7rem 1rem; border-top: 1px solid var(--line); background: #fcfdfd;
}
.pager-info { color: var(--muted); font-size: .72rem; }
.pagination .page-link { color: var(--brand); border-color: var(--line); }
.pagination .page-item.active .page-link { background: var(--brand); border-color: var(--brand); color: #fff; }
.pagination .page-item.disabled .page-link { color: #aab7b2; }

/* Badges */
.badge-soft { font-weight: 600; font-size: .68rem; padding: .28rem .48rem; border-radius: 6px; }
.badge-soft.green { background: #e7f5ee; color: #087443; }
.badge-soft.blue { background: #e9f1fd; color: #1f5fb8; }
.badge-soft.gold { background: #fdf3df; color: #8a5b06; }
.badge-soft.red { background: #fdecec; color: #b42318; }
.badge-soft.gray { background: #eef2f0; color: #53655f; }
.grade-a { color: #087443; font-weight: 700; }
.grade-b { color: #1f5fb8; font-weight: 700; }
.grade-c { color: #8a5b06; font-weight: 700; }
.grade-d { color: #a15c07; font-weight: 700; }
.grade-e { color: #b42318; font-weight: 700; }
.grade-x { color: #8a9a94; font-weight: 600; }

/* Forms */
.form-label { font-size: .75rem; font-weight: 700; color: #40524c; margin-bottom: .35rem; }
.form-control, .form-select {
    border-radius: 9px; border-color: #d7e2dd; font-size: .84rem; padding: .5rem .7rem;
    background-color: #fff;
}
.form-control:focus, .form-select:focus {
    border-color: var(--brand-2); box-shadow: 0 0 0 .2rem rgba(13, 92, 75, .1);
}
.input-icon { position: relative; }
.input-icon > i {
    position: absolute; left: .75rem; top: 50%; transform: translateY(-50%);
    color: #8a9a94; font-size: .95rem; pointer-events: none;
}
.input-icon .form-control { padding-left: 2.15rem; }
.password-toggle {
    position: absolute; right: .35rem; top: 50%; transform: translateY(-50%);
    background: transparent; border: 0; color: #7b8c86; padding: .3rem .5rem; font-size: .95rem;
}
.filter-bar {
    display: flex; gap: .55rem; flex-wrap: wrap; align-items: flex-end;
    padding: .85rem 1rem; border-bottom: 1px solid var(--line); background: #fcfdfd;
}
.filter-bar .form-control, .filter-bar .form-select { min-height: 36px; }
.filter-bar .filter-item { min-width: 140px; }
.filter-bar .filter-grow { flex: 1 1 220px; }
.filter-bar .btn { min-height: 36px; }
.search-field { position: relative; }
.search-field i { position: absolute; left: .7rem; top: 50%; transform: translateY(-50%); color: #8a9a94; }
.search-field .form-control { padding-left: 2rem; }

/* Profile & detail */
.profile-hero {
    background: linear-gradient(120deg, #0b3f35, #0d5c4b 60%, #0a7a62);
    color: #fff; border-radius: var(--radius); padding: 1.25rem 1.35rem; display: flex;
    align-items: center; gap: 1rem; box-shadow: var(--shadow); position: relative; overflow: hidden;
}
.profile-hero::after {
    content: ""; position: absolute; right: -60px; top: -90px; width: 250px; height: 250px;
    border: 1px solid rgba(255,255,255,.13); border-radius: 50%;
}
.profile-avatar {
    width: 64px; height: 64px; border-radius: 16px; background: rgba(255,255,255,.14);
    border: 1px solid rgba(255,255,255,.25); display: grid; place-items: center;
    font-size: 1.3rem; font-weight: 800; color: #fff; flex: 0 0 64px;
}
.profile-hero h2 { color: #fff; font-size: 1.2rem; margin: 0 0 .2rem; }
.profile-hero p { margin: 0; color: #c7e5da; font-size: .8rem; }
.profile-meta { display: flex; gap: .45rem; flex-wrap: wrap; margin-top: .55rem; }
.profile-meta .badge-soft { background: rgba(255,255,255,.13); color: #e8f6f0; }
.info-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .1rem 1.2rem; }
.info-item { padding: .55rem 0; border-bottom: 1px dashed #edf2ef; }
.info-item span { display: block; color: var(--muted); font-size: .68rem; text-transform: uppercase; letter-spacing: .05em; }
.info-item strong { font-size: .85rem; font-weight: 600; }
.progress-thin { height: 7px; border-radius: 99px; background: #edf3f0; overflow: hidden; }
.progress-thin > span { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--brand), var(--brand-2)); }
.mini-list { list-style: none; margin: 0; padding: 0; }
.mini-list li { display: flex; justify-content: space-between; gap: 1rem; padding: .55rem 0; border-bottom: 1px dashed #edf2ef; font-size: .8rem; }
.mini-list li:last-child { border-bottom: 0; }
.mini-list .muted { color: var(--muted); }

/* Alerts */
.alert { border: 0; border-radius: 10px; font-size: .82rem; }
.alert-success { background: #e7f5ee; color: #075c37; }
.alert-danger { background: #fdecec; color: #8f1d14; }
.alert-info { background: #e9f1fd; color: #174d95; }

/* Empty state */
.empty-state { padding: 2.5rem 1rem; text-align: center; color: var(--muted); }
.empty-state i { font-size: 2rem; color: #b5c6bf; display: block; margin-bottom: .5rem; }
.empty-state strong { display: block; color: var(--ink); margin-bottom: .2rem; }

/* Login */
.login-body { background: #0b3f35; min-height: 100vh; }
.login-shell { min-height: 100vh; display: grid; grid-template-columns: 1.05fr .95fr; }
.login-brand {
    background: linear-gradient(145deg, #0b3f35 0%, #0d5c4b 55%, #0a7a62 100%);
    color: #fff; padding: 3.5rem 4rem; display: flex; align-items: center; position: relative; overflow: hidden;
}
.login-brand-inner { position: relative; z-index: 2; max-width: 470px; }
.login-logo { width: 92px; height: 92px; object-fit: contain; margin-bottom: 1.5rem; filter: drop-shadow(0 10px 18px rgba(0,0,0,.25)); }
.login-kicker { text-transform: uppercase; letter-spacing: .2em; font-size: .68rem; color: #a7d5c7; margin-bottom: .5rem; font-weight: 700; }
.login-brand h1 { color: #fff; font-size: 2.3rem; letter-spacing: .03em; margin: 0 0 .35rem; }
.login-campus { color: #d5eee5; font-size: .95rem; max-width: 390px; margin-bottom: 1.6rem; }
.login-features { list-style: none; padding: 0; margin: 0 0 2rem; }
.login-features li { display: flex; gap: .6rem; align-items: flex-start; color: #dbefe8; font-size: .84rem; margin-bottom: .65rem; }
.login-features i { color: var(--accent); margin-top: .1rem; }
.login-address { color: #9fcfbf; font-size: .75rem; display: flex; gap: .45rem; align-items: flex-start; }
.login-orbit { position: absolute; border: 1px solid rgba(255,255,255,.12); border-radius: 50%; }
.login-orbit-1 { width: 460px; height: 460px; right: -170px; bottom: -180px; }
.login-orbit-2 { width: 720px; height: 720px; right: -300px; bottom: -310px; border-color: rgba(255,255,255,.07); }
.login-panel { background: #f7faf8; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 2rem; }
.login-card {
    width: 100%; max-width: 420px; background: #fff; border: 1px solid var(--line);
    border-radius: 18px; box-shadow: 0 24px 70px rgba(18, 33, 29, .13); padding: 2rem 2rem 1.5rem;
}
.login-card-head { margin-bottom: 1.35rem; }
.login-badge {
    display: inline-flex; gap: .35rem; align-items: center; font-size: .66rem; font-weight: 700;
    color: var(--brand); background: #eaf5f0; border-radius: 999px; padding: .28rem .6rem;
    text-transform: uppercase; letter-spacing: .08em; margin-bottom: .8rem;
}
.login-card h2 { font-size: 1.35rem; margin: 0 0 .2rem; }
.login-card-head p { color: var(--muted); font-size: .82rem; margin: 0; }
.login-help { margin-top: 1.2rem; padding-top: 1rem; border-top: 1px solid var(--line); color: var(--muted); font-size: .72rem; }
.login-help strong { color: #53655f; display: block; margin-bottom: .25rem; }
.login-help p { margin: 0; }
.login-footer { color: #8a9a94; font-size: .68rem; margin-top: 1.2rem; text-align: center; }
.error-body { display: grid; place-items: center; min-height: 100vh; background: var(--bg); }
.error-card { background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 2.5rem; max-width: 440px; text-align: center; box-shadow: var(--shadow); }
.error-code { font-size: 3.2rem; font-weight: 800; color: var(--brand); letter-spacing: -.05em; line-height: 1; }
.error-card h1 { font-size: 1.2rem; margin: .7rem 0 .4rem; }
.error-card p { color: var(--muted); font-size: .85rem; }

/* Print */
.print-body { background: #fff; color: #111; font-family: "Times New Roman", serif; font-size: 11pt; }
.print-toolbar { background: #f4f7f5; border-bottom: 1px solid #ddd; padding: .7rem 1rem; display: flex; justify-content: space-between; gap: 1rem; font-family: "Segoe UI", sans-serif; }
.print-sheet { width: 210mm; min-height: 297mm; margin: 12mm auto; padding: 12mm 15mm; background: #fff; box-shadow: 0 0 14px rgba(0,0,0,.08); }
.print-head { display: flex; gap: 1rem; align-items: center; border-bottom: 2px solid #111; padding-bottom: .6rem; margin-bottom: .8rem; }
.print-head img { width: 70px; height: 70px; object-fit: contain; }
.print-head h1 { font-size: 13pt; margin: 0; letter-spacing: .02em; }
.print-head h2 { font-size: 11pt; margin: .1rem 0 0; font-weight: normal; }
.print-head p { margin: .1rem 0 0; font-size: 8.5pt; }
.print-title { text-align: center; font-weight: bold; font-size: 12pt; margin: 1rem 0 .6rem; text-decoration: underline; }
.print-meta { width: 100%; margin-bottom: .8rem; font-size: 10pt; }
.print-meta td { padding: .1rem .3rem; vertical-align: top; }
.print-table { width: 100%; border-collapse: collapse; font-size: 9.5pt; }
.print-table th, .print-table td { border: 1px solid #333; padding: .3rem .35rem; }
.print-table th { background: #f0f0f0; text-align: center; }
.print-table td.num { text-align: right; }
.print-table td.center { text-align: center; }
.print-summary { margin-top: .7rem; font-size: 10pt; }
.print-sign { margin-top: 2.2rem; display: flex; justify-content: flex-end; text-align: center; font-size: 10pt; }
.print-sign .sign-box { width: 65mm; }
.print-sign .sign-space { height: 20mm; }
.print-note { margin-top: 1rem; font-size: 8pt; color: #444; }
@media print {
    .print-toolbar { display: none; }
    .print-sheet { margin: 0; padding: 10mm 12mm; box-shadow: none; width: auto; min-height: 0; }
    @page { size: A4; margin: 10mm; }
}

/* Responsive */
@media (max-width: 1200px) {
    .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid-main { grid-template-columns: 1fr; }
}
@media (max-width: 991.98px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .sidebar-backdrop.show { display: block; }
    .main-area { margin-left: 0; width: 100%; }
    .login-shell { grid-template-columns: 1fr; }
    .login-brand { display: none; }
    .login-panel { min-height: 100vh; }
    .info-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 767.98px) {
    .content { padding: 1rem; }
    .topbar { padding: .6rem 1rem; }
    .topbar-title h1 { font-size: .95rem; }
    .stat-grid, .grid-2, .grid-3 { grid-template-columns: 1fr; }
    .info-grid { grid-template-columns: 1fr; }
    .profile-hero { flex-direction: column; align-items: flex-start; }
    .login-card { padding: 1.5rem 1.25rem; }
    .print-sheet { width: 100%; padding: 6mm; }
}
