:root {
  --navy: #1e3a5f;
  --gold: #d4a017;
  --bg: #f4f6fb;
  --card: #ffffff;
  --text: #243044;
  --muted: #6b7a90;
  --line: #e2e8f2;
  --radius: 14px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}
.wrap { max-width: 640px; margin: 0 auto; padding: 28px 18px 60px; }
.brand { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.brand .logo { font-size: 40px; }
.brand h1 { margin: 0; font-size: 26px; color: var(--navy); }
.brand p { margin: 2px 0 0; color: var(--muted); font-size: 14px; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 16px;
  box-shadow: 0 2px 10px rgba(30, 58, 95, 0.06);
}
.card h2 { margin: 0 0 14px; font-size: 19px; color: var(--navy); }
label { display: block; margin-bottom: 12px; font-size: 14px; font-weight: 600; }
input {
  display: block; width: 100%; margin-top: 6px;
  padding: 11px 12px; font-size: 15px;
  border: 1.5px solid var(--line); border-radius: 10px;
}
input:focus { outline: none; border-color: var(--navy); }
.btn {
  display: inline-block; padding: 11px 26px;
  background: var(--navy); color: #fff; border: none; border-radius: 10px;
  font-size: 15px; font-weight: 700; cursor: pointer;
}
.btn:hover { filter: brightness(1.12); }
.btn.ghost { background: #fff; color: var(--navy); border: 1.5px solid var(--navy); }
.err {
  background: #fdecec; color: #b3261e;
  border: 1px solid #f5c6c2; border-radius: 10px;
  padding: 10px 12px; font-size: 14px;
}
code { background: #eef2f8; padding: 2px 6px; border-radius: 6px; font-size: 13px; }

/* ---- Tahap 2: builder ---- */
.wrap.wide { max-width: 880px; }
.spacer { flex: 1; }
.btn.small { padding: 7px 14px; font-size: 13px; }
textarea, select {
  display: block; width: 100%; margin-top: 6px;
  padding: 11px 12px; font-size: 15px;
  border: 1.5px solid var(--line); border-radius: 10px;
  font-family: inherit; background: #fff;
}
textarea:focus, select:focus { outline: none; border-color: var(--navy); }
.row { display: flex; gap: 14px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 4px; }
.row label { flex: 1; min-width: 160px; }
.check { display: flex !important; align-items: center; gap: 8px; font-weight: 600; cursor: pointer; }
.check input { width: auto; margin: 0; }
.checks { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 16px; margin-bottom: 14px; }
.linkrow { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 10px 0 16px; }
.linkrow code { flex: 1; min-width: 200px; overflow-x: auto; white-space: nowrap; padding: 8px 10px; }
.muted { color: var(--muted); }
.muted.small, .small { font-size: 13px; }
.formcard { display: flex; gap: 16px; justify-content: space-between; align-items: flex-start; }
.formcard h3 { margin: 0 0 4px; color: var(--navy); }
.formcard p { margin: 0 0 10px; }
.badges { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.badge {
  display: inline-block; font-size: 12px; font-weight: 700;
  background: #eef2f8; color: var(--navy);
  border-radius: 999px; padding: 3px 10px;
}
.badge.on { background: #e3f4e5; color: #1c7a2e; }
.badge.req { background: #fdecec; color: #b3261e; }
.qitem {
  display: flex; gap: 12px; align-items: flex-start;
  border: 1px solid var(--line); border-radius: 12px;
  padding: 12px; margin-bottom: 10px; background: #fbfcfe;
}
.qnum {
  flex: none; width: 30px; height: 30px; border-radius: 50%;
  background: var(--navy); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px;
}
.qbody { flex: 1; min-width: 0; }
.qhead { margin-bottom: 6px; }
.qactions { display: flex; gap: 6px; flex: none; flex-wrap: wrap; }
.qactions.col { flex-direction: column; align-items: stretch; }
.qactions button[disabled] { opacity: 0.35; cursor: default; }
.optrow { display: flex; gap: 8px; margin-bottom: 8px; }
.optrow input { flex: 1; margin-top: 0; }
/* Daftar opsi di kartu soal (admin) + tombol × hapus per opsi */
.gf-qopts { margin-top: 8px; display: flex; flex-direction: column; gap: 2px; }
.gf-qopt { display: flex; align-items: center; gap: 8px; padding: 3px 0; font-size: 14px; color: #374151; }
.gf-qopt-mark { color: #9ca3af; flex: none; width: 18px; text-align: center; }
.gf-qopt-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.gf-qopt-x {
  flex: none; opacity: .45; border: none; background: none; cursor: pointer;
  font-size: 18px; line-height: 1; color: #9ca3af; padding: 2px 6px; border-radius: 6px;
}
.gf-qopt:hover .gf-qopt-x, .gf-qopt-x:focus { opacity: 1; }
.gf-qopt-x:hover { color: #b3261e; background: #fdecea; }
/* Tampilan skala linier di kartu soal */
.gf-qscale { display: flex; align-items: center; gap: 10px; margin-top: 8px; flex-wrap: wrap; }
.gf-qscale .gf-qopt { padding: 0; }
.gf-qscale-end { font-size: 13px; color: #6b7280; }
.toast {
  position: sticky; top: 12px; z-index: 50;
  background: #1e3a5f; color: #fff;
  border-radius: 10px; padding: 10px 16px; margin-bottom: 12px;
  font-size: 14px; box-shadow: 0 4px 14px rgba(0,0,0,.15);
}
.toast.err { background: #b3261e; }
h3 { color: var(--navy); font-size: 16px; margin: 14px 0 8px; }

/* ---- Tahap 4: hasil ---- */
.tabs { display: flex; gap: 8px; margin-top: 14px; border-bottom: 2px solid var(--line); }
.tab {
  background: none; border: none; padding: 10px 18px; font-size: 15px; font-weight: 600;
  color: var(--muted); cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -2px;
}
.tab.active { color: var(--navy); border-bottom-color: var(--navy); }
.bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.bar-label { flex: none; width: 140px; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar { flex: 1; height: 18px; background: #eef2f8; border-radius: 9px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--navy); border-radius: 9px; transition: width .3s; }
.bar-num { flex: none; width: 44px; text-align: right; font-size: 14px; font-weight: 700; color: var(--navy); }
.samples { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.sample { background: #fbfcfe; border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; font-size: 14px; }
.quizline { background: #eef7ee; border: 1px solid #c8e6c9; border-radius: 8px; padding: 8px 12px; font-size: 14px; color: #1b5e20; }
.rtable { width: 100%; border-collapse: collapse; font-size: 14px; }
.rtable th, .rtable td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); }
.rtable th { color: var(--navy); font-size: 13px; text-transform: uppercase; letter-spacing: .4px; }
.rtable td.nowrap, td.nowrap { white-space: nowrap; }
.detail-qa { border-top: 1px solid var(--line); padding: 10px 0; }
.detail-qa > div:last-child { margin-top: 4px; font-size: 15px; }

/* ---- Tahap 6: editor ala Google Forms ---- */
.gf-topbar {
  position: sticky; top: 0; z-index: 100;
  display: flex; align-items: center; gap: 12px;
  background: #fff; border-bottom: 1px solid #dadce0;
  padding: 6px 16px; margin: 0 -18px 18px;
}
.gf-back { font-size: 24px; text-decoration: none; cursor: pointer; flex: none; }
.gf-doc-title {
  border: none; font-size: 18px; color: #202124; width: 200px;
  padding: 8px; border-radius: 4px; margin: 0;
}
.gf-doc-title:hover { background: #f1f3f4; }
.gf-doc-title:focus { outline: 2px solid #673ab7; background: #fff; }
.gf-tabs { display: flex; gap: 2px; margin: 0 auto; }
.gf-tab {
  background: none; border: none; padding: 12px 18px; font-size: 14px; font-weight: 500;
  color: #5f6368; cursor: pointer; border-bottom: 3px solid transparent; margin-bottom: -1px;
  font-family: inherit;
}
.gf-tab:hover { background: #f8f9fa; }
.gf-tab.active { color: #673ab7; border-bottom-color: #673ab7; }
.gf-count {
  background: #673ab7; color: #fff; border-radius: 999px;
  font-size: 11px; padding: 1px 7px; margin-left: 4px;
}
.gf-publish {
  background: #673ab7; color: #fff; border: none; border-radius: 4px;
  padding: 9px 22px; font-size: 14px; font-weight: 500; cursor: pointer; flex: none;
}
.gf-publish:hover { background: #5a2fa0; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.gf-publish.is-off { background: #5f6368; }
.gf-editor { padding-top: 4px; }
.gf-bigtitle {
  border: none; font-size: 28px; font-weight: 500; color: #202124;
  width: 100%; padding: 4px 0; margin: 0 0 6px;
}
.gf-bigtitle:focus { outline: none; border-bottom: 2px solid #673ab7; }
.gf-desc {
  border: none; color: #5f6368; font-size: 14px; width: 100%;
  padding: 4px 0; margin: 0; resize: vertical; font-family: inherit;
}
.gf-desc:focus { outline: none; border-bottom: 2px solid #673ab7; }
.gf-qcard { border-left: 6px solid #4285f4; }
.gf-cardtitle { font-size: 14px; font-weight: 600; color: #5f6368; margin-bottom: 10px; }
.gf-qcard-head { display: flex; gap: 16px; margin-bottom: 12px; }
.gf-qtitle {
  flex: 1; border: none; border-bottom: 1px solid #dadce0; border-radius: 0;
  background: #f8f9fa; padding: 12px; font-size: 16px; margin: 0; min-width: 0;
}
.gf-qtitle:focus { outline: none; border-bottom: 2px solid #673ab7; background: #f1f3f4; }
.gf-qtype {
  width: 200px; flex: none; border: 1px solid #dadce0; border-radius: 4px;
  padding: 10px; font-size: 14px; margin: 0; background: #fff;
}
.gf-opts .optrow { align-items: center; }
.gf-opts .optrow::before { font-size: 18px; color: #5f6368; flex: none; width: 22px; text-align: center; }
#qOptions[data-t="multiple_choice"] .optrow::before { content: "○"; }
#qOptions[data-t="checkboxes"] .optrow::before { content: "☐"; }
#qOptions[data-t="dropdown"] .optrow::before { content: "▾"; }
.gf-num { width: 110px; }
.gf-textlike { min-width: 200px; }
.gf-keyhead { font-size: 14px; font-weight: 600; color: #1b7a2e; margin: 12px 0 6px; }
.gf-qcard-foot {
  display: flex; align-items: center; gap: 2px;
  border-top: 1px solid #dadce0; margin-top: 14px; padding-top: 6px;
}
.iconbtn {
  background: none; border: none; font-size: 20px; cursor: pointer;
  color: #5f6368; padding: 8px 10px; border-radius: 50%; line-height: 1;
}
.iconbtn:hover { background: #f1f3f4; }
.iconbtn:disabled { opacity: .3; cursor: default; background: none; }
.qactions.icons { display: flex; gap: 2px; align-items: center; }
.req-label { font-size: 14px; color: #5f6368; margin-right: 8px; }
.switch { position: relative; display: inline-block; width: 38px; height: 22px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; margin: 0; border: none; padding: 0; }
.switch .slider {
  position: absolute; inset: 0; background: #bdc1c6; border-radius: 999px;
  transition: .2s; cursor: pointer;
}
.switch .slider::before {
  content: ""; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px;
  background: #fff; border-radius: 50%; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.3);
}
.switch input:checked + .slider { background: #673ab7; }
.switch input:checked + .slider::before { transform: translateX(16px); }
.switch input:focus + .slider { box-shadow: 0 0 0 2px #d2c2f0; }
.gf-toolbar {
  position: fixed; right: 20px; top: 36%;
  display: flex; flex-direction: column; gap: 2px;
  background: #fff; border: 1px solid #dadce0; border-radius: 10px;
  padding: 6px; box-shadow: 0 2px 8px rgba(0,0,0,.14); z-index: 90;
}
.gf-toolbar button {
  width: 42px; height: 42px; border: none; background: none; border-radius: 50%;
  font-size: 21px; cursor: pointer; color: #5f6368; line-height: 1;
}
.gf-toolbar button:hover { background: #f0ebf8; color: #673ab7; }
@media (max-width: 920px) {
  .gf-toolbar { display: none; }
  .gf-doc-title { width: 130px; font-size: 15px; }
  .gf-qcard-head { flex-direction: column; }
  .gf-qtype { width: 100%; }
  .gf-topbar { flex-wrap: wrap; }
}
