/* Bagi Kopi — Asesmen Staf. Mobile-first PWA.
   Palet & tipografi mengikuti 22-10 Bagi Kopi Brand Guideline. */

:root {
  --blue: #004dbd;
  --blue-deep: #003b91;
  --blue-tint: #e8f0fc;
  --orange: #f47920;
  --red: #ca3625;
  --yellow: #efb918;
  --ink: #191919;
  --ink-soft: #5b5f66;
  --line: #e3e6ea;
  --bg: #f7f8fa;
  --card: #ffffff;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 1px 2px rgba(25, 25, 25, .06), 0 8px 24px rgba(25, 25, 25, .06);
  --font-head: 'Satoshi', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-body: 'Lora', Georgia, 'Times New Roman', serif;
  --gutter: 16px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  overscroll-behavior-y: contain;
}

h1, h2, h3, h4, .u-head, button, input, select, textarea, label, .chip, .btn {
  font-family: var(--font-head);
}

h1 { font-size: 1.5rem; line-height: 1.25; margin: 0 0 6px; letter-spacing: -.02em; }
h2 { font-size: 1.15rem; margin: 0 0 8px; letter-spacing: -.01em; }
h3 { font-size: .95rem; margin: 0 0 6px; }
p  { margin: 0 0 12px; }
a  { color: var(--blue); }

/* ---------- Layout ---------- */

.app {
  max-width: 560px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--blue);
  color: #fff;
  padding: 12px var(--gutter);
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
}

.topbar .mark { width: 28px; height: 28px; flex: 0 0 28px; }
.topbar .title { font-family: var(--font-head); font-weight: 700; font-size: 1rem; letter-spacing: -.01em; }
.topbar .sub { font-family: var(--font-body); font-size: .75rem; opacity: .8; display: block; line-height: 1.2; }
.topbar .spacer { margin-left: auto; }

.iconbtn {
  background: rgba(255, 255, 255, .14);
  border: 0;
  color: #fff;
  width: 36px; height: 36px;
  border-radius: 10px;
  font-size: 1.05rem;
  cursor: pointer;
  display: grid; place-items: center;
}
.iconbtn:active { background: rgba(255, 255, 255, .28); }

main { flex: 1; padding: var(--gutter); padding-bottom: 96px; }

.hero {
  background: var(--blue);
  color: #fff;
  margin: calc(var(--gutter) * -1) calc(var(--gutter) * -1) var(--gutter);
  padding: 24px var(--gutter) 28px;
  position: relative;
  overflow: hidden;
}
.hero h1 { color: #fff; }
.hero p { color: rgba(255, 255, 255, .85); margin: 0; font-size: .92rem; }
.hero .glyph {
  position: absolute; right: -28px; bottom: -40px;
  width: 168px; opacity: .13; pointer-events: none;
}

/* ---------- Cards & lists ---------- */

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}
.card.flat { box-shadow: none; }

.tile {
  display: flex; align-items: center; gap: 14px;
  width: 100%;
  text-align: left;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 10px;
  cursor: pointer;
  box-shadow: var(--shadow);
  font-size: 1rem;
  color: var(--ink);
}
.tile:active { transform: scale(.995); }
.tile[disabled] { opacity: .5; cursor: not-allowed; box-shadow: none; }
.tile .glyphbox {
  width: 44px; height: 44px; flex: 0 0 44px;
  border-radius: 14px;
  background: var(--blue-tint);
  display: grid; place-items: center;
}
.tile .glyphbox svg { width: 24px; height: 24px; }
.tile .t-main { font-family: var(--font-head); font-weight: 700; display: block; }
.tile .t-sub { font-family: var(--font-body); font-size: .82rem; color: var(--ink-soft); display: block; line-height: 1.35; }
.tile .t-go { margin-left: auto; color: var(--blue); font-size: 1.2rem; }

/* ---------- Chips, notes ---------- */

