:root {
  --bg: #f6f7f8;
  --panel: #ffffff;
  --panel-strong: #f0f3f4;
  --text: #1d2528;
  --muted: #687579;
  --border: #dce3e5;
  --accent: #147d73;
  --accent-strong: #0f5f58;
  --accent-soft: #dff1ee;
  --warning: #b56a19;
  --danger: #b33434;
  --shadow: 0 18px 45px rgba(24, 37, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

button,
input,
select,
textarea {
  font: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

.shell {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px clamp(18px, 4vw, 48px);
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(14px);
}

.brand {
  display: inline-flex;
  align-items: center;
  min-width: 0;
}

.brand-logo {
  display: block;
  width: auto;
  height: 46px;
  max-width: min(260px, 56vw);
  object-fit: contain;
}

.nav {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.nav-link,
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 8px 13px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease, transform 160ms ease;
}

.nav-link.active,
.btn.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
}

.btn.ghost {
  background: transparent;
}

.btn.danger {
  border-color: rgba(179, 52, 52, 0.35);
  color: var(--danger);
}

.btn.small {
  min-height: 32px;
  padding: 5px 10px;
  font-size: 13px;
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.56;
}

.btn:hover:not(:disabled),
.nav-link:hover {
  transform: translateY(-1px);
  border-color: var(--accent);
}

.main {
  width: min(1180px, calc(100% - 36px));
  margin: 0 auto;
  padding: 30px 0 48px;
}

body[data-app="client"] .main {
  width: min(1080px, calc(100% - 32px));
  padding-top: 22px;
}

body[data-app="client"] .topbar {
  background: rgba(255, 255, 255, 0.96);
}

.client-page {
  display: grid;
  gap: 18px;
}

.client-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 150px;
  padding: 24px;
  border-bottom: 1px solid var(--border);
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
}

.client-head .page-title {
  margin: 12px 0 4px;
  font-size: clamp(30px, 5vw, 46px);
}

.client-head-badge {
  align-self: flex-start;
  min-height: 30px;
  padding: 6px 11px;
  border: 1px solid rgba(20, 125, 115, 0.22);
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.test-list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 4px;
  padding: 0 2px 10px;
  border-bottom: 1px solid var(--border);
}

.test-list-head h2 {
  margin: 0;
  color: var(--text);
  font-size: 18px;
  line-height: 1.2;
}

.test-list-head span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

.test-grid {
  display: grid;
  gap: 12px;
}

.client-test-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  min-height: 126px;
  padding: 18px;
  border-left: 4px solid var(--accent);
  box-shadow: none;
}

.test-card-main {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.test-card-main h3 {
  font-size: clamp(18px, 3vw, 22px);
}

.test-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.test-card-meta span {
  min-height: 25px;
  padding: 4px 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #f8fafb;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.client-test-card .btn {
  justify-self: end;
  min-width: 112px;
}

.start-page {
  display: grid;
  gap: 14px;
  max-width: 900px;
  margin: 0 auto;
}

.start-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
}

.start-head .page-title {
  margin-bottom: 4px;
  font-size: clamp(26px, 5vw, 40px);
}

.start-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(84px, 1fr));
  gap: 8px;
  min-width: 210px;
}

.start-meta > div {
  display: grid;
  gap: 2px;
  padding: 11px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #f8fafb;
}

.start-meta span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.start-meta strong {
  color: var(--text);
  font-size: 17px;
}

.start-form {
  box-shadow: none;
}

.form-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 2px;
}

.start-submit {
  justify-self: flex-end;
  min-width: 180px;
}

.token-section {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(180px, 240px);
  align-items: end;
  gap: 14px;
  padding: 16px;
  border: 1px solid rgba(20, 125, 115, 0.22);
  border-radius: 8px;
  background: #f8fbfa;
}

.token-section label {
  color: #344246;
  font-size: 13px;
  font-weight: 800;
}

.exam-page {
  display: grid;
  gap: 14px;
}

