@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@500;600;700;800;900&family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

/* ============================================================
   POLLING SEKOLAH — Design System "Full Color"
   Modern • Profesional • Penuh Warna
   ============================================================ */

:root {
  --bg: #f1f5f9;
  --card: #ffffff;
  --ink: #0f172a;
  --ink-2: #475569;
  --ink-3: #94a3b8;
  --line: #e2e8f0;

  --primary: #6366f1;
  --primary-2: #8b5cf6;
  --purple: #a855f7;
  --pink: #ec4899;
  --rose: #f43f5e;
  --blue: #3b82f6;
  --sky: #0ea5e9;
  --teal: #14b8a6;
  --green: #22c55e;
  --amber: #f59e0b;
  --orange: #f97316;
  --red: #ef4444;

  --grad-hero: linear-gradient(135deg, #6366f1 0%, #a855f7 50%, #ec4899 100%);
  --grad-1: linear-gradient(135deg, #6366f1, #8b5cf6);
  --grad-2: linear-gradient(135deg, #0ea5e9, #6366f1);
  --grad-3: linear-gradient(135deg, #14b8a6, #0ea5e9);
  --grad-4: linear-gradient(135deg, #f59e0b, #f97316);
  --grad-5: linear-gradient(135deg, #ec4899, #f43f5e);
  --grad-6: linear-gradient(135deg, #22c55e, #14b8a6);
  --grad-7: linear-gradient(135deg, #8b5cf6, #ec4899);
  --grad-8: linear-gradient(135deg, #f43f5e, #f59e0b);

  --radius: 16px;
  --shadow-sm: 0 1px 3px rgba(15, 23, 42, .08);
  --shadow: 0 4px 16px rgba(15, 23, 42, .08);
  --shadow-lg: 0 12px 32px rgba(99, 102, 241, .18);

  --sidebar-w: 250px;
  --font: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Outfit', 'Plus Jakarta Sans', sans-serif;
}

/* Kelas tema warna polling — dipakai banner kartu, header halaman isi,
   kotak tema di builder, dsb. (mengacu variabel --grad-N di atas) */
.grad-1 { background: var(--grad-1); }
.grad-2 { background: var(--grad-2); }
.grad-3 { background: var(--grad-3); }
.grad-4 { background: var(--grad-4); }
.grad-5 { background: var(--grad-5); }
.grad-6 { background: var(--grad-6); }
.grad-7 { background: var(--grad-7); }
.grad-8 { background: var(--grad-8); }

* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.55;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { line-height: 1.25; font-family: var(--font-display); }

::selection { background: rgba(139, 92, 246, .25); }

/* ============ LOGIN ============ */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(1000px 600px at 85% -5%, rgba(236, 72, 153, .28), transparent 65%),
    radial-gradient(900px 650px at -10% 105%, rgba(99, 102, 241, .25), transparent 65%),
    radial-gradient(700px 500px at 50% 50%, rgba(14, 165, 233, .12), transparent 70%),
    linear-gradient(135deg, #f0f4ff 0%, #fdf2f8 50%, #f5f3ff 100%);
  padding: 24px;
  position: relative;
}

.login-card {
  width: 100%;
  max-width: 425px;
  background: var(--card);
  border-radius: 26px;
  box-shadow:
    0 24px 50px -12px rgba(99, 102, 241, 0.25),
    0 12px 24px -8px rgba(236, 72, 153, 0.16),
    0 0 0 1px rgba(255, 255, 255, 0.8) inset;
  overflow: hidden;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.login-hero {
  position: relative;
  background: linear-gradient(145deg, #4338ca 0%, #6366f1 28%, #8b5cf6 62%, #d946ef 100%);
  color: #fff;
  padding: 36px 28px 30px;
  text-align: center;
  overflow: hidden;
}

/* Background decorative orbs & mesh */
.hero-bg-shapes {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 1;
}

.hero-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(35px);
  pointer-events: none;
}

.hero-orb-1 {
  width: 180px;
  height: 180px;
  top: -45px;
  right: -35px;
  background: radial-gradient(circle, rgba(244, 114, 182, 0.7), rgba(217, 70, 239, 0.2));
  animation: floatOrb 8s ease-in-out infinite alternate;
}

.hero-orb-2 {
  width: 190px;
  height: 190px;
  bottom: -45px;
  left: -45px;
  background: radial-gradient(circle, rgba(56, 189, 248, 0.6), rgba(99, 102, 241, 0.2));
  animation: floatOrb 9s ease-in-out infinite alternate-reverse;
}

.hero-grid-pattern {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, 0.15) 1.2px, transparent 1.2px);
  background-size: 16px 16px;
  opacity: 0.85;
}

.login-hero-content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Pill badge on top */
.login-pill-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.16);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.32);
  padding: 5px 14px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #ffffff;
  margin-bottom: 16px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.login-pill-badge .badge-sparkle {
  font-size: 12px;
  line-height: 1;
  filter: drop-shadow(0 0 6px rgba(255, 235, 59, 0.85));
}

/* Glassmorphic Icon Box */
.login-icon-box {
  position: relative;
  width: 68px;
  height: 68px;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.icon-glow-ring {
  position: absolute;
  inset: -4px;
  border-radius: 24px;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.65), rgba(255, 255, 255, 0.1), rgba(244, 114, 182, 0.65));
  filter: blur(5px);
  opacity: 0.75;
}

.icon-inner {
  position: relative;
  width: 100%;
  height: 100%;
  background: rgba(255, 255, 255, 0.22);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1.5px solid rgba(255, 255, 255, 0.45);
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow:
    0 10px 25px -4px rgba(49, 46, 129, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.6);
  animation: floatIcon 4s ease-in-out infinite;
}

.brand-svg-icon {
  width: 40px;
  height: 40px;
  display: block;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.22));
}

/* Brand Typography */
.login-brand-title {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: #ffffff;
  margin: 0 0 6px 0;
  line-height: 1.15;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.brand-highlight {
  background: linear-gradient(135deg, #fef08a 0%, #fde047 40%, #f59e0b 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  display: inline-block;
  font-weight: 900;
  filter: drop-shadow(0 2px 8px rgba(245, 158, 11, 0.45));
}

.login-brand-subtitle {
  font-size: 13.5px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.94);
  line-height: 1.55;
  max-width: 320px;
  margin: 0 auto;
  letter-spacing: -0.01em;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

@keyframes floatIcon {
  0%, 100% {
    transform: translateY(0) rotate(0deg);
  }
  50% {
    transform: translateY(-5px) rotate(1.5deg);
  }
}

@keyframes floatOrb {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(15px, 15px) scale(1.1); }
}

.login-body {
  padding: 30px 32px 34px;
}

.login-body .field {
  margin-bottom: 18px;
}

.login-body .field > span {
  font-size: 13.5px;
  font-weight: 600;
  color: #334155;
  margin-bottom: 7px;
  display: block;
}

.login-body input[type="text"],
.login-body input[type="password"] {
  height: 46px;
  font-size: 14.5px;
  border-radius: 12px;
  border: 1.5px solid #e2e8f0;
  background: #f8fafc;
  padding: 0 16px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.login-body input[type="text"]:focus,
.login-body input[type="password"]:focus {
  background: #ffffff;
  border-color: #6366f1;
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.16);
}

.login-body .btn-primary {
  height: 48px;
  font-size: 15.5px;
  font-weight: 700;
  letter-spacing: -0.01em;
  border-radius: 13px;
  background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 50%, #a855f7 100%);
  box-shadow: 0 8px 20px -4px rgba(99, 102, 241, 0.45);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.login-body .btn-primary:hover {
  transform: translateY(-1.5px);
  box-shadow: 0 12px 24px -4px rgba(99, 102, 241, 0.55);
}

.login-body .btn-primary:active {
  transform: translateY(0.5px);
}

/* ============ LAYOUT ADMIN/SISWA ============ */
.shell { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  background: linear-gradient(180deg, #312e81 0%, #4c1d95 55%, #6b21a8 100%);
  color: #fff;
  position: fixed;
  inset: 0 auto 0 0;
  display: flex;
  flex-direction: column;
  z-index: 50;
  transition: transform .25s ease;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 12px;
  padding: 22px 20px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, .12);
}
.sidebar-brand .logo {
  width: 42px; height: 42px; border-radius: 13px;
  background: linear-gradient(135deg, #ec4899, #f59e0b);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .25);
}
.sidebar-brand b { font-size: 16px; display: block; }
.sidebar-brand span { font-size: 11.5px; opacity: .75; }

.nav { padding: 14px 12px; display: flex; flex-direction: column; gap: 4px; flex: 1; overflow-y: auto; }
.nav-label {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .12em;
  color: rgba(255, 255, 255, .5); padding: 14px 12px 6px;
}
.nav a {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 13px;
  border-radius: 11px;
  color: rgba(255, 255, 255, .82);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  transition: background .15s;
}
.nav a .ic { font-size: 17px; width: 22px; text-align: center; }
.nav a:hover { background: rgba(255, 255, 255, .1); color: #fff; text-decoration: none; }
.nav a.active { background: rgba(255, 255, 255, .18); color: #fff; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .12); }

.sidebar-foot {
  border-top: 1px solid rgba(255, 255, 255, .12);
  padding: 14px 16px;
  display: flex; align-items: center; gap: 11px;
}
.avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: linear-gradient(135deg, #0ea5e9, #22c55e);
  color: #fff; font-weight: 700; font-size: 14px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.sidebar-foot .who { flex: 1; min-width: 0; }
.sidebar-foot .who b { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-foot .who span { font-size: 11px; opacity: .7; }
.btn-logout {
  background: rgba(255, 255, 255, .12);
  border: none; color: #fff; width: 34px; height: 34px;
  border-radius: 10px; cursor: pointer; font-size: 15px;
  transition: background .15s;
}
.btn-logout:hover { background: rgba(239, 68, 68, .55); }
.btn-key:hover { background: rgba(99, 102, 241, .6); }

.main {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.topbar {
  background: rgba(255, 255, 255, .85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  padding: 14px 28px;
  display: flex; align-items: center; gap: 16px;
  position: sticky; top: 0; z-index: 40;
}
.topbar h1 { font-size: 19px; font-weight: 700; }
.topbar .sub { font-size: 12.5px; color: var(--ink-3); }
.topbar .right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.content { padding: 26px 28px 60px; max-width: 1280px; width: 100%; }

.menu-btn {
  display: none;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 10px; width: 38px; height: 38px;
  font-size: 18px; cursor: pointer;
}

/* ============ KOMPONEN UMUM ============ */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--line);
}
.card .card-head {
  padding: 18px 22px 0;
  display: flex; align-items: center; gap: 12px;
}
.card .card-head h3 { font-size: 16px; }
.card .card-head .right { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.card .card-body { padding: 18px 22px 22px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: none; cursor: pointer;
  font-family: var(--font); font-size: 14px; font-weight: 600;
  padding: 10px 18px;
  border-radius: 11px;
  text-decoration: none;
  transition: filter .15s, transform .05s, box-shadow .15s;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--grad-1); color: #fff; box-shadow: 0 4px 14px rgba(99, 102, 241, .35); }
.btn-success { background: var(--grad-6); color: #fff; box-shadow: 0 4px 14px rgba(34, 197, 94, .3); }
.btn-danger { background: linear-gradient(135deg, #ef4444, #f43f5e); color: #fff; box-shadow: 0 4px 14px rgba(239, 68, 68, .3); }
.btn-warn { background: linear-gradient(135deg, #f59e0b, #f97316); color: #fff; box-shadow: 0 4px 14px rgba(245, 158, 11, .3); }
.btn-ghost { background: #fff; color: var(--ink-2); border: 1.5px solid var(--line); }
.btn-ghost:hover { border-color: var(--primary); color: var(--primary); }
.btn-sm { padding: 7px 13px; font-size: 13px; border-radius: 9px; }
.btn-lg { padding: 13px 26px; font-size: 15px; border-radius: 13px; }

.btn-icon {
  width: 34px; height: 34px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: #fff; border: 1.5px solid var(--line);
  border-radius: 9px; cursor: pointer; font-size: 15px; color: var(--ink-2);
  transition: all .15s;
}
.btn-icon:hover { border-color: var(--primary); color: var(--primary); }
.btn-icon.danger:hover { border-color: var(--red); color: var(--red); background: #fef2f2; }

label.field { display: block; margin-bottom: 15px; }
label.field > span, .field-label {
  display: block; font-size: 13px; font-weight: 600; color: var(--ink-2);
  margin-bottom: 6px;
}
input[type="text"], input[type="password"], input[type="number"], input[type="search"],
select, textarea {
  width: 100%;
  font-family: var(--font); font-size: 14.5px;
  padding: 10px 14px;
  border: 1.5px solid var(--line);
  border-radius: 11px;
  background: #fff;
  color: var(--ink);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, .12);
}
textarea { resize: vertical; min-height: 80px; }

.hint { font-size: 12px; color: var(--ink-3); margin-top: 4px; }
.error-text { color: var(--red); font-size: 13px; margin-top: 8px; display: none; }
.error-text.show { display: block; }

/* Badges / chips */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11.5px; font-weight: 700;
  padding: 4px 11px;
  border-radius: 999px;
  white-space: nowrap;
}
.badge.dot::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge.green { background: #dcfce7; color: #15803d; }
.badge.red { background: #fee2e2; color: #b91c1c; }
.badge.amber { background: #fef3c7; color: #b45309; }
.badge.blue { background: #dbeafe; color: #1d4ed8; }
.badge.purple { background: #f3e8ff; color: #7e22ce; }
.badge.pink { background: #fce7f3; color: #be185d; }
.badge.slate { background: #f1f5f9; color: #475569; }

/* Stat cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
  margin-bottom: 26px;
}
.stat-card {
  border-radius: var(--radius);
  padding: 20px 22px;
  color: #fff;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.stat-card .ic {
  position: absolute; right: 14px; top: 14px;
  width: 44px; height: 44px;
  background: rgba(255, 255, 255, .22);
  border-radius: 13px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
}
.stat-card .val { font-size: 30px; font-weight: 800; line-height: 1.1; }
.stat-card .lbl { font-size: 13px; opacity: .92; margin-top: 3px; font-weight: 500; }
.stat-card .trend { font-size: 12px; margin-top: 10px; opacity: .9; }
.stat-card::after {
  content: '';
  position: absolute; right: -30px; bottom: -40px;
  width: 130px; height: 130px;
  background: rgba(255, 255, 255, .1);
  border-radius: 50%;
}

/* Tabel */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--line); background: #fff; box-shadow: var(--shadow-sm); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 640px; }
.tbl thead th {
  text-align: left;
  font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--ink-3);
  background: #f8fafc;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.tbl tbody td { padding: 12px 16px; border-bottom: 1px solid #f1f5f9; vertical-align: middle; }
.tbl tbody tr:last-child td { border-bottom: none; }
.tbl tbody tr:hover { background: #f8fafc; }
.tbl .u-name b { display: block; }
.tbl .u-name span { font-size: 12px; color: var(--ink-3); }

/* Progress bar */
.pbar {
  background: #eef2f7;
  border-radius: 999px;
  height: 9px;
  overflow: hidden;
  min-width: 90px;
}
.pbar > i {
  display: block; height: 100%;
  background: var(--grad-6);
  border-radius: 999px;
  transition: width .6s cubic-bezier(.22, 1, .36, 1);
}
.pbar.blue > i { background: var(--grad-2); }
.pbar.pink > i { background: var(--grad-5); }
.pbar.amber > i { background: var(--grad-4); }
.pbar.purple > i { background: var(--grad-7); }

/* Polling card list (siswa & admin) */
.poll-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 20px; }
.poll-card {
  background: #fff;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  display: flex; flex-direction: column;
  transition: transform .18s, box-shadow .18s;
}
.poll-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.poll-card .banner {
  height: 86px;
  display: flex; align-items: flex-end;
  padding: 14px 18px;
  color: #fff;
}
.poll-card .banner .emoji { font-size: 34px; margin-left: auto; filter: drop-shadow(0 2px 6px rgba(0,0,0,.25)); }
.poll-card .banner h3 { font-size: 15.5px; text-shadow: 0 1px 4px rgba(0,0,0,.25); }
.poll-card .p-body { padding: 16px 18px; flex: 1; display: flex; flex-direction: column; gap: 10px; }
.poll-card .p-desc {
  color: var(--ink-2); font-size: 13.5px;
  display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.poll-card .p-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; }
.poll-card .p-foot { padding: 13px 18px; border-top: 1px solid #f1f5f9; display: flex; gap: 8px; align-items: center; }

/* ============ FORM PENGGISIAN (Google-Forms-like) ============ */
.fill-wrap { max-width: 780px; margin: 0 auto; }
.fill-hero {
  border-radius: var(--radius) var(--radius) 0 0;
  color: #fff;
  padding: 30px 30px 26px;
}
.fill-hero .badge { background: rgba(255,255,255,.25); color: #fff; margin-bottom: 10px; }
.fill-hero h2 { font-size: 23px; font-weight: 800; }
.fill-hero p { opacity: .92; font-size: 14px; margin-top: 6px; }
.q-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 22px 24px;
  margin-top: 16px;
  box-shadow: var(--shadow-sm);
}
.q-card .q-head { display: flex; gap: 10px; align-items: flex-start; }
.q-num {
  min-width: 30px; height: 30px; padding: 0 6px;
  border-radius: 9px;
  background: var(--grad-1);
  color: #fff; font-weight: 700; font-size: 13.5px;
  display: inline-flex; align-items: center; justify-content: center;
}
.q-title { font-size: 15.5px; font-weight: 700; }
.q-desc { font-size: 13px; color: var(--ink-3); margin-top: 2px; }
.req-star { color: var(--red); font-weight: 800; margin-left: 3px; }

.opt-row {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px;
  border: 1.5px solid var(--line);
  border-radius: 11px;
  margin-top: 10px;
  cursor: pointer;
  transition: all .13s;
  font-size: 14.5px;
}
.opt-row:hover { border-color: var(--primary); background: #f5f6ff; }
.opt-row.selected {
  border-color: var(--primary);
  background: #eef0ff;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, .12);
}
.opt-row input { width: 18px; height: 18px; accent-color: var(--primary); cursor: pointer; flex-shrink: 0; }

.scale-row { display: flex; gap: 8px; margin-top: 14px; flex-wrap: wrap; }
.scale-opt {
  flex: 1; min-width: 52px;
  text-align: center;
  padding: 12px 6px;
  border: 1.5px solid var(--line);
  border-radius: 11px;
  cursor: pointer;
  font-weight: 700; font-size: 15px;
  color: var(--ink-2);
  transition: all .13s;
}
.scale-opt:hover { border-color: var(--primary); color: var(--primary); }
.scale-opt.selected {
  background: var(--grad-1); color: #fff; border-color: transparent;
  box-shadow: 0 4px 12px rgba(99, 102, 241, .4);
}
.scale-caption { display: flex; justify-content: space-between; font-size: 12px; color: var(--ink-3); margin-top: 6px; }

/* ============ HASIL / CHART ============ */
.chart-row { margin-top: 14px; }
.chart-row .c-label {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 13.5px; margin-bottom: 5px;
}
.chart-row .c-label b { font-weight: 600; }
.chart-row .c-label .c-val { color: var(--ink-3); font-size: 12.5px; white-space: nowrap; }
.chart-bar {
  background: #eef2f7;
  height: 26px;
  border-radius: 8px;
  overflow: hidden;
}
.chart-bar > i {
  display: flex; align-items: center; justify-content: flex-end;
  height: 100%;
  min-width: 0;
  border-radius: 8px;
  color: #fff;
  font-size: 11.5px; font-weight: 700;
  padding-right: 8px;
  transition: width .7s cubic-bezier(.22, 1, .36, 1);
  white-space: nowrap;
}
.winner { outline: 2.5px solid #f59e0b; outline-offset: 1px; }

.donut-wrap { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.donut {
  width: 150px; height: 150px;
  border-radius: 50%;
  background: conic-gradient(var(--grad-1));
  display: flex; align-items: center; justify-content: center;
  position: relative;
  flex-shrink: 0;
}
.donut::after {
  content: '';
  position: absolute;
  width: 106px; height: 106px;
  background: #fff;
  border-radius: 50%;
}
.donut .d-val {
  position: relative; z-index: 1;
  text-align: center;
}
.donut .d-val b { font-size: 26px; display: block; line-height: 1.1; }
.donut .d-val span { font-size: 11.5px; color: var(--ink-3); }
.legend { display: flex; flex-direction: column; gap: 9px; min-width: 170px; flex: 1; }
.legend .lg-row { display: flex; align-items: center; gap: 9px; font-size: 13.5px; }
.legend .lg-dot { width: 12px; height: 12px; border-radius: 4px; flex-shrink: 0; }
.legend .lg-row b { margin-left: auto; font-size: 13px; }

.live-dot {
  display: inline-flex; align-items: center; gap: 7px;
  background: #dcfce7; color: #15803d;
  padding: 5px 13px; border-radius: 999px;
  font-size: 12.5px; font-weight: 700;
}
.live-dot::before {
  content: '';
  width: 9px; height: 9px; border-radius: 50%;
  background: #22c55e;
  animation: pulse 1.6s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(34, 197, 94, .55); }
  70% { box-shadow: 0 0 0 9px rgba(34, 197, 94, 0); }
  100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

/* Tabs */
.tabs {
  display: flex; gap: 6px;
  border-bottom: 2px solid var(--line);
  margin-bottom: 22px;
  flex-wrap: wrap;
}
.tab {
  border: none; background: none; cursor: pointer;
  font-family: var(--font); font-size: 14px; font-weight: 600;
  color: var(--ink-3);
  padding: 10px 18px;
  border-radius: 10px 10px 0 0;
  position: relative; top: 2px;
  transition: color .15s;
}
.tab:hover { color: var(--ink); }
.tab.active { color: var(--primary); }
.tab.active::after {
  content: '';
  position: absolute; left: 0; right: 0; bottom: -2px;
  height: 3px;
  background: var(--grad-1);
  border-radius: 3px;
}

/* ============ BUILDER ============ */
.builder-q {
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.builder-q .bq-head {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px;
  background: #f8fafc;
  border-bottom: 1px solid var(--line);
}
.builder-q .bq-head .grip { color: var(--ink-3); font-size: 16px; cursor: grab; }
.builder-q .bq-head .q-tag {
  font-size: 12px; font-weight: 700;
  background: var(--grad-7);
  color: #fff;
  padding: 3px 10px;
  border-radius: 7px;
}
.builder-q .bq-head .spacer { flex: 1; }
.builder-q .bq-body { padding: 18px 20px; }
.builder-q textarea.title-input {
  font-size: 16.5px; font-weight: 700;
  border: none; border-bottom: 2px solid var(--line);
  border-radius: 0; padding: 6px 2px;
  background: transparent;
}
.builder-q textarea.title-input:focus { box-shadow: none; border-bottom-color: var(--primary); }
.opt-editor { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.opt-editor .oe-letter {
  width: 26px; height: 26px;
  border-radius: 8px;
  background: #eef0ff; color: var(--primary);
  font-size: 12.5px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

.type-menu { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.type-menu button {
  border: 1.5px solid var(--line);
  background: #fff;
  border-radius: 12px;
  padding: 12px;
  cursor: pointer;
  text-align: left;
  font-family: var(--font);
  transition: all .15s;
}
.type-menu button:hover { border-color: var(--primary); background: #f5f6ff; transform: translateY(-2px); }
.type-menu .t-ic {
  width: 36px; height: 36px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; color: #fff; margin-bottom: 8px;
}
.type-menu b { font-size: 13.5px; display: block; color: var(--ink); }
.type-menu span { font-size: 11.5px; color: var(--ink-3); }

.switch { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; user-select: none; font-size: 13.5px; font-weight: 600; color: var(--ink-2); }
.switch input { display: none; }
.switch .track {
  width: 40px; height: 22px;
  background: #cbd5e1;
  border-radius: 999px;
  position: relative;
  transition: background .18s;
  flex-shrink: 0;
}
.switch .track::after {
  content: '';
  position: absolute;
  width: 16px; height: 16px;
  background: #fff; border-radius: 50%;
  top: 3px; left: 3px;
  transition: left .18s;
  box-shadow: 0 1px 3px rgba(0,0,0,.25);
}
.switch input:checked + .track { background: var(--green); }
.switch input:checked + .track::after { left: 21px; }

/* ============ MODAL & TOAST ============ */
.modal-back {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, .55);
  backdrop-filter: blur(3px);
  z-index: 100;
  display: none;
  align-items: center; justify-content: center;
  padding: 20px;
}
.modal-back.show { display: flex; }
.modal {
  background: #fff;
  border-radius: 20px;
  width: 100%; max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 24px 64px rgba(15, 23, 42, .35);
  animation: modalIn .22s cubic-bezier(.22, 1, .36, 1);
}
@keyframes modalIn { from { opacity: 0; transform: translateY(18px) scale(.97); } to { opacity: 1; transform: none; } }
.modal .m-head {
  padding: 20px 24px 0;
  display: flex; align-items: center; gap: 10px;
}
.modal .m-head h3 { font-size: 17px; }
.modal .m-head .btn-icon { margin-left: auto; }
.modal .m-body { padding: 18px 24px; }
.modal .m-foot { padding: 0 24px 22px; display: flex; gap: 10px; justify-content: flex-end; }

.toast-wrap { position: fixed; top: 18px; right: 18px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast {
  display: flex; align-items: center; gap: 10px;
  background: #fff;
  border-radius: 13px;
  padding: 13px 18px;
  box-shadow: 0 10px 32px rgba(15, 23, 42, .22);
  border-left: 5px solid var(--primary);
  font-size: 14px; font-weight: 500;
  min-width: 260px; max-width: 380px;
  animation: toastIn .3s cubic-bezier(.22, 1, .36, 1);
}
.toast.ok { border-left-color: var(--green); }
.toast.err { border-left-color: var(--red); }
.toast.info { border-left-color: var(--primary); }
@keyframes toastIn { from { opacity: 0; transform: translateX(30px); } to { opacity: 1; transform: none; } }

/* Import report */
.import-report { font-size: 14px; }
.import-report .ir-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  border-radius: 10px;
  margin-bottom: 8px;
  font-weight: 600;
}
.import-report .ir-row.green { background: #dcfce7; color: #15803d; }
.import-report .ir-row.blue { background: #dbeafe; color: #1d4ed8; }
.import-report .ir-row.amber { background: #fef3c7; color: #b45309; }
.import-report .ir-row.red { background: #fee2e2; color: #b91c1c; }
.import-report .ir-row b { margin-left: auto; font-size: 17px; }
.ir-errors {
  max-height: 160px; overflow-y: auto;
  background: #fef2f2;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 12.5px; color: #b91c1c;
  margin-top: 6px;
}
.ir-errors div { padding: 2px 0; }

/* Empty state */
.empty {
  text-align: center;
  padding: 54px 20px;
  color: var(--ink-3);
}
.empty .e-ic { font-size: 46px; margin-bottom: 10px; }
.empty b { display: block; color: var(--ink-2); font-size: 15.5px; margin-bottom: 4px; }
.empty p { font-size: 13.5px; }

/* Skeleton loading */
.skeleton {
  background: linear-gradient(90deg, #eef2f7 25%, #f8fafc 50%, #eef2f7 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: 10px;
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* Util */
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; }
.mb-2 { margin-bottom: 16px; }
.text-muted { color: var(--ink-3); font-size: 13px; }
.right { margin-left: auto; }
.center { text-align: center; }
.hide { display: none !important; }

/* ============ RESPONSIVE ============ */

/* --- Tablet & HP: sidebar jadi drawer luar kanvas --- */
@media (max-width: 900px) {
  html { overflow-x: hidden; } /* jaring pengaman: elemen lebar tidak boleh membuat scroll horizontal */
  .sidebar { transform: translateX(-100%); width: min(250px, 82vw); }
  .sidebar.open { transform: none; }
  .main { margin-left: 0; }
  .menu-btn { display: inline-flex; align-items: center; justify-content: center; }
  .content { padding: 18px 16px 50px; }
  .topbar { padding: 12px 16px; flex-wrap: wrap; row-gap: 10px; }
  .topbar > div { min-width: 0; }
  .topbar .right { flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .sidebar-overlay {
    position: fixed; inset: 0;
    background: rgba(15, 23, 42, .45);
    z-index: 45;
    display: none;
  }
  .sidebar-overlay.show { display: block; }
  /* baris filter di atas tabel disusun vertikal di layar sempit */
  .content > .row, .card-body.row { flex-direction: column; align-items: stretch; gap: 10px; }
  .content > .row > select, .card-body.row > select { width: auto !important; }
}

/* --- HP besar (≤700px) --- */
@media (max-width: 700px) {
  /* iOS Safari otomatis zoom saat fokus ke input < 16px — samakan 16px */
  input[type="text"], input[type="password"], input[type="number"], input[type="search"],
  select, textarea { font-size: 16px; }
  /* minmax(330px) melebihi lebar layar HP → kartu terpotong; pakai 1 kolom */
  .poll-list { grid-template-columns: 1fr; gap: 14px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  /* jumlah kartu ganjil (cth: 3 statistik siswa) → terakhir melebar penuh */
  .stats-grid > :last-child:nth-child(odd) { grid-column: 1 / -1; }
  .topbar h1 { font-size: 17px; }
}

/* --- HP (≤640px) --- */
@media (max-width: 640px) {
  .content { padding: 14px 12px 60px; }
  .topbar { padding: 10px 12px; }
  .topbar h1 { font-size: 16px; }
  .topbar .sub { font-size: 11.5px; }

  /* kepala kartu: aksi turun ke baris sendiri di bawah judul */
  .card .card-head { flex-wrap: wrap; padding: 14px 14px 0; }
  .card .card-head .right { margin-left: 0; width: 100%; justify-content: flex-start; flex-wrap: wrap; }
  .card .card-head .right input[type="search"] { width: 100% !important; }
  .card .card-body { padding: 14px; }

  /* statistik versi ringkas */
  .stat-card { padding: 14px; border-radius: 13px; }
  .stat-card .val { font-size: 23px; }
  .stat-card .lbl { font-size: 11.5px; }
  .stat-card .ic { width: 36px; height: 36px; font-size: 17px; border-radius: 10px; right: 10px; top: 10px; }

  /* kartu polling */
  .poll-card .banner { height: 68px; padding: 12px 14px; }
  .poll-card .banner .emoji { font-size: 26px; }
  .poll-card .banner h3 { font-size: 14px; }
  .poll-card .p-body { padding: 13px 14px; gap: 8px; }
  .poll-card .p-foot { padding: 11px 14px; flex-wrap: wrap; }

  /* login */
  .login-wrap { padding: 14px; }
  .login-card { border-radius: 20px; }
  .login-hero { padding: 28px 18px 24px; }
  .login-icon-box { width: 60px; height: 60px; margin-bottom: 12px; }
  .brand-svg-icon { width: 34px; height: 34px; }
  .login-brand-title { font-size: 25px; }
  .login-brand-subtitle { font-size: 12.5px; max-width: 280px; }
  .login-body { padding: 22px 20px 26px; }

  /* form pengisian polling */
  .fill-hero { padding: 20px 16px 18px; border-radius: 13px 13px 0 0; }
  .fill-hero h2 { font-size: 19px; }
  .q-card { padding: 15px 14px; border-radius: 13px; }
  .q-title { font-size: 14.5px; }
  .opt-row { padding: 10px 12px; font-size: 14px; }
  .scale-opt { min-width: 44px; padding: 10px 4px; }
  .submit-bar { flex-wrap: wrap; }
  .submit-bar .btn { width: 100%; }
  .submit-bar .text-muted { width: 100%; text-align: center; }

  /* tabel: rapikan padding (tetap bisa geser horizontal) */
  .tbl thead th, .tbl tbody td { padding: 10px 12px; }
  .table-wrap { -webkit-overflow-scrolling: touch; }

  /* modal */
  .modal-back { padding: 10px; }
  .modal { border-radius: 16px; }
  .modal .m-head { padding: 16px 16px 0; }
  .modal .m-body { padding: 14px 16px; }
  .modal .m-foot { padding: 0 16px 18px; flex-wrap: wrap; }
  .modal .m-foot .btn { flex: 1 1 auto; }

  /* toast melebar penuh di layar sempit */
  .toast-wrap { left: 10px; right: 10px; top: 10px; }
  .toast { min-width: 0; max-width: none; }

  /* builder polling */
  .builder-q .bq-head { flex-wrap: wrap; padding: 10px 12px; }
  .builder-q .bq-body { padding: 13px; }
  .opt-editor { flex-wrap: wrap; }
  .opt-editor select { width: auto !important; flex: 1 1 130px; }
  .opt-editor input[type="text"] { flex: 1 1 150px; }
  .type-menu { grid-template-columns: repeat(2, 1fr); }

  /* halaman hasil */
  .tabs .tab { padding: 9px 12px; font-size: 13px; }
  .donut-wrap { justify-content: center; }
  .donut { width: 130px; height: 130px; }
  .donut::after { width: 92px; height: 92px; }
  .legend { min-width: 0; width: 100%; }
}

/* --- HP kecil (≤380px, cth: iPhone SE) --- */
@media (max-width: 380px) {
  .stats-grid { gap: 10px; }
  .stat-card .val { font-size: 20px; }
  .topbar .right .btn, .btn-sm { padding: 7px 10px; font-size: 12.5px; }
  .type-menu { grid-template-columns: 1fr; }
}

/* ============================================================
   KAHOOT-STYLE LIVE RESULTS & PRESENTATION STAGE
   ============================================================ */

/* Spring bounce & keyframe animations */
@keyframes kahootSpring {
  0% { transform: scaleY(0); }
  60% { transform: scaleY(1.08); }
  80% { transform: scaleY(0.96); }
  100% { transform: scaleY(1); }
}

@keyframes crownFloat {
  0%, 100% { transform: translateY(0) rotate(0deg) scale(1); }
  50% { transform: translateY(-8px) rotate(-4deg) scale(1.1); }
}

@keyframes winnerGlow {
  0%, 100% { filter: drop-shadow(0 0 10px rgba(255, 193, 7, 0.7)); }
  50% { filter: drop-shadow(0 0 24px rgba(255, 193, 7, 0.95)); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-9px); }
  40%, 80% { transform: translateX(9px); }
}
.shake { animation: shake 0.45s ease-in-out; }

@keyframes heartPulse {
  0% { transform: scale(1); }
  14% { transform: scale(1.18); }
  28% { transform: scale(1); }
  42% { transform: scale(1.12); }
  70% { transform: scale(1); }
}
.pulse-active { animation: heartPulse 0.9s cubic-bezier(0.25, 1, 0.5, 1); }

/* Audio Controls Pill */
.btn-audio {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #fff;
  border-radius: 999px;
  padding: 6px 13px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  backdrop-filter: blur(8px);
  transition: all 0.15s ease;
}
.btn-audio:hover {
  background: rgba(255, 255, 255, 0.25);
  transform: translateY(-1px);
}
.btn-audio.active {
  background: #22c55e;
  color: #fff;
  border-color: #16a34a;
  box-shadow: 0 2px 10px rgba(34, 197, 94, 0.4);
}

/* Kahoot Fullscreen Presentation Stage */
.kahoot-stage {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: radial-gradient(ellipse at 50% 30%, #4c1d95 0%, #2e1065 60%, #0f0524 100%);
  color: #fff;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  user-select: none;
}
.kahoot-stage.hide { display: none; }

.k-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 28px;
  background: rgba(15, 5, 36, 0.4);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(12px);
  flex-shrink: 0;
}
.k-title-group h2 {
  font-size: 19px;
  font-weight: 800;
  letter-spacing: -0.3px;
}
.k-title-group .k-sub {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.7);
  margin-top: 2px;
}

.k-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Question Banner */
.k-qbanner {
  padding: 24px 32px 16px;
  text-align: center;
  max-width: 960px;
  margin: 0 auto;
  width: 100%;
  flex-shrink: 0;
}
.k-qbanner .k-qnum {
  display: inline-block;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 999px;
  padding: 4px 14px;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 10px;
}
.k-qbanner h1 {
  font-size: 28px;
  font-weight: 900;
  line-height: 1.3;
  color: #ffffff;
  text-shadow: 0 2px 14px rgba(0,0,0,0.5);
}

/* Stage Arena (Kahoot Vertical Bars / Podiums) */
.k-arena {
  flex: 1;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 20px;
  padding: 20px 32px 30px;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
  overflow-y: auto;
}

/* Vertical Pillar Column */
.k-pillar-col {
  flex: 1;
  min-width: 120px;
  max-width: 220px;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
}

.k-bar-wrap {
  width: 100%;
  height: calc(100% - 110px);
  min-height: 180px;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  position: relative;
}

.k-crown {
  font-size: 38px;
  margin-bottom: 6px;
  animation: crownFloat 2s ease-in-out infinite;
  filter: drop-shadow(0 4px 12px rgba(255, 193, 7, 0.7));
}

.k-bar-stats {
  font-size: 18px;
  font-weight: 900;
  text-align: center;
  margin-bottom: 8px;
  text-shadow: 0 2px 6px rgba(0,0,0,0.5);
}
.k-bar-stats .k-pct {
  font-size: 24px;
  display: block;
}

.k-bar-inner {
  width: 100%;
  border-radius: 16px 16px 6px 6px;
  transform-origin: bottom;
  animation: kahootSpring 0.9s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
  transition: height 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 8px 24px rgba(0,0,0,0.35);
  position: relative;
}
.k-bar-inner.is-winner {
  animation: kahootSpring 0.9s cubic-bezier(0.34, 1.56, 0.64, 1) forwards, winnerGlow 2.5s infinite;
  border: 2.5px solid #ffeb3b;
}

.k-card-bottom {
  width: 100%;
  border-radius: 16px;
  padding: 14px 12px;
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  box-shadow: 0 6px 18px rgba(0,0,0,0.3);
  position: relative;
  min-height: 90px;
  justify-content: center;
}
.k-card-bottom .k-shape {
  font-size: 20px;
  font-weight: 900;
  margin-bottom: 4px;
}
.k-card-bottom .k-text {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Stage Bottom Controls */
.k-bottombar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 28px;
  background: rgba(15, 5, 36, 0.5);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  flex-shrink: 0;
}
.k-nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.15);
  border: none;
  color: #fff;
  padding: 10px 20px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.15s;
}
.k-nav-btn:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.28);
  transform: translateY(-2px);
}
.k-nav-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

