:root {
  --blue: #2563eb;
  --blue-dark: #1d4ed8;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --bg: #f6f8fb;
  --panel: #ffffff;
  --ok: #16a34a;
  --warn: #d97706;
  --danger: #dc2626;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: Inter, system-ui, -apple-system, Segoe UI, sans-serif; color: var(--ink); background: var(--bg); }
a { color: inherit; text-decoration: none; }
.auth-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: linear-gradient(135deg, #dbeafe 0%, #f8fafc 50%, #eff6ff 100%); }
.login-card { width: min(430px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 28px; box-shadow: 0 24px 70px rgba(15, 23, 42, .12); }
.brand { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.brand-mark { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; color: #fff; background: var(--blue); font-weight: 800; }
.brand h1 { font-size: 20px; margin: 0; }
.brand p { margin: 3px 0 0; color: var(--muted); font-size: 13px; }
.app { min-height: 100vh; display: grid; grid-template-columns: 278px 1fr; transition: grid-template-columns .2s ease; }
.sidebar { background: #0f172a; color: #dbeafe; padding: 22px 16px; position: sticky; top: 0; height: 100vh; overflow-y: auto; scrollbar-width: none; z-index: 40; transition: width .2s ease, padding .2s ease, transform .22s ease; }
.sidebar::-webkit-scrollbar { width: 0; height: 0; }
.sidebar-collapsed .app { grid-template-columns: 78px 1fr; }
.sidebar-collapsed .sidebar { padding: 18px 10px; }
.sidebar .brand { color: #fff; margin-bottom: 26px; }
.sidebar-collapsed .sidebar .brand { justify-content: center; margin-bottom: 18px; }
.sidebar-collapsed .sidebar .brand > div:not(.brand-mark), .sidebar-collapsed .nav-label, .sidebar-collapsed .nav-copy, .sidebar-collapsed .year-switcher label, .sidebar-collapsed .year-switcher select { display: none; }
.sidebar-collapsed .nav a { justify-content: center; min-height: 44px; padding: 9px; }
.sidebar-collapsed .nav a::before { left: 4px; }
.year-switcher { display: grid; gap: 7px; margin: 0 0 18px; padding: 12px; border: 1px solid rgba(148, 163, 184, .20); border-radius: 12px; background: rgba(15, 23, 42, .34); }
.year-switcher label { color: #cbd5e1; font-size: 11px; font-weight: 900; text-transform: uppercase; letter-spacing: .08em; }
.year-switcher select { min-height: 40px; border: 1px solid rgba(148, 163, 184, .35); background: #111827; color: #fff; border-radius: 10px; padding: 8px 10px; }
.nav { display: grid; gap: 6px; }
.nav-label { margin: 14px 10px 5px; color: #94a3b8; font-size: 11px; font-weight: 900; text-transform: uppercase; letter-spacing: .08em; }
.nav a { position: relative; display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 9px 12px 9px 16px; border-radius: 10px; color: #cbd5e1; font-weight: 700; font-size: 14px; border: 1px solid transparent; }
.nav a::before { content: ""; position: absolute; left: 7px; top: 11px; bottom: 11px; width: 3px; border-radius: 999px; background: transparent; }
.nav-icon { flex: 0 0 30px; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 9px; background: rgba(148, 163, 184, .14); color: #e0f2fe; font-size: 11px; font-weight: 900; letter-spacing: .02em; }
.nav-copy { min-width: 0; display: grid; gap: 2px; }
.nav-title { color: inherit; line-height: 1.1; }
.nav-desc { color: #94a3b8; font-size: 11px; font-weight: 700; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav a:hover { color: #fff; background: rgba(37, 99, 235, .16); }
.nav a.active { color: #fff; background: rgba(37, 99, 235, .30); border-color: rgba(147, 197, 253, .18); box-shadow: inset 0 0 0 1px rgba(255,255,255,.04); }
.nav a.active::before { background: #38bdf8; }
.nav a.active .nav-icon { background: rgba(56, 189, 248, .20); color: #fff; }
.sidebar-collapsed .nav a[data-tip]::after { content: attr(data-tip); position: fixed; left: 76px; width: max-content; max-width: 260px; padding: 9px 11px; border-radius: 10px; background: #0f172a; color: #fff; border: 1px solid rgba(148, 163, 184, .25); box-shadow: 0 16px 40px rgba(15,23,42,.22); font-size: 12px; font-weight: 800; opacity: 0; transform: translateY(2px); pointer-events: none; transition: opacity .14s ease, transform .14s ease; z-index: 80; }
.sidebar-collapsed .nav a[data-tip]:hover::after { opacity: 1; transform: translateY(0); }
.sidebar-shade { display: none; }
.main { min-width: 0; }
.topbar { height: 72px; background: rgba(255,255,255,.88); border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; padding: 0 26px; position: sticky; top: 0; z-index: 5; backdrop-filter: blur(12px); }
.topbar h2 { margin: 0; font-size: 22px; }
.sidebar-toggle { display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--line); background: #fff; color: var(--ink); border-radius: 10px; padding: 9px 12px; font-weight: 900; cursor: pointer; }
.userbox { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 14px; }
.content { padding: 26px; }
.grid { display: grid; gap: 16px; }
.stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 18px; box-shadow: 0 10px 24px rgba(15, 23, 42, .05); }
.stat-label { color: var(--muted); font-size: 13px; font-weight: 700; text-transform: uppercase; }
.stat-value { font-size: 30px; font-weight: 800; margin-top: 8px; }
.dashboard-hero { display: grid; grid-template-columns: minmax(0, 1fr) 250px auto; gap: 18px; align-items: center; margin-bottom: 18px; padding: 22px; border: 1px solid #dbeafe; border-radius: 14px; background: linear-gradient(135deg, #ffffff 0%, #eff6ff 58%, #ecfeff 100%); box-shadow: 0 16px 44px rgba(15, 23, 42, .07); }
.dashboard-hero h3 { margin: 5px 0 6px; font-size: 24px; }
.dashboard-hero p { margin: 0; color: var(--muted); max-width: 680px; }
.eyebrow { color: var(--blue-dark); font-size: 12px; font-weight: 900; text-transform: uppercase; letter-spacing: .08em; }
.hero-score { background: rgba(255,255,255,.76); border: 1px solid rgba(37, 99, 235, .14); border-radius: 12px; padding: 14px; }
.hero-score span { display: block; color: var(--muted); font-weight: 800; font-size: 12px; text-transform: uppercase; }
.hero-score strong { display: block; margin: 6px 0 10px; font-size: 30px; line-height: 1; }
.progress { height: 9px; overflow: hidden; border-radius: 999px; background: #dbeafe; }
.progress span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--blue), #10b981); transition: width .2s ease; }
.hero-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.dashboard-stats { grid-template-columns: repeat(4, minmax(180px, 1fr)); }
.stat-card { position: relative; overflow: hidden; min-height: 146px; border: 1px solid var(--line); border-radius: 14px; padding: 16px; background: #fff; box-shadow: 0 12px 30px rgba(15, 23, 42, .06); }
.stat-card::after { content: ""; position: absolute; right: -26px; top: -34px; width: 118px; height: 118px; border-radius: 999px; opacity: .13; background: var(--blue); }
.stat-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.stat-icon { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 11px; color: #fff; background: var(--blue); font-size: 12px; font-weight: 900; }
.stat-chip { position: relative; z-index: 1; color: var(--muted); background: #f8fafc; border: 1px solid var(--line); border-radius: 999px; padding: 4px 8px; font-size: 11px; font-weight: 900; }
.stat-card .stat-value { margin-top: 4px; font-size: 34px; letter-spacing: 0; }
.stat-note { margin-top: 7px; color: var(--muted); font-size: 12px; font-weight: 700; }
.stat-emerald .stat-icon, .stat-emerald::after, .stat-green .stat-icon, .stat-green::after { background: #10b981; }
.stat-cyan .stat-icon, .stat-cyan::after { background: #06b6d4; }
.stat-indigo .stat-icon, .stat-indigo::after { background: #4f46e5; }
.stat-amber .stat-icon, .stat-amber::after { background: #f59e0b; }
.stat-violet .stat-icon, .stat-violet::after { background: #8b5cf6; }
.dashboard-charts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 18px; }
.chart-card { min-width: 0; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 16px; box-shadow: 0 12px 30px rgba(15, 23, 42, .06); }
.chart-wide { grid-column: span 1; }
.chart-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.chart-head h3 { margin: 0; font-size: 16px; }
.chart-head p { margin: 4px 0 0; color: var(--muted); font-size: 12px; font-weight: 700; }
.chart-card canvas { display: block; width: 100%; border-radius: 10px; background: linear-gradient(180deg, #fff 0%, #f8fafc 100%); }
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 24px 0 12px; }
.section-head h3 { margin: 0; font-size: 18px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.toolbar input, .toolbar select, .toolbar .select-search { width: auto; min-width: 180px; }
.toolbar input[name="q"] { min-width: min(360px, 100%); flex: 1 1 280px; }
.per-page-select { max-width: 150px; }
.row-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row-actions form { margin: 0; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.field { display: grid; gap: 7px; }
label { font-size: 13px; color: #334155; font-weight: 700; }
input, select, textarea { width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px; font: inherit; background: #fff; }
textarea { min-height: 108px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 3px solid #bfdbfe; border-color: var(--blue); }
.checkline { min-height: 44px; display: inline-flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); }
.checkline input { width: auto; }
.select-search { position: relative; width: 100%; }
.select-search-native { position: absolute; inset: 0; opacity: 0; pointer-events: none; }
.select-search-trigger { width: 100%; min-height: 44px; border: 1px solid var(--line); border-radius: 10px; padding: 10px 40px 10px 12px; background: #fff; color: var(--ink); font: inherit; text-align: left; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.select-search-trigger::after { content: ""; position: absolute; right: 14px; top: 18px; border-left: 5px solid transparent; border-right: 5px solid transparent; border-top: 6px solid var(--muted); }
.select-search.open .select-search-trigger { outline: 3px solid #bfdbfe; border-color: var(--blue); }
.select-search-panel { display: none; position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 6px); background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 18px 42px rgba(15, 23, 42, .16); padding: 8px; }
.select-search.open .select-search-panel { display: block; }
.select-search-input { margin-bottom: 8px; }
.select-search-list { max-height: 240px; overflow: auto; display: grid; gap: 4px; }
.select-search-option { border: 0; border-radius: 8px; background: transparent; padding: 9px 10px; font: inherit; text-align: left; cursor: pointer; color: var(--ink); }
.select-search-option:hover, .select-search-option.selected { background: #eff6ff; color: var(--blue-dark); }
.select-search-option:disabled { color: var(--muted); cursor: not-allowed; }
.select-search-empty { padding: 10px; color: var(--muted); font-size: 14px; }
.btn { border: 0; border-radius: 10px; padding: 10px 14px; font-weight: 800; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn-primary { background: var(--blue); color: white; }
.btn-primary:hover { background: var(--blue-dark); }
.btn-light { background: #e2e8f0; color: var(--ink); }
.btn-danger { background: var(--danger); color: white; }
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th, td { padding: 13px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; font-size: 14px; }
th { background: #f8fafc; color: #334155; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.badge { display: inline-flex; padding: 5px 9px; border-radius: 999px; font-size: 12px; font-weight: 800; }
.badge.draft { background: #f1f5f9; color: #475569; }
.badge.terkirim { background: #dbeafe; color: #1d4ed8; }
.badge.diverifikasi, .badge.aktif { background: #dcfce7; color: #15803d; }
.badge.info, .badge.hadir { background: #e0f2fe; color: #0369a1; }
.badge.sakit { background: #fef3c7; color: #b45309; }
.badge.izin { background: #ecfeff; color: #0e7490; }
.badge.nonaktif, .badge.alpa { background: #fee2e2; color: #b91c1c; }
.badge.terlambat { background: #ffedd5; color: #c2410c; }
.attendance-exceptions { border: 1px dashed var(--line); border-radius: 12px; padding: 12px; background: #f8fafc; }
.attendance-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 10px; }
.attendance-head p { margin: 4px 0 0; font-size: 13px; }
.attendance-rows { display: grid; gap: 9px; }
.attendance-row { display: grid; grid-template-columns: minmax(220px, 1.4fr) minmax(130px, .7fr) minmax(180px, 1fr) auto; gap: 8px; align-items: center; }
.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin: 18px 0 8px; }
.tab-button { border: 1px solid var(--line); background: #fff; color: var(--muted); border-radius: 10px; padding: 10px 14px; font-weight: 900; cursor: pointer; }
.tab-button.active { color: #fff; background: var(--blue); border-color: var(--blue); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }
.alert { padding: 12px 14px; border-radius: 10px; margin-bottom: 14px; font-weight: 700; }
.alert-success { background: #dcfce7; color: #166534; }
.alert-error { background: #fee2e2; color: #991b1b; }
.pager-nav { margin-top: 16px; }
.pagination { list-style: none; margin: 0; padding: 0; display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.pagination a, .pagination strong, .pagination span { display: inline-flex; min-width: 38px; height: 38px; align-items: center; justify-content: center; padding: 0 12px; border: 1px solid var(--line); background: #fff; border-radius: 10px; font-weight: 800; font-size: 13px; }
.pagination a:hover, .pagination .active strong { border-color: var(--blue); background: var(--blue); color: #fff; }
.pagination span { color: #94a3b8; background: #f8fafc; }
.detail-list { display: grid; grid-template-columns: 180px 1fr; gap: 10px 16px; }
.jurnal-photo { width: min(420px, 100%); max-height: 280px; object-fit: cover; border-radius: 12px; border: 1px solid var(--line); }
.muted { color: var(--muted); }
.full { grid-column: 1 / -1; }
.modal-lock { overflow: hidden; }
.modal { display: none; position: fixed; inset: 0; z-index: 100; }
.modal.open { display: block; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(15, 23, 42, .54); backdrop-filter: blur(4px); }
.modal-panel { position: relative; width: min(760px, calc(100vw - 32px)); max-height: calc(100vh - 40px); overflow: auto; margin: 20px auto; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 24px 80px rgba(15, 23, 42, .28); padding: 18px; }
.modal-wide { width: min(980px, calc(100vw - 32px)); }
.modal-sm { width: min(460px, calc(100vw - 32px)); }
.modal-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; border-bottom: 1px solid var(--line); padding-bottom: 12px; margin-bottom: 16px; }
.modal-head h3 { margin: 0; font-size: 18px; }
.modal-close { width: 36px; height: 36px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--muted); font-weight: 900; cursor: pointer; }
.modal-form { display: grid; gap: 16px; }
.modal-actions { display: flex; justify-content: flex-end; align-items: center; gap: 10px; padding-top: 12px; border-top: 1px solid var(--line); }
.field-error { color: var(--danger); font-size: 12px; font-weight: 700; }
@media (max-width: 920px) {
  .app { grid-template-columns: 1fr; }
  .sidebar-collapsed .app { grid-template-columns: 1fr; }
  .sidebar-collapsed .sidebar { padding: 22px 16px; }
  .sidebar-collapsed .sidebar .brand { justify-content: flex-start; margin-bottom: 26px; }
  .sidebar-collapsed .sidebar .brand > div:not(.brand-mark), .sidebar-collapsed .nav-label, .sidebar-collapsed .year-switcher label, .sidebar-collapsed .year-switcher select { display: initial; }
  .sidebar-collapsed .nav-copy { display: grid; }
  .sidebar-collapsed .nav a { justify-content: flex-start; padding: 11px 12px 11px 16px; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: min(320px, 88vw); height: 100vh; transform: translateX(-105%); transition: transform .22s ease; box-shadow: 18px 0 48px rgba(15, 23, 42, .24); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-shade { display: none; position: fixed; inset: 0; z-index: 35; background: rgba(15, 23, 42, .48); }
  .sidebar-shade.open { display: block; }
  .topbar { gap: 12px; justify-content: flex-start; }
  .topbar h2 { flex: 1; font-size: 18px; min-width: 0; }
  .userbox span { display: none; }
  .stats, .form-grid, .dashboard-stats, .dashboard-charts, .dashboard-hero { grid-template-columns: 1fr; }
  .hero-actions { justify-content: flex-start; }
  .dashboard-hero h3 { font-size: 20px; }
  .attendance-head, .attendance-row { grid-template-columns: 1fr; }
  .attendance-head { display: grid; }
  .topbar { padding: 0 16px; }
  .content { padding: 16px; }
  .modal-panel { margin: 12px auto; max-height: calc(100vh - 24px); }
  .modal-actions { flex-direction: column; align-items: stretch; }
}
