:root {
  --navy: #1b1e4f;
  --navy-2: #2f3a8f;
  --accent: #22d89b;
  --accent-strong: #12b07c;
  --accent-bg: #e3fbf2;
  --hero-1: #2f56e8;
  --hero-2: #5b3fd6;
  --bg: #f5f6fb;
  --card: #ffffff;
  --text: #1d2433;
  --muted: #667085;
  --line: #e3e7ee;
  --ok: #12805c;
  --ok-bg: #e5f6ef;
  --warn: #a15c00;
  --warn-bg: #fff2df;
  --bad: #b42318;
  --bad-bg: #fde9e7;
  --info: #1f5fbf;
  --info-bg: #e8f0fd;
  --radius: 16px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.45 "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
button, input, select, textarea { font: inherit; }
h1, h2, h3 { margin: 0 0 8px; line-height: 1.25; }
h1 { font-size: 20px; } h2 { font-size: 17px; } h3 { font-size: 15px; }
a { color: var(--navy-2); }

.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between;
  gap: 8px; padding: 10px 16px; background: #fff; border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand img { display: block; }
.logo-full { height: 30px; width: auto; }
.logo-ikon { height: 32px; width: auto; display: none !important; }
.brand-lms { font-weight: 800; color: var(--navy); font-size: 13px; letter-spacing: .04em; border-left: 1px solid var(--line); padding-left: 10px; }
.topbar-right { display: flex; align-items: center; gap: 8px; min-width: 0; }
.user-chip { display: inline-flex; align-items: center; gap: 6px; border: 1.5px solid var(--hero-1); color: var(--hero-1); border-radius: 99px;
  padding: 5px 12px; font-size: 13px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px; }
.user-chip:empty { display: none; }
@media (max-width: 560px) {
  .logo-full, .user-chip { display: none !important; }
  .logo-ikon { display: block !important; }
}

main { max-width: 1200px; margin: 0 auto; padding: 16px; }
.pad { padding: 24px; } .center { text-align: center; } .muted { color: var(--muted); }
.small { font-size: 13px; } .mt { margin-top: 12px; } .mb { margin-bottom: 12px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.grid2 { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 640px) { .grid2 { grid-template-columns: 1fr 1fr; } }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 14px;
  box-shadow: 0 1px 2px rgba(27,30,79,.04); }
.card.narrow { max-width: 420px; margin: 24px auto; }

label { display: block; font-size: 13px; font-weight: 600; margin: 10px 0 4px; }
input, select, textarea { width: 100%; padding: 10px 12px; border: 1px solid #cdd3dd; border-radius: 9px; background: #fff; color: var(--text); }
textarea { min-height: 120px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--navy-2); outline-offset: -1px; }
.check { display: flex; gap: 8px; align-items: flex-start; font-weight: 400; }
.check input { width: auto; margin-top: 3px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 14px; border-radius: 9px;
  border: 1px solid #cdd3dd; background: #fff; color: var(--text); cursor: pointer; font-weight: 600; text-decoration: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn.accent { background: var(--accent); border-color: var(--accent); color: var(--navy); }
.btn.white { background: #fff; border-color: #fff; color: var(--hero-1); }
.btn.danger { color: var(--bad); }
.btn.sm { padding: 6px 10px; font-size: 13px; }
.btn.block { width: 100%; }
.btn.big { padding: 14px; font-size: 16px; }

.tabs { display: flex; gap: 4px; overflow-x: auto; margin-bottom: 12px; border-bottom: 1px solid var(--line); }
.tab { padding: 10px 14px; border: 0; background: none; cursor: pointer; font-weight: 600; color: var(--muted);
  border-bottom: 3px solid transparent; white-space: nowrap; }
.tab.active { color: var(--navy); border-bottom-color: var(--accent); }

.badge { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.b-hadir { background: var(--ok-bg); color: var(--ok); }
.b-izin, .b-sakit { background: var(--info-bg); color: var(--info); }
.b-alpa { background: var(--bad-bg); color: var(--bad); }
.b-belum { background: var(--warn-bg); color: var(--warn); }
.b-none { background: #eef0f4; color: var(--muted); }

.sesi-card { border-left: 5px solid var(--line); }
.sesi-card.buka { border-left-color: var(--accent); }
.sesi-card.done { border-left-color: var(--ok); }
.sesi-time { font-size: 13px; color: var(--muted); }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
td.clickable { cursor: pointer; }
td.clickable:hover { background: #f7f9fc; }
code, .kode { font-family: ui-monospace, Menlo, Consolas, monospace; font-weight: 700; }

.stat { display: flex; gap: 8px; flex-wrap: wrap; }
.stat div { background: #f7f9fc; border: 1px solid var(--line); border-radius: 9px; padding: 6px 10px; font-size: 13px; }
.stat b { font-size: 16px; }

.modal { position: fixed; inset: 0; z-index: 50; background: rgba(10,20,40,.55); display: flex; align-items: flex-end; justify-content: center; }
@media (min-width: 640px) { .modal { align-items: center; } }
.modal-box { background: #fff; width: 100%; max-width: 520px; max-height: 92vh; overflow-y: auto; border-radius: 16px 16px 0 0; padding: 16px; }
@media (min-width: 640px) { .modal-box { border-radius: 16px; } }
.hidden { display: none !important; }

.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 60; max-width: calc(100% - 32px);
  background: #1d2433; color: #fff; padding: 10px 16px; border-radius: 10px; box-shadow: 0 6px 20px rgba(0,0,0,.2); }
.toast.error { background: var(--bad); } .toast.ok { background: var(--ok); }

.alert { padding: 10px 12px; border-radius: 9px; font-size: 14px; margin: 8px 0; }
.alert.ok { background: var(--ok-bg); color: var(--ok); }
.alert.bad { background: var(--bad-bg); color: var(--bad); }
.alert.warn { background: var(--warn-bg); color: var(--warn); }
.alert.info { background: var(--info-bg); color: var(--info); }

.steps { display: flex; gap: 6px; margin-bottom: 12px; }
.steps span { flex: 1; height: 5px; border-radius: 3px; background: var(--line); }
.steps span.on { background: var(--accent); }

video, .preview-img { width: 100%; border-radius: 10px; background: #000; display: block; }
video.mirror { transform: scaleX(-1); }
.sigpad { width: 100%; height: 200px; border: 2px dashed #b9c1ce; border-radius: 10px; background: #fff; touch-action: none; display: block; }
.thumb { max-width: 100%; border-radius: 8px; border: 1px solid var(--line); }

table.rundown td { border-bottom: 1px solid var(--line); }
.rd-jam { white-space: nowrap; font-variant-numeric: tabular-nums; font-weight: 600; color: var(--navy); width: 1%; }
tr.rd-now td { background: var(--warn-bg); }
.materi-item { display: flex; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.materi-item:last-child { border-bottom: 0; }
.materi-ikon { font-size: 24px; flex: none; }
.gallery { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
@media (min-width: 640px) { .gallery { grid-template-columns: repeat(4, 1fr); } }
.gallery-item { padding: 0; border: 0; background: #eef0f4; border-radius: 8px; overflow: hidden; aspect-ratio: 1; cursor: pointer; position: relative; }
.gallery-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gallery-item .tag { position: absolute; left: 4px; top: 4px; }
.gallery-item.noimg::after { content: '🖼'; font-size: 28px; position: absolute; inset: 0; display: grid; place-items: center; }
.rd-head { display: flex; align-items: center; gap: 6px; }
.rd-head input[type=time] { flex: 1; min-width: 0; padding: 8px 6px; }
.rd-item { border: 1px solid var(--line); border-radius: 10px; padding: 10px; margin-bottom: 8px; background: #fbfcfe; }
.rd-no { width: 24px; height: 24px; border-radius: 50%; background: var(--navy); color: #fff; font-size: 12px; font-weight: 700; display: grid; place-items: center; }
.rd-edit td { padding: 4px; }
.rd-edit input { padding: 6px 8px; }
.rd-edit input[type=time] { min-width: 92px; }
.progress { height: 8px; background: var(--line); border-radius: 4px; overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--accent); width: 0; transition: width .2s; }

/* ---------- Login */
body.login-mode .topbar { display: none; }
.login-wrap { display: grid; gap: 16px; max-width: 1060px; margin: 0 auto; }
.login-hero { background: linear-gradient(160deg, #eef0ff, #f7f8ff 60%, #eafcf5); border-radius: 24px; padding: 20px; text-align: center; }
.login-logo { width: 100%; max-width: 300px; height: auto; display: block; margin: 0 auto 14px; }
.login-foto { width: 100%; max-width: 520px; height: auto; display: block; margin: 0 auto; border-radius: 18px; }
.login-card { padding: 24px; margin: 0; }
.login-card h2 { font-size: 20px; font-weight: 800; color: var(--navy); }
.login-foot { text-align: center; color: var(--muted); font-size: 12px; margin: 18px 0 0; }
.seg { display: grid; grid-template-columns: 1fr 1fr; background: #eef0f6; border-radius: 12px; padding: 4px; margin: 14px 0 6px; }
.seg button { border: 0; background: none; padding: 10px; border-radius: 9px; font-weight: 700; color: var(--muted); cursor: pointer; }
.seg button.active { background: #fff; color: var(--navy); box-shadow: 0 1px 3px rgba(27,30,79,.12); }
@media (min-width: 900px) {
  .login-wrap { grid-template-columns: 1.15fr 1fr; align-items: center; min-height: calc(100vh - 32px); }
  .login-hero { padding: 32px; text-align: left; }
  .login-logo { margin: 0 0 18px; }
  .login-card { padding: 32px; }
}

/* ---------- Komponen dashboard */
.chip { display: inline-block; padding: 4px 12px; border-radius: 99px; font-size: 12px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; }
.chip-green { background: var(--accent-bg); color: var(--accent-strong); }
.chip-blue { background: #e8edff; color: var(--hero-1); }
.chip-live { background: #ef4b5f; color: #fff; }
.chip-glass { background: rgba(255,255,255,.18); color: #fff; }

/* ---------- Shell peserta: menu samping (desktop) / menu geser (HP) */
.shell { display: block; }
.sidenav { display: flex; gap: 6px; overflow-x: auto; margin: -4px -16px 14px; padding: 4px 16px; scrollbar-width: none; }
.sidenav::-webkit-scrollbar { display: none; }
.navlink { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: #fff; color: var(--navy);
  padding: 9px 14px; border-radius: 99px; font-weight: 600; white-space: nowrap; cursor: pointer; }
.navlink.active { background: #e8edff; border-color: #c9d4ff; color: var(--hero-1); }
.nav-ic { font-size: 16px; }
.page-head h1 { font-size: 22px; font-weight: 800; color: var(--navy); margin: 0; }
.page-head p { margin: 2px 0 0; }
.page-head { margin-bottom: 14px; }
.section-title { font-size: 17px; font-weight: 800; color: var(--navy); margin: 18px 0 10px; }
@media (min-width: 900px) {
  .shell { display: grid; grid-template-columns: 240px 1fr; gap: 24px; align-items: start; }
  .sidenav { flex-direction: column; margin: 0; padding: 12px; position: sticky; top: 72px; background: #fff;
    border: 1px solid var(--line); border-radius: var(--radius); }
  .navlink { border: 0; border-radius: 10px; padding: 12px 14px; justify-content: flex-start; }
  .navlink.active { box-shadow: inset -3px 0 0 var(--hero-1); }
}

.hero { background: linear-gradient(120deg, var(--hero-1), var(--hero-2)); color: #fff; border-radius: 24px; padding: 22px;
  display: flex; flex-direction: column; gap: 16px; margin-bottom: 14px; box-shadow: 0 10px 30px rgba(47,86,232,.25); }
.hero-title { font-size: 22px; font-weight: 800; margin: 10px 0 6px; color: #fff; }
.hero-sub { opacity: .92; font-size: 14px; }
.hero-now { margin-top: 10px; background: rgba(255,255,255,.14); border-radius: 10px; padding: 8px 12px; font-size: 14px; display: inline-block; }
.hero .btn.white { width: 100%; }
@media (min-width: 700px) {
  .hero { flex-direction: row; align-items: center; justify-content: space-between; padding: 28px 32px; }
  .hero-title { font-size: 28px; }
  .hero .btn.white { width: auto; white-space: nowrap; }
}
.grid3 { display: grid; grid-template-columns: 1fr; gap: 14px; }
.grid3 .card, .grid2.split .card { margin-bottom: 0; }
.grid2.split { margin-bottom: 14px; align-items: start; }
@media (min-width: 900px) { .grid3 { grid-template-columns: repeat(3, 1fr); } }
.stat-card { padding: 20px; }
.stat-main { font-size: 17px; font-weight: 800; color: var(--navy); margin: 12px 0 4px; line-height: 1.3; }
.mini-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.mini-box { background: #f6f7fb; border-radius: 12px; padding: 10px; text-align: center; }
.mini-label { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.mini-val { font-size: 22px; font-weight: 800; color: var(--hero-1); }

#print-area { display: none; }
.cards-print { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.kartu { border: 1.5px dashed #555; border-radius: 8px; padding: 10px; break-inside: avoid; font-size: 12px; }
.kartu .kode { font-size: 18px; display: block; margin: 4px 0; }
@media print {
  body > *:not(#print-area) { display: none !important; }
  #print-area { display: block !important; }
  body { background: #fff; }
}
