:root {
  --bg: #f4f1ea;
  --surface: #fff;
  --ink: #1c1915;
  --muted: #6b6358;
  --line: #e4ddd2;
  --green: #143d32;
  --green-2: #1f5c4a;
  --gold: #c4a35a;
  --gold-2: #e7d7a8;
  --danger: #b42318;
  --warn: #b45309;
  --ok: #157347;
  --shadow: 0 18px 50px rgba(20, 61, 50, .08);
  --radius: 18px;
  --font: "Source Sans 3", "Segoe UI", sans-serif;
  --display: "Cormorant Garamond", Georgia, serif;
  --side: 268px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { min-height: 100%; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
}
a { color: var(--green-2); text-decoration: none; }
img { max-width: 100%; }
button, input, select, textarea { font: inherit; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--green); color: #fff; border: 0; border-radius: 12px;
  padding: 12px 18px; font-weight: 700; cursor: pointer; min-height: 46px;
}
.btn:hover { background: var(--green-2); }
.btn.gold { background: var(--gold); color: #1c1915; }
.btn.ghost { background: transparent; color: var(--green); border: 1px solid var(--line); }
.btn.danger { background: var(--danger); }
.btn.block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* Landing */
.landing {
  min-height: 100vh;
  background:
    radial-gradient(1200px 500px at 10% -10%, rgba(196,163,90,.25), transparent 50%),
    linear-gradient(165deg, #0f2f28 0%, #143d32 42%, #0b1f1a 100%);
  color: #f7f3ea;
  display: flex; flex-direction: column;
}
.landing-top { padding: 28px 24px 0; display: flex; justify-content: space-between; align-items: center; }
.landing-brand { display: flex; gap: 14px; align-items: center; }
.mark {
  width: 52px; height: 52px; border-radius: 16px;
  background: linear-gradient(135deg, var(--gold), #8d6b2a);
  color: #143d32; display: grid; place-items: center; font-weight: 800; letter-spacing: .04em;
}
.landing h1, .exam-top h1, .brand strong, .gate h1 { font-family: var(--display); }
.hero { max-width: 980px; margin: auto; padding: 48px 24px 80px; }
.hero h1 { font-size: clamp(2.2rem, 5vw, 4.2rem); line-height: 1.05; margin: 12px 0 16px; }
.hero p.lead { font-size: 1.15rem; color: #d9d0c0; max-width: 640px; }
.role-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-top: 36px; }
.role-card {
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.12);
  border-radius: 22px; padding: 22px; color: inherit; backdrop-filter: blur(10px);
  display: block; min-height: 160px;
}
.role-card:hover { border-color: var(--gold); transform: translateY(-2px); transition: .2s ease; }
.role-card b { display: block; font-size: 1.2rem; margin-bottom: 6px; }
.role-card span { color: #d7cbb8; font-size: .95rem; }

.gate {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background: linear-gradient(180deg, #f7f4ee, #efe8d9);
}
.gate-card {
  width: min(440px, 100%); background: #fff; border-radius: 28px; padding: 32px 28px;
  box-shadow: var(--shadow); border: 1px solid var(--line);
}
.gate-card h1 { font-size: 2rem; margin: 8px 0 6px; }
.hint { color: var(--muted); font-size: .92rem; margin-bottom: 22px; }
label { display: block; font-weight: 600; font-size: .88rem; margin: 12px 0 6px; }
input[type=text], input[type=password], input[type=number], input[type=date], input[type=time], select, textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: #fff;
}
textarea { min-height: 120px; }
.field-lg input { font-size: 1.35rem; letter-spacing: .12em; text-align: center; text-transform: uppercase; }

/* Siswa home */
.siswa-wrap { max-width: 860px; margin: 0 auto; padding: 20px 16px 80px; }
.siswa-head { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin-bottom: 18px; }
.exam-card {
  background: #fff; border-radius: 22px; padding: 18px; margin-bottom: 12px;
  border: 1px solid var(--line); display: flex; justify-content: space-between; gap: 12px; align-items: center;
}
.exam-card h3 { font-size: 1.05rem; }
.badge { display: inline-block; background: #eef6f1; color: var(--green); border-radius: 999px; padding: 3px 10px; font-size: .75rem; font-weight: 700; }
.badge.warn { background: #fff4e0; color: #8a4b00; }
.badge.live { background: #dcfce7; color: #166534; }

/* Exam room */
.exam-app { min-height: 100vh; background: #f7f5f0; display: flex; flex-direction: column; }
.exam-top {
  background: var(--green); color: #fff; padding: 10px 14px;
  display: flex; justify-content: space-between; align-items: center; gap: 10px; position: sticky; top: 0; z-index: 20;
}
.timer { font-variant-numeric: tabular-nums; font-weight: 800; font-size: 1.25rem; background: rgba(0,0,0,.18); padding: 6px 12px; border-radius: 12px; }
.exam-body { flex: 1; padding: 16px 14px 120px; max-width: 860px; width: 100%; margin: 0 auto; }
.q-card { background: #fff; border-radius: 24px; padding: 22px 18px; box-shadow: var(--shadow); }
.q-no { color: var(--gold); font-weight: 800; letter-spacing: .08em; font-size: .8rem; }
.q-text { font-size: 1.18rem; margin: 10px 0 18px; white-space: pre-wrap; }
.opt {
  display: flex; gap: 12px; width: 100%; text-align: left; background: #fbfaf7;
  border: 2px solid var(--line); border-radius: 16px; padding: 14px; margin-bottom: 10px; cursor: pointer;
}
.opt.on { border-color: var(--green); background: #e9f4ef; }
.opt i {
  width: 36px; height: 36px; border-radius: 50%; background: var(--green); color: #fff;
  display: grid; place-items: center; font-style: normal; font-weight: 800; flex-shrink: 0;
}
.exam-bar {
  position: fixed; left: 0; right: 0; bottom: 0; background: #fff; border-top: 1px solid var(--line);
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); display: flex; gap: 8px; justify-content: space-between;
}
.nav-dots { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 0 16px; }
.nav-dots button {
  width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--line); background: #fff; cursor: pointer; font-weight: 700;
}
.nav-dots button.fill { background: var(--green); color: #fff; border-color: var(--green); }
.nav-dots button.ragu { background: #f59e0b; color: #fff; border-color: #f59e0b; }
.nav-dots button.now { outline: 2px solid var(--gold); }

/* Admin */
.admin-body { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--side); background: var(--green); color: #efe7d6; padding: 22px 16px;
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; gap: 10px; align-items: center; margin-bottom: 22px; }
.brand-mark {
  width: 42px; height: 42px; border-radius: 12px; background: var(--gold); color: var(--green);
  display: grid; place-items: center; font-weight: 800;
}
.brand small { display: block; opacity: .75; font-size: .75rem; }
.sidebar nav { display: flex; flex-direction: column; gap: 4px; overflow: auto; flex: 1; }
.sidebar nav a { color: #e8dfcf; padding: 9px 12px; border-radius: 10px; font-size: .92rem; }
.sidebar nav a.on, .sidebar nav a:hover { background: rgba(255,255,255,.1); color: #fff; }
.side-user { padding-top: 14px; border-top: 1px solid rgba(255,255,255,.12); font-size: .85rem; display: flex; justify-content: space-between; }
.side-user a { color: var(--gold-2); }
.main { flex: 1; min-width: 0; }
.top { display: flex; justify-content: space-between; align-items: center; padding: 22px 28px 0; }
.top h1 { font-family: var(--display); font-size: 2rem; }
.content { padding: 18px 28px 48px; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.stat {
  background: #fff; border-radius: 18px; padding: 16px; border: 1px solid var(--line);
}
.stat b { display: block; font-size: 1.8rem; font-family: var(--display); color: var(--green); }
.card { background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 18px; margin-bottom: 16px; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.flash { padding: 12px 14px; border-radius: 12px; margin-bottom: 14px; }
.flash.is-ok { background: #e9f7ef; color: #14532d; }
.flash.is-err { background: #fdecec; color: #7f1d1d; }
.pill { background: var(--gold-2); color: #3d2c0a; border-radius: 999px; padding: 4px 10px; font-size: .78rem; font-weight: 700; text-transform: uppercase; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.checkline { display: flex; gap: 8px; align-items: center; margin: 8px 0; font-weight: 500; }

/* Monitor */
.mon-body { background: #0d1210; color: #e8efe9; }
.mon-body .sidebar { background: #101816; }
.mon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.cam-tile {
  background: #151c19; border-radius: 16px; overflow: hidden; border: 1px solid #24302b; position: relative;
}
.cam-tile img { width: 100%; aspect-ratio: 4/3; object-fit: cover; background: #000; display: block; }
.cam-tile .cams { display: grid; grid-template-columns: 1fr 1fr; }
.cam-meta { padding: 8px 10px; font-size: .8rem; display: flex; justify-content: space-between; }
.cam-tile.alert { border-color: #f87171; box-shadow: 0 0 0 1px #f87171; }
.live-dot { width: 8px; height: 8px; background: #22c55e; border-radius: 50%; display: inline-block; margin-right: 4px; animation: blink 1.4s infinite; }
@keyframes blink { 50% { opacity: .35; } }

.print-sheet { background: #fff; color: #000; padding: 18px 22px; max-width: 900px; margin: 0 auto; }
.print-sheet h1, .print-sheet h2 { font-family: var(--display); }
.kop { display: flex; justify-content: space-between; align-items: center; border-bottom: 3px double #000; padding-bottom: 8px; margin-bottom: 14px; }
.kop h1 { font-size: 1.3rem; }
@media print {
  .no-print { display: none !important; }
  body { background: #fff; }
  .print-sheet { box-shadow: none; }
}

@media (max-width: 860px) {
  .admin-body { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: relative; }
  .sidebar nav { flex-direction: row; flex-wrap: wrap; }
  .row-2, .row-3 { grid-template-columns: 1fr; }
  .content, .top { padding-left: 16px; padding-right: 16px; }
  .exam-card, .siswa-head { flex-direction: column; align-items: stretch; }
}