.exam-top {
  position: sticky;
  top: 74px;
  z-index: 12;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px 18px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(14px);
  box-shadow: 0 10px 30px rgba(24, 37, 42, 0.06);
}

.exam-top h1 {
  margin: 0;
  font-size: clamp(18px, 3vw, 24px);
  line-height: 1.2;
}

.exam-status {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.exam-status > span:not(.pill) {
  min-height: 27px;
  padding: 4px 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel-strong);
}

.timer-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 27px;
  padding: 4px 10px;
  border: 1px solid rgba(20, 125, 115, 0.22);
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.progress-track {
  grid-column: 1 / -1;
  height: 6px;
  overflow: hidden;
  border: 1px solid rgba(20, 125, 115, 0.15);
  border-radius: 999px;
  background: #ecf2f2;
}

.progress-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.exam-runner {
  grid-template-columns: 224px minmax(0, 1fr);
  gap: 14px;
}

.exam-nav,
.exam-question {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: none;
}

.exam-nav {
  top: 160px;
  padding: 12px;
}

.question-nav-head {
  display: grid;
  gap: 2px;
}

.question-nav-head strong {
  color: var(--text);
  font-size: 14px;
}

.question-nav-head span {
  color: var(--muted);
  font-size: 12px;
}

.exam-question {
  padding: clamp(18px, 3vw, 28px);
}

.exam-actions {
  justify-content: flex-end;
  padding-top: 6px;
}