.chip {
  display: inline-block;
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--blue-tint);
  color: var(--blue-deep);
}
.chip.orange { background: #fdeee1; color: #a64d07; }
.chip.red    { background: #fbe9e7; color: #8f2317; }
.chip.yellow { background: #fdf5dc; color: #8a6708; }
.chip.grey   { background: #eef0f3; color: var(--ink-soft); }

.note {
  border-left: 3px solid var(--yellow);
  background: #fefbf0;
  padding: 10px 12px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-size: .85rem;
  color: #6b5406;
  margin-bottom: 12px;
}
.note.alert { border-color: var(--red); background: #fdf0ee; color: #8f2317; }
.note.info  { border-color: var(--blue); background: var(--blue-tint); color: var(--blue-deep); }

/* ---------- Forms ---------- */

label.field { display: block; margin-bottom: 14px; }
label.field > span {
  display: block;
  font-size: .8rem;
  font-weight: 700;
  color: var(--ink-soft);
  margin-bottom: 6px;
  letter-spacing: .01em;
}
input, select, textarea {
  width: 100%;
  font-size: 1rem;
  font-family: var(--font-body);
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--ink);
}
input:focus, select:focus, textarea:focus {
  outline: 0;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(0, 77, 189, .14);
}
textarea { min-height: 140px; resize: vertical; line-height: 1.65; }
select { font-family: var(--font-head); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%;
  min-height: 50px;
  padding: 12px 18px;
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--blue);
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
}
.btn:active { background: var(--blue-deep); }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn.ghost { background: #fff; color: var(--blue); border: 1px solid var(--line); }
.btn.orange { background: var(--orange); }
.btn.orange:active { background: #d8630f; }
.btn.slim { min-height: 42px; font-size: .9rem; width: auto; padding: 8px 16px; }

.row { display: flex; gap: 10px; }
.row > * { flex: 1; }

/* ---------- Progress & question screen ---------- */

.progress { padding: 10px var(--gutter) 0; }
.progress .bar { height: 6px; background: var(--line); border-radius: 999px; overflow: hidden; }
.progress .bar i { display: block; height: 100%; background: var(--orange); transition: width .25s ease; }
.progress .meta {
  display: flex; justify-content: space-between;
  font-family: var(--font-head); font-size: .75rem; color: var(--ink-soft);
  margin-top: 6px;
}

.qtext {
  font-family: var(--font-head);
  font-size: 1.12rem;
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: -.01em;
  margin: 10px 0 14px;
}

.actionbar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 25;
  background: rgba(255, 255, 255, .96);
  backdrop-filter: blur(8px);
  border-top: 1px solid var(--line);
  padding: 10px var(--gutter) calc(10px + env(safe-area-inset-bottom));
}
.actionbar .inner { max-width: 560px; margin: 0 auto; display: flex; gap: 10px; }

.savehint { font-size: .75rem; color: var(--ink-soft); text-align: center; margin-top: 8px; }

/* ---------- Review (penilai) ---------- */

.ans {
  white-space: pre-wrap;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px;
  font-size: .95rem;
  margin-bottom: 10px;
}
.ans:empty::before { content: 'Tidak dijawab'; color: var(--ink-soft); font-style: italic; }

details.key { margin-bottom: 12px; }
details.key > summary {
  font-family: var(--font-head);
  font-size: .85rem;
  font-weight: 700;
  color: var(--blue);
  cursor: pointer;
  padding: 8px 0;
  list-style: none;
}
details.key > summary::-webkit-details-marker { display: none; }
details.key > summary::before { content: '▸ '; }
details.key[open] > summary::before { content: '▾ '; }
details.key .body {
  white-space: pre-wrap;
  background: var(--blue-tint);
  border-radius: var(--radius-sm);
  padding: 12px;
  font-size: .92rem;
  color: var(--blue-deep);
}
details.key .src { font-size: .72rem; opacity: .75; margin-top: 8px; display: block; }

.scorebar { display: flex; gap: 6px; flex-wrap: wrap; }
.scorebar button {
  flex: 1 0 auto;
  min-width: 56px;
  padding: 10px 6px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 10px;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: .85rem;
  cursor: pointer;
  color: var(--ink-soft);
}
.scorebar button[aria-pressed="true"] { background: var(--blue); border-color: var(--blue); color: #fff; }

.scoreline { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 10px; }
.scoreline .big { font-family: var(--font-head); font-size: 2rem; font-weight: 700; line-height: 1; }
.scoreline .big.pass { color: var(--blue); }
.scoreline .big.fail { color: var(--red); }

.tablelike { font-size: .9rem; }
.tablelike > div { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.tablelike > div:last-child { border-bottom: 0; }
.tablelike b { font-family: var(--font-head); font-weight: 700; }

.empty { text-align: center; color: var(--ink-soft); padding: 40px 20px; }
.spinner {
  width: 26px; height: 26px; margin: 0 auto 12px;
  border: 3px solid var(--line); border-top-color: var(--blue);
  border-radius: 50%; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.toast {
  position: fixed; left: 50%; bottom: 86px; transform: translateX(-50%);
  background: var(--ink); color: #fff;
  font-family: var(--font-head); font-size: .85rem;
  padding: 10px 16px; border-radius: 999px;
  z-index: 40; max-width: calc(100% - 32px);
  box-shadow: var(--shadow);
}

.offline-flag {
  background: var(--yellow); color: #4a3a02;
  font-family: var(--font-head); font-size: .78rem; font-weight: 700;
  text-align: center; padding: 6px var(--gutter);
}

@media (min-width: 600px) {
  .app { box-shadow: var(--shadow); background: var(--bg); }
}
