/* ===== Sistem Penjurian KIK — tema teknologi ===== */
/* Orbitron untuk huruf; digit guna Rajdhani (sifar Orbitron bergaris miring & sukar dibaca) */
@font-face { font-family: 'Orbitron'; font-weight: 700; font-display: swap; src: url(fonts/orbitron-700.woff2) format('woff2'); }
@font-face { font-family: 'Orbitron'; font-weight: 900; font-display: swap; src: url(fonts/orbitron-900.woff2) format('woff2'); }
@font-face { font-family: 'KIK Digit'; font-weight: 100 900; font-display: swap; src: url(fonts/rajdhani-700.woff2) format('woff2'); unicode-range: U+0030-0039; size-adjust: 118%; }
@font-face { font-family: 'Inter'; font-weight: 100 900; font-display: swap; src: url(fonts/inter-var.woff2) format('woff2'); }
@font-face { font-family: 'JetBrains Mono'; font-weight: 600; font-display: swap; src: url(fonts/jbmono-600.woff2) format('woff2'); }

:root {
  --bg: #050816; --bg2: #0a1030; --panel: rgba(16, 24, 58, .62); --panel-solid: #0e1638; --panel2: rgba(255, 255, 255, .035);
  --line: rgba(120, 150, 255, .16); --line2: rgba(120, 150, 255, .28);
  --text: #e8ecff; --muted: #8f9bc7; --dim: #5d6a9a;
  --cyan: #22d3ee; --blue: #3b82f6; --violet: #8b5cf6; --pink: #ec4899; --green: #34d399; --amber: #fbbf24; --red: #f87171;
  --grad: linear-gradient(120deg, #22d3ee 0%, #6366f1 55%, #a855f7 100%);
  --grad-warm: linear-gradient(120deg, #fbbf24, #f97316 60%, #ec4899);
  --glow: 0 0 0 1px rgba(34, 211, 238, .25), 0 8px 32px -8px rgba(34, 211, 238, .35);
  --r: 16px; --r-sm: 10px;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --display: 'KIK Digit', 'Orbitron', 'Inter', sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, Consolas, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font); color: var(--text); background: var(--bg); font-size: 15px; line-height: 1.5;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent; overflow-x: hidden;
}
body::before { /* latar grid + cahaya */
  content: ''; position: fixed; inset: 0; z-index: -2; pointer-events: none;
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(99, 102, 241, .22), transparent 60%),
    radial-gradient(900px 500px at 110% 10%, rgba(34, 211, 238, .14), transparent 60%),
    radial-gradient(900px 700px at 50% 120%, rgba(168, 85, 247, .16), transparent 60%),
    var(--bg);
}
body::after {
  content: ''; position: fixed; inset: 0; z-index: -1; pointer-events: none; opacity: .5;
  background-image: linear-gradient(rgba(120, 150, 255, .05) 1px, transparent 1px), linear-gradient(90deg, rgba(120, 150, 255, .05) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse at 50% 30%, #000 30%, transparent 80%);
}
.bg-net { position: fixed; inset: 0; z-index: -1; pointer-events: none; }
[x-cloak] { display: none !important; }
a { color: var(--cyan); text-decoration: none; }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; }
.display { font-family: var(--display); letter-spacing: .04em; }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); } .dim { color: var(--dim); }
.grad-text { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.small { font-size: 13px; } .tiny { font-size: 11.5px; } .big { font-size: 18px; }
.upper { text-transform: uppercase; letter-spacing: .08em; }
.nowrap { white-space: nowrap; } .right { text-align: right; } .center { text-align: center; }
.row { display: flex; align-items: center; gap: 12px; } .row.wrap { flex-wrap: wrap; } .row.top { align-items: flex-start; }
.col { display: flex; flex-direction: column; gap: 12px; }
.grow { flex: 1; min-width: 0; } .between { justify-content: space-between; } .end { justify-content: flex-end; }
.gap-s { gap: 6px; } .gap-l { gap: 20px; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } .g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.mt { margin-top: 16px; } .mt-s { margin-top: 8px; } .mb { margin-bottom: 16px; } .mb-s { margin-bottom: 8px; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hide { display: none !important; }

/* ---------- Kad kaca ---------- */
.glass {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r);
  backdrop-filter: blur(14px) saturate(140%); -webkit-backdrop-filter: blur(14px) saturate(140%);
  box-shadow: 0 10px 40px -20px rgba(0, 0, 0, .8), inset 0 1px 0 rgba(255, 255, 255, .04);
}
.card { padding: 20px; }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-h h3 { font-size: 15px; font-weight: 700; letter-spacing: .02em; display: flex; align-items: center; gap: 8px; }
.card-h h3 .ti { color: var(--cyan); font-size: 18px; }
.edge { position: relative; overflow: hidden; }
.edge::before { content: ''; position: absolute; inset: 0 0 auto; height: 2px; background: var(--grad); opacity: .8; }

/* ---------- Butang ---------- */
.btn {
  appearance: none; border: 1px solid var(--line2); background: var(--panel2); color: var(--text);
  font: 600 14px/1 var(--font); padding: 11px 16px; border-radius: 12px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px;
  transition: transform .12s, background .2s, border-color .2s, box-shadow .2s, opacity .2s; user-select: none; white-space: nowrap;
}
.btn:hover { border-color: rgba(34, 211, 238, .5); background: rgba(34, 211, 238, .08); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn .ti { font-size: 18px; }
.btn.pri { background: var(--grad); border-color: transparent; color: #fff; box-shadow: 0 8px 24px -8px rgba(99, 102, 241, .7); }
.btn.pri:hover { filter: brightness(1.1); }
.btn.ok { background: linear-gradient(120deg, #10b981, #22d3ee); border-color: transparent; color: #04211a; }
.btn.warn { background: var(--grad-warm); border-color: transparent; color: #1a0b00; }
.btn.bad { border-color: rgba(248, 113, 113, .45); color: #fecaca; background: rgba(248, 113, 113, .08); }
.btn.bad:hover { background: rgba(248, 113, 113, .18); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: rgba(255, 255, 255, .06); }
.btn.sm { min-height: 34px; padding: 7px 11px; font-size: 13px; border-radius: 10px; }
.btn.lg { min-height: 54px; padding: 14px 22px; font-size: 16px; border-radius: 14px; }
.btn.icon { padding: 0; width: 42px; }
.btn.sm.icon { width: 34px; }

/* ---------- Borang ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.lbl { font-size: 12px; font-weight: 600; color: var(--muted); letter-spacing: .04em; text-transform: uppercase; }
.lbl .req { color: var(--pink); }
.inp, select.inp, textarea.inp {
  width: 100%; background: rgba(5, 8, 22, .6); border: 1px solid var(--line2); color: var(--text);
  border-radius: 12px; padding: 12px 14px; font: 500 15px/1.3 var(--font); outline: none; transition: border-color .2s, box-shadow .2s;
}
.inp:focus { border-color: var(--cyan); box-shadow: 0 0 0 4px rgba(34, 211, 238, .15); }
.inp::placeholder { color: var(--dim); }
textarea.inp { resize: vertical; min-height: 70px; line-height: 1.5; }
select.inp { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 20px) 55%, calc(100% - 14px) 55%; background-size: 6px 6px; background-repeat: no-repeat; padding-right: 36px; }
.hint { font-size: 12px; color: var(--dim); }

/* Suis */
.switch { display: inline-block; vertical-align: middle; position: relative; width: 52px; height: 30px; flex: none; cursor: pointer; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; border-radius: 99px; background: rgba(255, 255, 255, .1); border: 1px solid var(--line2); transition: .25s; }
.switch span::after { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #cbd5ff; transition: .25s cubic-bezier(.3, 1.5, .6, 1); }
.switch input:checked + span { background: var(--grad); border-color: transparent; box-shadow: 0 0 18px rgba(34, 211, 238, .45); }
.switch input:checked + span::after { transform: translateX(22px); background: #fff; }

/* Segmen */
.seg { display: inline-flex; background: rgba(5, 8, 22, .6); border: 1px solid var(--line2); border-radius: 14px; padding: 4px; gap: 4px; flex-wrap: wrap; }
.seg button { appearance: none; border: 0; background: transparent; color: var(--muted); font: 600 14px var(--font); padding: 10px 16px; border-radius: 10px; cursor: pointer; transition: .2s; min-height: 42px; }
.seg button:hover { color: var(--text); }
.seg button.on { background: var(--grad); color: #fff; box-shadow: 0 6px 18px -6px rgba(99, 102, 241, .8); }
.seg.full { display: flex; } .seg.full button { flex: 1; }

/* ---------- Cip / lencana ---------- */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 99px; font-size: 12px; font-weight: 600;
  background: rgba(255, 255, 255, .06); border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.chip .ti { font-size: 14px; }
.chip.cyan { color: #a5f3fc; border-color: rgba(34, 211, 238, .35); background: rgba(34, 211, 238, .08); }
.chip.green { color: #a7f3d0; border-color: rgba(52, 211, 153, .35); background: rgba(52, 211, 153, .1); }
.chip.amber { color: #fde68a; border-color: rgba(251, 191, 36, .35); background: rgba(251, 191, 36, .1); }
.chip.red { color: #fecaca; border-color: rgba(248, 113, 113, .35); background: rgba(248, 113, 113, .1); }
.chip.violet { color: #ddd6fe; border-color: rgba(139, 92, 246, .4); background: rgba(139, 92, 246, .12); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; display: inline-block; flex: none; }
.live-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--red); box-shadow: 0 0 0 0 rgba(248, 113, 113, .7); animation: ping 1.6s infinite; flex: none; }
.live-dot.green { background: var(--green); animation-name: ping-g; }
@keyframes ping { 0% { box-shadow: 0 0 0 0 rgba(248, 113, 113, .7); } 80%, 100% { box-shadow: 0 0 0 12px rgba(248, 113, 113, 0); } }
@keyframes ping-g { 0% { box-shadow: 0 0 0 0 rgba(52, 211, 153, .7); } 80%, 100% { box-shadow: 0 0 0 12px rgba(52, 211, 153, 0); } }

/* ---------- Jadual ---------- */
.tbl-wrap { overflow-x: auto; border-radius: 12px; border: 1px solid var(--line); }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 700;
  padding: 12px 14px; background: rgba(5, 8, 22, .55); position: sticky; top: 0; z-index: 1; white-space: nowrap; }
.tbl td { padding: 12px 14px; border-top: 1px solid var(--line); vertical-align: middle; }
.tbl tr:hover td { background: rgba(34, 211, 238, .035); }
.tbl .num { text-align: right; font-family: var(--mono); }

/* ---------- Susun atur aplikasi (pentadbir) ---------- */
.app { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; padding: 18px 14px; display: flex; flex-direction: column; gap: 6px;
  background: rgba(5, 8, 22, .72); border-right: 1px solid var(--line); backdrop-filter: blur(16px); z-index: 20; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 12px; padding: 6px 8px 18px; }
.brand .logo { width: 42px; height: 42px; border-radius: 12px; background: var(--grad); display: grid; place-items: center; box-shadow: var(--glow); flex: none; }
.brand .logo .ti { font-size: 24px; color: #fff; }
.brand b { font-family: var(--display); font-size: 15px; letter-spacing: .08em; display: block; }
.brand small { color: var(--muted); font-size: 11px; letter-spacing: .06em; }
.nav-sec { font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--dim); padding: 14px 12px 6px; font-weight: 700; }
.nav a { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 12px; color: var(--muted); font-weight: 600; font-size: 14px;
  transition: .2s; position: relative; cursor: pointer; }
.nav a .ti { font-size: 20px; }
.nav a:hover { color: var(--text); background: rgba(255, 255, 255, .04); }
.nav a.on { color: #fff; background: linear-gradient(90deg, rgba(34, 211, 238, .16), rgba(99, 102, 241, .08)); }
.nav a.on::before { content: ''; position: absolute; left: -14px; top: 10px; bottom: 10px; width: 3px; border-radius: 3px; background: var(--grad); box-shadow: 0 0 12px var(--cyan); }
.nav a .badge { margin-left: auto; }
.main { min-width: 0; padding: 22px 28px 60px; }
.topbar { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; flex-wrap: wrap; }
.topbar h1 { font-size: 24px; font-weight: 800; letter-spacing: -.01em; }
.topbar .sub { color: var(--muted); font-size: 13px; }
.menu-btn { display: none; }

/* ---------- KPI ---------- */
.kpi { padding: 18px 18px 16px; position: relative; overflow: hidden; }
.kpi .lab { font-size: 11.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 700; display: flex; align-items: center; gap: 8px; }
.kpi .val { font-family: var(--display); font-size: 34px; font-weight: 900; margin-top: 8px; letter-spacing: .02em; }
.kpi .val small { font-size: 16px; color: var(--muted); font-weight: 700; }
.kpi .foot { font-size: 12px; color: var(--muted); margin-top: 4px; }
.kpi .ico { position: absolute; right: -8px; bottom: -14px; font-size: 90px; opacity: .07; }
.bar { height: 6px; border-radius: 99px; background: rgba(255, 255, 255, .07); overflow: hidden; margin-top: 10px; }
.bar i { display: block; height: 100%; background: var(--grad); border-radius: 99px; transition: width .8s cubic-bezier(.2, .8, .2, 1); box-shadow: 0 0 12px rgba(34, 211, 238, .6); }

/* ---------- Kedudukan langsung ---------- */
.rank-list { position: relative; }
.rank-row { position: absolute; left: 0; right: 0; height: 64px; display: grid; grid-template-columns: 54px 1fr 110px 110px; align-items: center; gap: 12px;
  padding: 0 14px; border-radius: 14px; transition: transform .8s cubic-bezier(.2, .8, .2, 1), background .3s; border: 1px solid transparent; }
.rank-row.bonus { grid-template-columns: 54px 1fr 90px 80px 100px; }
.rank-row:hover { background: rgba(255, 255, 255, .03); }
.rank-row.now { background: linear-gradient(90deg, rgba(248, 113, 113, .14), transparent); border-color: rgba(248, 113, 113, .3); }
.rank-no { font-family: var(--display); font-weight: 900; font-size: 20px; width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center;
  background: rgba(255, 255, 255, .05); border: 1px solid var(--line); }
.rank-no.r1 { background: linear-gradient(135deg, #fde68a, #f59e0b); color: #3b2300; border: 0; box-shadow: 0 0 22px rgba(251, 191, 36, .55); }
.rank-no.r2 { background: linear-gradient(135deg, #f1f5f9, #94a3b8); color: #1e293b; border: 0; }
.rank-no.r3 { background: linear-gradient(135deg, #fdba74, #c2410c); color: #2b0f00; border: 0; }
.rank-no.na { color: var(--dim); font-size: 14px; }
.rank-name b { display: block; font-size: 15px; } .rank-name span { font-size: 12px; color: var(--muted); }
.rank-score { font-family: var(--display); font-weight: 900; font-size: 20px; text-align: right; }
.rank-score small { display: block; font-family: var(--font); font-size: 11px; color: var(--muted); font-weight: 600; letter-spacing: .04em; }
.flash { animation: flash 1.4s ease; }
@keyframes flash { 0% { background: rgba(34, 211, 238, .28); } 100% { background: transparent; } }

/* ---------- Matriks juri ---------- */
.mx { display: grid; gap: 4px; }
.mx .c { height: 30px; border-radius: 7px; display: grid; place-items: center; font-size: 11px; font-weight: 700; font-family: var(--mono);
  background: rgba(255, 255, 255, .04); color: var(--dim); border: 1px solid transparent; }
.mx .c.draf { background: rgba(251, 191, 36, .14); color: #fde68a; border-color: rgba(251, 191, 36, .3); }
.mx .c.dihantar { background: rgba(52, 211, 153, .16); color: #a7f3d0; border-color: rgba(52, 211, 153, .35); }
.mx .h { font-size: 11px; color: var(--muted); display: flex; align-items: center; font-weight: 600; }
.mx .hc { font-size: 11px; color: var(--muted); text-align: center; font-family: var(--mono); font-weight: 700; }

/* ---------- Modal ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(2, 4, 12, .72); backdrop-filter: blur(6px); z-index: 100; display: grid; place-items: center; padding: 20px; animation: fade .2s; }
.modal { width: min(720px, 100%); max-height: calc(100vh - 40px); overflow: auto; padding: 24px; animation: pop .28s cubic-bezier(.2, 1.3, .5, 1); background: var(--panel-solid); }
.modal.wide { width: min(1100px, 100%); }
.modal.narrow { width: min(460px, 100%); }
.modal-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.modal-h h2 { font-size: 19px; font-weight: 800; }
.modal-f { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; flex-wrap: wrap; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(14px) scale(.97); } }

/* ---------- Toast ---------- */
.toasts { position: fixed; top: 18px; right: 18px; z-index: 200; display: flex; flex-direction: column; gap: 10px; pointer-events: none; }
.toast { pointer-events: auto; min-width: 260px; max-width: 420px; padding: 13px 16px; border-radius: 14px; display: flex; gap: 10px; align-items: flex-start;
  background: #111a44; border: 1px solid var(--line2); box-shadow: 0 16px 40px -12px rgba(0, 0, 0, .8); font-size: 14px; animation: slidein .35s cubic-bezier(.2, 1.2, .5, 1); }
.toast .ti { font-size: 20px; margin-top: -1px; }
.toast.ok { border-color: rgba(52, 211, 153, .5); } .toast.ok .ti { color: var(--green); }
.toast.err { border-color: rgba(248, 113, 113, .55); } .toast.err .ti { color: var(--red); }
.toast.info .ti { color: var(--cyan); }
.toast.out { animation: slideout .3s forwards; }
@keyframes slidein { from { opacity: 0; transform: translateX(40px); } }
@keyframes slideout { to { opacity: 0; transform: translateX(40px); } }

/* ---------- Pelbagai ---------- */
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty .ti { font-size: 46px; color: var(--dim); display: block; margin-bottom: 8px; }
.sep { height: 1px; background: var(--line); margin: 16px 0; }
.spin { width: 22px; height: 22px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, .15); border-top-color: var(--cyan); animation: rot .8s linear infinite; display: inline-block; }
@keyframes rot { to { transform: rotate(360deg); } }
.ring { --p: 0; --c: var(--cyan); width: 120px; aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center; position: relative;
  background: conic-gradient(var(--c) calc(var(--p) * 1%), rgba(255, 255, 255, .07) 0); transition: --p .6s; }
.ring::before { content: ''; position: absolute; inset: 9px; border-radius: 50%; background: var(--panel-solid); }
.ring > * { position: relative; }
.kbd { font-family: var(--mono); font-size: 12px; padding: 2px 7px; border-radius: 6px; border: 1px solid var(--line2); background: rgba(255, 255, 255, .05); }
.qr-box { background: #fff; border-radius: 18px; padding: 14px; display: inline-block; line-height: 0; }
.qr-box svg { display: block; }
.scroll-y { overflow-y: auto; }
.drag { cursor: grab; color: var(--dim); } .drag:active { cursor: grabbing; }
.sortable-ghost { opacity: .35; }
.pulse-border { animation: pulseb 2s infinite; }
@keyframes pulseb { 0%, 100% { box-shadow: 0 0 0 0 rgba(248, 113, 113, .0), inset 0 0 0 1px rgba(248, 113, 113, .35); } 50% { box-shadow: 0 0 30px -4px rgba(248, 113, 113, .45), inset 0 0 0 1px rgba(248, 113, 113, .7); } }
.fade-in { animation: fadeup .5s both; }
@keyframes fadeup { from { opacity: 0; transform: translateY(10px); } }

/* ---------- Log masuk ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card { width: min(460px, 100%); padding: 32px; }
.hero-logo { width: 74px; height: 74px; border-radius: 22px; background: var(--grad); display: grid; place-items: center; margin: 0 auto 18px; box-shadow: 0 0 60px rgba(99, 102, 241, .6); animation: float 5s ease-in-out infinite; }
.hero-logo .ti { font-size: 40px; color: #fff; }
@keyframes float { 50% { transform: translateY(-8px); } }

/* ---------- Responsif (tablet / telefon) ---------- */
@media (max-width: 1100px) {
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .side { position: fixed; left: 0; top: 0; width: 270px; transform: translateX(-100%); transition: transform .3s; box-shadow: 20px 0 60px rgba(0, 0, 0, .6); }
  .side.open { transform: none; }
  .menu-btn { display: inline-flex; }
  .main { padding: 16px 16px 60px; }
  .g3 { grid-template-columns: 1fr; }
  .rank-row, .rank-row.bonus { grid-template-columns: 46px 1fr 90px; }
  .rank-row .hide-s { display: none; }
}
@media (max-width: 600px) {
  .g2, .g4 { grid-template-columns: 1fr; }
  .topbar h1 { font-size: 20px; }
  .card { padding: 16px; }
  .modal { padding: 18px; }
}
@media print {
  body::before, body::after, .bg-net, .side, .no-print { display: none !important; }
}