.exam-nav-foot {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
  padding-top: 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.legend {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 4px;
  border: 1px solid var(--border);
  border-radius: 999px;
  vertical-align: -1px;
}

.legend.current {
  border-color: var(--accent);
  background: var(--accent);
}

.legend.answered {
  border-color: rgba(20, 125, 115, 0.35);
  background: var(--accent-soft);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(260px, 0.8fr);
  gap: 24px;
  align-items: stretch;
  margin-bottom: 24px;
}

.page-title {
  margin: 0 0 8px;
  font-size: clamp(28px, 4vw, 48px);
  line-height: 1.05;
  letter-spacing: 0;
}

.section-title {
  margin: 0;
  font-size: 21px;
  letter-spacing: 0;
}

.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.subtle {
  margin: 0;
  color: var(--muted);
}

.panel {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.panel.pad {
  padding: clamp(18px, 3vw, 28px);
}

.panel.flat {
  box-shadow: none;
}

.grid {
  display: grid;
  gap: 16px;
}

.grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.test-card {
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
}

.test-card h3,
.compact-title {
  margin: 0;
  font-size: 18px;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 25px;
  padding: 3px 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel-strong);
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.pill.ok {
  border-color: rgba(20, 125, 115, 0.2);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.pill.danger,
.timer-pill .danger {
  color: var(--danger);
}

.timer-pill {
  gap: 6px;
}

.token-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  min-width: 86px;
  padding: 4px 10px;
  border: 1px solid rgba(20, 125, 115, 0.22);
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 18px;
  font-weight: 760;
  letter-spacing: 0;
}

.token-badge.large {
  min-height: 40px;
  min-width: 112px;
  font-size: 24px;
}

.token-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.token-input {
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0;
  text-align: center;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

form[data-form]:not(.filters):not(.review-form):not(.option-row) {
  display: grid;
  gap: 14px;
}

.field {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.field.full {
  grid-column: 1 / -1;
}

.field label,
.field-label {
  color: #344246;
  font-size: 13px;
  font-weight: 680;
}

.input,
.select,
.textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
  outline: none;
  padding: 10px 12px;
  font: inherit;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

/* Normalkan input tanggal: di mobile (iOS/Safari) defaultnya melebihi kotak
   form lain dan bisa keluar dari card. */
input[type="date"].input,
input[type="date"] {
  -webkit-appearance: none;
  appearance: none;
  max-width: 100%;
}

input[type="date"]::-webkit-date-and-time-value {
  text-align: left;
  margin: 0;
}

input[type="date"]::-webkit-calendar-picker-indicator {
  margin-left: auto;
}

.textarea {
  min-height: 92px;
  resize: vertical;
}

.textarea.compact {
  min-height: 68px;
}

.input:focus,
.select:focus,
.textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(20, 125, 115, 0.12);
}

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

.actions.end {
  justify-content: flex-end;
}

.divider {
  height: 1px;
  margin: 18px 0;
  background: var(--border);
}

.runner {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.question-nav {
  position: sticky;
  top: 82px;
  display: grid;
  gap: 12px;
}

.question-nav.exam-nav {
  top: 160px;
}

.question-list {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}

.question-dot {
  width: 100%;
  aspect-ratio: 1;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
  cursor: pointer;
}

.question-dot.current {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
}

.question-dot.answered:not(.current) {
  border-color: rgba(20, 125, 115, 0.35);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.question-body {
  display: grid;
  gap: 18px;
  min-height: 430px;
}

.question-context {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.context-title,
.context-score {
  color: #4d5b60;
  font-size: 13px;
  font-weight: 720;
}

.context-title {
  text-transform: none;
}

.context-score {
  padding-left: 12px;
  border-left: 1px solid var(--border);
}

.prompt {
  margin: 0;
  font-size: clamp(18px, 2.4vw, 24px);
  font-weight: 760;
  line-height: 1.2;
  letter-spacing: 0;
}

.question-media {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 220px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fbfcfc;
  overflow: hidden;
}

.question-media img {
  display: block;
  width: min(280px, 82vw);
  max-height: 300px;
  object-fit: contain;
}

.swatch {
  width: min(280px, 82vw);
  height: 150px;
  border: 1px solid #b8c3c6;
  border-radius: 8px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.45);
}

.choice-list {
  display: grid;
  gap: 10px;
}

.choice {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  cursor: pointer;
}

.choice:has(input:checked) {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.admin-shell {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

body[data-app="admin"] .main {
  width: min(1340px, calc(100% - 36px));
}

body[data-app="admin"] .panel {
  box-shadow: none;
}

.admin-menu {
  position: sticky;
  top: 82px;
  display: grid;
  gap: 16px;
  padding: 16px;
  box-shadow: none;
}

.admin-menu-head {
  display: grid;
  gap: 8px;
  padding: 4px 4px 14px;
  border-bottom: 1px solid var(--border);
}

.admin-menu-head div {
  display: grid;
  gap: 2px;
}

.admin-menu-head small {
  color: var(--muted);
  font-size: 12px;
}

.admin-menu nav {
  display: grid;
  gap: 8px;
}

.admin-menu-item {
  position: relative;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 56px;
  padding: 9px 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--text);
  transition: background 150ms ease, border-color 150ms ease, color 150ms ease;
}

.admin-menu-item:hover {
  border-color: var(--border);
  background: #f8fafb;
}

.admin-menu-icon {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
  color: var(--muted);
}

.admin-icon {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

.admin-menu-copy {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.admin-menu-item small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.2;
}

.admin-menu-item.active {
  border-color: rgba(20, 125, 115, 0.24);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.admin-menu-item.active .admin-menu-icon {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
}

.admin-content {
  display: grid;
  gap: 18px;
  min-width: 0;
}

.page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 82px;
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
}

.page-head .section-title {
  font-size: 25px;
}

.page-head .actions {
  justify-content: flex-end;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.stat-card {
  display: grid;
  gap: 8px;
  min-height: 112px;
  border-left: 4px solid var(--accent);
  box-shadow: none;
}

.stat-card span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.stat-card strong {
  color: var(--text);
  font-size: 34px;
  line-height: 1;
}

.admin-split {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.admin-layout {
  display: grid;
  grid-template-columns: 330px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.side-stack {
  display: grid;
  gap: 18px;
}

.list {
  display: grid;
  gap: 12px;
}

.list.compact {
  gap: 8px;
}

.list-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
}

.list-item strong {
  color: var(--text);
}

.admin-test-item {
  min-height: 82px;
}

.admin-test-item .actions {
  justify-content: flex-end;
}

.admin-detail-panel,
.admin-section-stack {
  margin-top: 0;
}

.admin-section-stack {
  gap: 18px;
}

.section-editor,
.question-editor,
.option-row {
  display: grid;
  gap: 16px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
}

.section-editor {
  background: #fbfcfc;
}

.question-editor {
  border-color: #d7e0e3;
}

.editor-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.editor-head > div {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.thumb {
  width: 64px;
  height: 64px;
  border: 1px solid var(--border);
  border-radius: 8px;
  object-fit: contain;
  background: #ffffff;
}

.question-form-grid {
  margin-top: 14px;
}

.editor-group {
  display: grid;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
}

.editor-group.full {
  grid-column: 1 / -1;
}

.group-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.group-title strong {
  color: var(--text);
  font-size: 15px;
}

.group-title span {
  color: var(--muted);
  font-size: 12px;
}

.info-box {
  padding: 12px;
  border: 1px solid rgba(20, 125, 115, 0.22);
  border-radius: 8px;
  background: var(--accent-soft);
  color: #31504d;
  font-size: 13px;
}

.info-box.full {
  grid-column: 1 / -1;
}

.media-tools {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
}

.swatch-config {
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fbfcfc;
}

.is-hidden {
  display: none !important;
}

.swatch-config-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.color-control {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
}

.color-control input[type="color"] {
  width: 46px;
  height: 40px;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #ffffff;
}

.file-btn {
  position: relative;
  overflow: hidden;
}

.file-btn input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.option-row {
  grid-template-columns: minmax(140px, 1fr) minmax(100px, 0.8fr) 110px 90px auto;
  align-items: end;
  box-shadow: none;
  gap: 12px;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  margin-top: 4px;
}

.table th,
.table td {
  padding: 13px 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.table th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.attempt-table {
  table-layout: fixed;
  min-width: 840px;
}

.attempt-table thead th {
  padding: 11px 12px;
  border-top: 1px solid var(--border);
  background: #f8fafb;
  letter-spacing: 0;
}

.attempt-table tbody td {
  padding: 12px;
  vertical-align: middle;
}

.attempt-table tbody tr {
  transition: background 0.15s ease;
}

.attempt-table tbody tr:hover {
  background: #fbfcfc;
}

.attempt-table th:nth-child(2),
.attempt-table td:nth-child(2) {
  width: 150px;
}

.attempt-table th:nth-child(3),
.attempt-table td:nth-child(3) {
  width: 220px;
}

.attempt-table th:nth-child(4),
.attempt-table td:nth-child(4) {
  width: 124px;
}

.attempt-table th:nth-child(5),
.attempt-table td:nth-child(5) {
  width: 118px;
}

.attempt-table th:nth-child(6),
.attempt-table td:nth-child(6) {
  width: 78px;
}

.attempt-table th:nth-child(7),
.attempt-table td:nth-child(7) {
  width: 128px;
}

.check-cell {
  width: 42px;
  text-align: center !important;
  vertical-align: middle !important;
}

.table-check {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}

.bulk-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  background: #ffffff;
}

.bulk-select {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  cursor: pointer;
}

.candidate-cell strong,
.test-cell span {
  color: var(--text);
  line-height: 1.35;
}

.candidate-cell strong,
.candidate-cell span {
  display: block;
}

.candidate-cell span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.2;
}

.test-cell span {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.date-cell,
.score-cell,
.actions-cell {
  white-space: nowrap;
}

.date-cell {
  color: #425054;
  font-size: 13px;
}

.score-cell strong {
  color: var(--text);
}

.score-cell span {
  color: var(--muted);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 5px 9px;
  border: 1px solid var(--border);
  background: #f8fafb;
  color: #46565b;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
}

.status-badge.submitted {
  border-color: rgba(20, 125, 115, 0.24);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.status-badge.progress {
  border-color: #d8c68f;
  background: #fff8df;
  color: #7b5b00;
}

.attempt-table .row-actions {
  flex-wrap: nowrap;
}

.attempt-table .btn.small {
  min-height: 31px;
  padding: 7px 9px;
}

.review-form {
  display: grid;
  grid-template-columns: 86px 105px minmax(140px, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-width: 430px;
}

.row-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.correction-summary {
  display: grid;
  gap: 2px;
  min-width: 150px;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fbfcfc;
}

.correction-summary.ok {
  border-color: rgba(20, 125, 115, 0.24);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.correction-summary span {
  color: var(--muted);
  font-size: 12px;
}

.review-form .input,
.review-form .select {
  min-height: 34px;
  padding: 7px 9px;
}

.tabs {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.tab-btn {
  min-height: 36px;
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 0;
  background: #ffffff;
  color: #46565b;
  cursor: pointer;
  font-weight: 700;
}

.tab-btn.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.filters {
  display: grid;
  grid-template-columns: minmax(190px, 1.2fr) minmax(180px, 1fr) minmax(150px, 0.85fr) minmax(150px, 0.85fr);
  gap: 14px;
  align-items: end;
  margin-bottom: 18px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fbfcfc;
}

.filter-actions {
  display: flex;
  gap: 8px;
  grid-column: 1 / -1;
  justify-content: flex-end;
  padding-top: 2px;
}

.submit-done {
  display: grid;
  place-items: center;
  min-height: calc(100vh - 170px);
}

.submit-card {
  width: min(760px, 100%);
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.summary-grid > div {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fbfcfc;
}

.empty {
  padding: 28px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

.loading {
  display: grid;
  place-items: center;
  min-height: 220px;
  color: var(--muted);
}

.load-error {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-color: #f0b8b8;
  background: #fffafa;
}

.load-error .section-title {
  color: #8a1f1f;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 60;
  max-width: min(360px, calc(100vw - 40px));
  padding: 12px 14px;
  border: 1px solid rgba(20, 125, 115, 0.22);
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
  box-shadow: var(--shadow);
}

.fade-in {
  animation: fadeIn 180ms ease both;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 900px) {
  .hero,
  .runner,
  .admin-shell,
  .admin-split,
  .admin-layout,
  .grid.two,
  .grid.three,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .admin-menu {
    position: static;
  }

  .admin-menu nav {
    grid-template-columns: repeat(4, minmax(150px, 1fr));
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: thin;
  }

  .admin-menu-item {
    min-height: 54px;
  }

  .stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .question-nav {
    position: static;
  }

  .exam-runner {
    gap: 12px;
  }

  .exam-nav {
    padding: 10px;
  }

  .question-nav-head {
    gap: 1px;
  }

  .exam-nav .question-list {
    display: flex;
    gap: 7px;
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: thin;
  }

  .exam-nav .question-dot {
    flex: 0 0 40px;
    width: 40px;
    height: 40px;
    aspect-ratio: auto;
  }

  .exam-nav-foot {
    padding-top: 0;
  }

  .exam-top {
    position: static;
    grid-template-columns: 1fr;
  }

  .exam-status {
    justify-content: flex-start;
  }

  .option-row {
    grid-template-columns: 1fr;
  }

  .section-head,
  .filters {
    grid-template-columns: 1fr;
  }

  .section-head {
    flex-direction: column;
  }

  .page-head {
    align-items: stretch;
    flex-direction: column;
  }

  .page-head .actions {
    justify-content: flex-start;
  }

  .list-item {
    grid-template-columns: 1fr;
  }

  .admin-test-item .actions {
    justify-content: flex-start;
  }

  .filter-actions {
    align-items: stretch;
    flex-direction: column;
    justify-content: stretch;
  }

  .summary-grid {
    grid-template-columns: 1fr;
  }

  .review-form {
    grid-template-columns: 1fr;
    min-width: 220px;
  }

  .table {
    white-space: nowrap;
  }
}

@media (max-width: 640px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .brand {
    min-width: 0;
  }

  .brand-logo {
    height: 40px;
    max-width: 72vw;
  }

  .main {
    width: min(100% - 24px, 1180px);
    padding-top: 20px;
  }

  body[data-app="client"] .main {
    width: min(100% - 24px, 1100px);
  }

  .client-head {
    align-items: flex-start;
    flex-direction: column;
    min-height: 0;
    padding: 18px;
  }

  .client-head-badge {
    align-self: flex-start;
  }

  .test-list-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 3px;
  }

  .client-test-card {
    grid-template-columns: 1fr;
    align-items: stretch;
    min-height: 0;
  }

  .client-test-card .btn {
    justify-self: stretch;
    width: 100%;
  }

  .start-head {
    align-items: stretch;
    flex-direction: column;
    padding: 18px;
  }

  .start-meta {
    min-width: 0;
  }

  .form-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .form-head .btn,
  .start-submit {
    width: 100%;
  }

  .token-section {
    grid-template-columns: 1fr;
  }

  .exam-top {
    padding: 13px;
  }

  .exam-status {
    gap: 6px;
  }

  .exam-question {
    padding: 17px;
  }

  .exam-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .exam-actions .btn {
    width: 100%;
  }

  .exam-actions .btn.primary {
    grid-column: 1 / -1;
  }

  .stat-grid {
    grid-template-columns: 1fr;
  }

  .admin-menu {
    padding: 12px;
  }

  .admin-menu nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    overflow: visible;
  }

  .admin-menu-item {
    grid-template-columns: 1fr;
    gap: 7px;
    min-height: 82px;
  }

  .admin-menu-icon {
    width: 32px;
    height: 32px;
  }

  .question-list {
    grid-template-columns: repeat(6, 1fr);
  }

  .panel.pad {
    padding: 16px;
  }

  .load-error {
    align-items: stretch;
    flex-direction: column;
  }

  .load-error .btn {
    width: 100%;
  }

  .actions {
    align-items: stretch;
  }

  .actions .btn,
  .actions .nav-link {
    flex: 1 1 auto;
  }

  .filters {
    padding: 14px;
  }

  .filter-actions .btn {
    width: 100%;
  }

  .bulk-bar {
    align-items: stretch;
    flex-direction: column;
  }

  .bulk-bar .btn {
    width: 100%;
  }

  .media-tools,
  .swatch-config-grid {
    grid-template-columns: 1fr;
  }

  .token-row {
    align-items: stretch;
    flex-direction: column;
  }

  .media-tools .btn,
  .token-row .btn,
  .token-badge.large {
    width: 100%;
  }

  .editor-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .group-title {
    align-items: flex-start;
    flex-direction: column;
  }

  .thumb {
    width: 100%;
    height: 130px;
  }

  .question-media {
    min-height: 180px;
  }

  /* Tabel "Hasil test" di mobile: ubah dari tabel lebar (scroll) jadi kartu
     per-baris supaya semua kolom terbaca dan tidak keluar dari card. */
  .attempt-table {
    min-width: 0;
    table-layout: auto;
    white-space: normal;
  }

  .attempt-table thead {
    display: none;
  }

  .attempt-table,
  .attempt-table tbody {
    display: block;
    width: 100%;
  }

  .attempt-table tbody tr {
    display: block;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: #ffffff;
    padding: 4px 14px;
    margin-bottom: 12px;
  }

  .attempt-table tbody tr:hover {
    background: #ffffff;
  }

  .attempt-table tbody td {
    display: block;
    width: auto !important;
    border: none;
    padding: 9px 0;
    text-align: left;
    vertical-align: top;
    white-space: normal;
  }

  .attempt-table tbody td + td {
    border-top: 1px solid var(--border);
  }

  .attempt-table tbody td[data-label]::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 3px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 680;
    text-transform: uppercase;
    letter-spacing: 0.03em;
  }

  .attempt-table tbody td.check-cell {
    text-align: left !important;
    vertical-align: top !important;
  }

  .attempt-table .row-actions {
    flex-wrap: wrap;
  }

  .attempt-table .row-actions .btn {
    flex: 1 1 auto;
    text-align: center;
  }
}
