/* ══════════════════════════════════════
   PARSER SOAL — app.css
   ══════════════════════════════════════ */

/* ── CSS VARIABLES LOKAL ── */
:root {
  --ink         : #1a1a1a;
  --ink-light   : #555555;
  --ink-faint   : #888888;
  --paper       : #ffffff;
  --paper-warm  : #f5f1ea;
  --ui-bg       : #f0ece4;
  --ui-border   : #d4cfc6;
  --accent      : #e07b39;
  --rule        : #d4cfc6;
  --rule-dark   : #bbb8b2;
}

[data-theme="dark"] {
  --ink         : #deddda;
  --ink-light   : #9a9996;
  --ink-faint   : #77767b;
  --paper       : #1a1a1a;
  --paper-warm  : #2d2d2d;
  --ui-bg       : #1a1a1a;
  --ui-border   : #3d3d3d;
  --accent      : #e07b39;
  --rule        : #3d3d3d;
  --rule-dark   : #4d4d4d;
}

/* ── RESET & BASE ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  font-size: 13px;
  background: var(--ui-bg);
  color: var(--ink);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── HEADER ── */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: var(--paper-warm);
  border-bottom: 1px solid var(--ui-border);
  flex-shrink: 0;
}

.app-header-left {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.btn-toggle-panel {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--ui-border);
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  line-height: 1;
  flex-shrink: 0;
  transition: all 0.15s;
}

.btn-toggle-panel:hover {
  border-color: var(--ink-light);
}

.app-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
}

.btn-dashboard {
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s;
}

.btn-dashboard:hover {
  opacity: 0.85;
}

.action-buttons {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 1;
  flex-wrap: nowrap;
}

.action-buttons .btn {
  padding: 6px 12px;
  font-size: 12px;
  white-space: nowrap;
}

.btn-lihat-penuh {
  display: inline-flex;
}

.btn-lihat-penuh[disabled] {
  opacity: 0.65;
  cursor: not-allowed;
  border-style: dashed;
  color: var(--ink-light);
  background: color-mix(in srgb, var(--paper) 85%, var(--ui-bg) 15%);
}

.btn-theme-toggle {
  background: none;
  border: 1px solid var(--ui-border);
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 12px;
  color: var(--ink-light);
  cursor: pointer;
}

/* ── NAVIGASI STEPPER MODUL ── */
.module-nav {
  display: flex;
  align-items: center;
  gap: 0;
  background: var(--paper-warm);
  border-bottom: 2px solid var(--ui-border);
  padding: 12px 20px;
  flex-shrink: 0;
  overflow-x: auto;
}

.step-item {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 8px;
  transition: all 0.2s ease;
  flex-shrink: 0;
  border: none;
  background: none;
}

.step-item:hover { background: var(--paper); }

.step-circle {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--ui-border);
  color: var(--ink-faint);
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.3s ease;
  border: 2px solid var(--ui-border);
}

.step-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
  line-height: 1;
}

.step-label {
  font-size: 9px;
  font-weight: 600;
  color: var(--ink-faint);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.step-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-light);
}

.step-connector {
  width: 24px;
  height: 2px;
  background: var(--ui-border);
  flex-shrink: 0;
}

/* State: active */
.step-item.active .step-circle {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
  box-shadow: 0 2px 8px color-mix(in srgb, var(--accent) 40%, transparent);
}

.step-item.active .step-label,
.step-item.active .step-title {
  color: var(--accent);
}

/* State: done (visited) */
.step-item.done .step-circle {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.step-item.done .step-label,
.step-item.done .step-title {
  color: var(--accent);
}

.step-item.done + .step-connector {
  background: var(--accent);
}

/* Responsive stepper */
@media (max-width: 1024px) {
  .module-nav { padding: 8px 10px; }
  .step-info { display: none; }
  .step-circle { width: 32px; height: 32px; font-size: 13px; }
  .step-connector { min-width: 8px; }
}

/* Tablet & Split Screen: perkecil gap, jangan wrap dulu */
@media (max-width: 768px) {
  .app-header-right {
    gap: 6px;
    flex-wrap: nowrap;
    overflow: hidden;
  }

  .action-buttons {
    gap: 4px;
    flex-shrink: 1;
  }

  /* Progressive Disclosure: icon only di tablet */
  .action-buttons .btn .btn-text {
    display: none;
  }
}

/* Mobile: izinkan wrap, action-buttons turun ke baris penuh */
@media (max-width: 480px) {
  .app-header {
    padding: 10px 12px 12px;
    align-items: stretch;
    justify-content: flex-start;
    flex-wrap: nowrap;
    flex-direction: column;
    gap: 6px;
  }

  .app-header-left {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
    flex: 0 0 auto;
    min-width: 0;
    align-items: stretch;
  }

  .app-title {
    order: 1;
    font-size: 14px;
    line-height: 1.2;
    letter-spacing: 0.01em;
  }

  .btn-dashboard {
    order: 2;
    width: 100%;
    min-height: 38px;
    padding: 8px 12px;
    justify-content: flex-start;
    border-radius: 8px;
  }

  .btn-dashboard .btn-text {
    display: inline;
  }

  .btn-toggle-panel {
    order: 0;
    width: 100%;
    min-height: 38px;
    justify-content: flex-start;
    padding: 8px 12px;
    font-size: 14px;
  }

  .app-header-right {
    display: flex;
    gap: 6px;
    flex-direction: column;
    align-items: stretch;
    flex-wrap: nowrap;
    overflow: visible;
    width: 100%;
    min-width: 0;
  }

  .theme-selector-wrapper {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 8px;
    min-height: 38px;
    padding: 6px 10px;
    width: 100%;
    border-radius: 8px;
  }

  .theme-select {
    width: 100%;
    min-width: 0;
    min-height: 28px;
  }

  .btn-theme-toggle {
    min-height: 38px;
    padding: 8px 12px;
    font-size: 12px;
    width: 100%;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
  }

  .action-buttons {
    width: 100%;
    gap: 6px;
    flex-shrink: unset;
    justify-content: flex-start;
    flex-wrap: nowrap;
    flex-direction: column;
  }

  /* Progressive Disclosure: icon only di mobile dengan ukuran kotak */
  .action-buttons .btn {
    width: 100%;
    min-height: 38px;
    padding: 8px 12px;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    border-radius: 8px;
  }

  .action-buttons .btn .btn-text {
    display: inline;
  }

  .action-buttons .btn .btn-icon {
    font-size: 14px;
  }

  .btn-lihat-penuh {
    display: flex;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.01em;
  }

  .action-buttons .btn-lihat-penuh .btn-text {
    display: inline;
  }
}

/* ── Fullscreen Preview (khusus Modul 3) ── */
.parser-fullscreen-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: #e8eaed;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.parser-fullscreen-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  background: var(--paper-warm);
  border-bottom: 1px solid var(--ui-border);
  flex-shrink: 0;
}

.parser-fullscreen-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.parser-fullscreen-body {
  flex: 1;
  overflow: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.parser-fullscreen-content {
  width: 100%;
}

/* ── STEP GUIDE BANNER ── */
.step-guide-banner {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 16px;
  margin-bottom: 16px;
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-sm);
}

.step-guide-banner.step-guide-final {
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  border-left-color: var(--accent);
}

.step-guide-icon {
  font-size: 24px;
  flex-shrink: 0;
  margin-top: 2px;
}

.step-guide-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
  line-height: 1.4;
}

.step-guide-text strong {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
}

.step-guide-text span {
  font-size: 12px;
  color: var(--ink-light);
}

/* ── PREVIEW EMPTY STATE ── */
.preview-empty-steps {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 16px;
}

.preview-empty-step {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  line-height: 1.4;
}

.preview-empty-step-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.preview-empty-step span {
  font-size: 12px;
  color: var(--ink-light);
}

.preview-empty-step strong {
  color: var(--ink);
}

.placeholder-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 8px;
}

.placeholder-desc {
  font-size: 12px;
  color: var(--ink-light);
  margin-bottom: 12px;
}

/* Legacy tab styles (for fallback) */
.module-tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  padding: 10px 20px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-faint);
  cursor: pointer;
  transition: all 0.15s;
}

.module-tab:hover { color: var(--ink); }

.module-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ── LAYOUT UTAMA ── */
.app-body {
  flex: 1;
  overflow: hidden;
  position: relative;
}

.module-panel {
  display: none;
  height: 100%;
  grid-template-columns: 380px 1fr;
  transition: grid-template-columns 0.25s ease;
}

.module-panel.active {
  display: grid;
}

.panel-input {
  border-right: 1px solid var(--ui-border);
  overflow-y: auto;
  padding: 20px;
  background: var(--paper-warm);
  height: calc(100vh - 120px);
}

.panel-preview {
  overflow-y: auto;
  padding: 20px;
  background: var(--ui-bg);
  height: calc(100vh - 120px);
}

/* ── TOGGLE: sembunyikan panel input ── */
.app-body.panel-collapsed .module-panel.active {
  grid-template-columns: 0 1fr;
}

.app-body.panel-collapsed .module-panel.active .panel-input {
  overflow: hidden;
  padding: 0;
  border-right: none;
}

/* ── PLACEHOLDER ── */
.placeholder-text {
  color: var(--ink-faint);
  font-style: italic;
  font-size: 13px;
  padding: 40px 20px;
  text-align: center;
}

/* ── INPUT DASAR ── */
input[type="text"],
input[type="number"],
input[type="date"],
select,
textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--ui-border);
  border-radius: 6px;
  background: var(--paper);
  color: var(--ink);
  font-size: 13px;
  font-family: inherit;
}

input[type="text"]:focus,
input[type="number"]:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
}

/* ── TOMBOL ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: all 0.15s;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.btn-primary:hover { opacity: 0.85; }

.btn-secondary {
  background: var(--paper);
  color: var(--ink);
  border-color: var(--ui-border);
}

.btn-secondary:hover { border-color: var(--ink-light); }

/* ── DOC OUTPUT (preview Modul 3) ── */
.doc-output {
  background: var(--paper);
  min-height: 400px;
  border-radius: 6px;
  border: 1px solid var(--ui-border);
}

/* ══════════════════════════════════════
   FORM SECTIONS (Prompt Builder)
   ══════════════════════════════════════ */

.form-section {
  border: 1px solid var(--ui-border);
  border-radius: 8px;
  margin-bottom: 10px;
  overflow: hidden;
  background: var(--paper);
}

.section-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  background: var(--paper-warm);
  border-bottom: 1px solid var(--ui-border);
}

.section-title {
  font-weight: 700;
  font-size: 12px;
  color: var(--ink);
  flex: 1;
}

.section-badge {
  font-size: 11px;
  color: var(--ink-faint);
}

.section-body {
  padding: 14px;
}

/* ── FIELD GROUPS ── */
.field-group {
  margin-bottom: 12px;
}

.field-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-light);
  margin-bottom: 4px;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.field-hint {
  display: block;
  font-size: 11px;
  color: var(--ink-faint);
  margin-top: 4px;
  font-style: italic;
}

.required {
  color: var(--accent);
}

/* ── TIPE SOAL LIST ── */
.tipe-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tipe-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 6px;
  background: var(--ui-bg);
}

.tipe-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
}

.tipe-label {
  flex: 1;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  margin-bottom: 0 !important;
}

.input-jumlah {
  width: 56px !important;
  padding: 4px 6px !important;
  text-align: center;
  font-size: 12px !important;
}

.tipe-unit {
  font-size: 11px;
  color: var(--ink-faint);
}

.tipe-extra {
  font-size: 11px;
  color: var(--ink-faint);
  display: flex;
  align-items: center;
  gap: 4px;
}

.select-kecil {
  width: auto !important;
  padding: 3px 6px !important;
  font-size: 11px !important;
}

.total-soal {
  margin-top: 10px;
  padding: 8px 12px;
  background: var(--ui-bg);
  border-radius: 6px;
  font-size: 12px;
  color: var(--ink-light);
  border: 1px solid var(--ui-border);
}

.total-soal strong {
  color: var(--accent);
  font-size: 14px;
}

/* ── KESULITAN CARDS ── */
.kesulitan-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.kesulitan-card {
  padding: 12px 8px;
  border: 2px solid var(--ui-border);
  border-radius: 8px;
  text-align: center;
  cursor: pointer;
  background: var(--paper);
  transition: all 0.15s;
}

.kesulitan-card:hover {
  border-color: var(--accent);
}

.kesulitan-card.active {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, var(--paper));
}

.kesulitan-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: 0.05em;
}

.kesulitan-sub {
  font-size: 10px;
  color: var(--ink-faint);
  margin-top: 2px;
}

/* ── ESTIMASI BATCH ── */
.estimasi-badge {
  display: inline-block;
  padding: 8px 12px;
  background: var(--ui-bg);
  border: 1px solid var(--ui-border);
  border-radius: 6px;
  font-size: 14px;
  font-weight: 700;
  color: var(--accent);
  margin-top: 4px;
}

/* ── TOGGLE SWITCH ── */
.toggle-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.toggle-label {
  flex: 1;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 0 !important;
}

.switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
  flex-shrink: 0;
}

.switch input { opacity: 0; width: 0; height: 0; }

.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background: var(--ui-border);
  border-radius: 22px;
  transition: 0.2s;
}

.slider::before {
  content: '';
  position: absolute;
  height: 16px; width: 16px;
  left: 3px; bottom: 3px;
  background: white;
  border-radius: 50%;
  transition: 0.2s;
}

.switch input:checked + .slider {
  background: var(--accent);
}

.switch input:checked + .slider::before {
  transform: translateX(18px);
}

.toggle-value {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-light);
  min-width: 24px;
}

/* ── TOMBOL GENERATE ── */
.generate-area {
  padding: 14px 0 4px;
}

.btn-full {
  width: 100%;
  justify-content: center;
  padding: 12px !important;
  font-size: 14px !important;
}

.btn-sm {
  padding: 6px 12px !important;
  font-size: 12px !important;
}

/* ── OUTPUT PROMPT (Panel Kanan) ── */
.placeholder-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 300px;
  gap: 12px;
  color: var(--ink-faint);
}

.placeholder-icon {
  font-size: 32px;
  opacity: 0.4;
}

.prompt-output {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.prompt-block {
  border: 1px solid var(--ui-border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--paper);
}

.prompt-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--paper-warm);
  border-bottom: 1px solid var(--ui-border);
}

.prompt-block-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
}

.btn-copy {
  background: none;
  border: 1px solid var(--ui-border);
  border-radius: 4px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-light);
  cursor: pointer;
  transition: all 0.15s;
}

.btn-copy:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.btn-copy.copied {
  background: #e6f4ea;
  border-color: #4caf50;
  color: #2e7d32;
}

.btn-copy.error {
  background: #fee2e2;
  border-color: #dc2626;
  color: #991b1b;
}

.prompt-block-body {
  padding: 12px 14px;
  font-size: 12px;
  line-height: 1.6;
  color: var(--ink);
  white-space: pre-wrap;
  font-family: 'Courier New', monospace;
  background: var(--paper);
  max-height: 300px;
  overflow-y: auto;
}

.prompt-info {
  padding: 10px 14px;
  background: color-mix(in srgb, var(--accent) 8%, var(--paper));
  border-top: 1px solid var(--ui-border);
  font-size: 11px;
  color: var(--ink-light);
  font-style: italic;
}

/* ══════════════════════════════════════
   MODUL 2 — JSON MERGER
   ══════════════════════════════════════ */

.merger-header {
  margin-bottom: 16px;
}

.merger-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 4px;
}

.merger-desc {
  font-size: 12px;
  color: var(--ink-faint);
  line-height: 1.5;
}

/* ── Batch Item ── */
.batch-item {
  border: 1px solid var(--ui-border);
  border-radius: 8px;
  margin-bottom: 10px;
  overflow: hidden;
  background: var(--paper);
}

.batch-item-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--paper-warm);
  border-bottom: 1px solid var(--ui-border);
}

.batch-item-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
}

.batch-item-status {
  font-size: 11px;
  color: var(--ink-faint);
}

.btn-hapus-batch {
  background: none;
  border: none;
  color: var(--ink-faint);
  cursor: pointer;
  font-size: 14px;
  padding: 2px 6px;
  border-radius: 4px;
  transition: all 0.15s;
}

.btn-hapus-batch:hover {
  background: #fee2e2;
  color: #dc2626;
}

.batch-item textarea {
  border: none;
  border-radius: 0;
  resize: vertical;
  min-height: 100px;
  font-size: 11px;
  font-family: 'Courier New', monospace;
  background: var(--paper);
  color: var(--ink);
  padding: 10px 12px;
}

.batch-item textarea:focus {
  outline: none;
  background: color-mix(in srgb, 
    var(--accent) 4%, var(--paper));
}

.btn-tambah-batch {
  width: 100%;
  justify-content: center;
  margin-bottom: 10px;
  border-style: dashed !important;
  color: var(--ink-faint) !important;
}

.btn-tambah-batch:hover {
  color: var(--accent) !important;
  border-color: var(--accent) !important;
}

/* ── Validasi Box ── */
.validasi-box {
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.validasi-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 12px;
  line-height: 1.4;
}

.validasi-item.ok {
  background: #f0fdf4;
  color: #166534;
  border: 1px solid #bbf7d0;
}

.validasi-item.warn {
  background: #fffbeb;
  color: #92400e;
  border: 1px solid #fde68a;
}

.validasi-item.error {
  background: #fef2f2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

[data-theme="dark"] .validasi-item.ok {
  background: #14532d;
  color: #bbf7d0;
  border-color: #166534;
}

[data-theme="dark"] .validasi-item.warn {
  background: #451a03;
  color: #fde68a;
  border-color: #92400e;
}

[data-theme="dark"] .validasi-item.error {
  background: #450a0a;
  color: #fecaca;
  border-color: #991b1b;
}

/* ── Fix preview dokumen di UI ── */
.doc-preview-wrap .page {
  transform-origin: top left;
  font-size: 9pt;
}

.doc-preview-wrap .page .doc-header {
  display: grid !important;
  grid-template-columns: 56px 1fr 56px !important;
  gap: 10px !important;
  align-items: center !important;
  padding-bottom: 8px !important;
  border-bottom: 2.5px solid #111 !important;
  margin-bottom: 10px !important;
}

.doc-preview-wrap .page .student-row {
  display: grid !important;
  grid-template-columns: 1fr 1fr !important;
}

.doc-preview-wrap .page .soal-list {
  list-style: none !important;
  padding: 0 !important;
}

.doc-preview-wrap .page .soal-grid {
  display: grid !important;
  grid-template-columns: 1fr 1fr !important;
  gap: 0 14px !important;
}

/* ── BUTTON EDIT GAMBAR ── */
.btn-edit-image {
  background: #2c5aa0 !important;
  color: white !important;
  border: none !important;
  transition: all 0.3s ease !important;
}

.btn-edit-image:hover {
  background: #1e3f73 !important;
  transform: translateY(-1px);
}

/* ── MODAL UPLOAD GAMBAR ── */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-content {
  background: var(--paper);
  border-radius: 12px;
  width: 90%;
  max-width: 500px;
  max-height: 90vh;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px;
  border-bottom: 1px solid var(--ui-border);
}

.modal-header h3 {
  margin: 0;
  color: var(--ink);
  font-size: 18px;
}

.modal-close {
  background: none;
  border: none;
  font-size: 24px;
  cursor: pointer;
  color: var(--ink-faint);
  padding: 0;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-close:hover {
  color: var(--ink);
}

.modal-body {
  padding: 20px;
}

.modal-footer {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding: 20px;
  border-top: 1px solid var(--ui-border);
}

/* ── UPLOAD AREA (Simplified) ── */
.upload-area-simple {
  border: 2px solid var(--ui-border);
  border-radius: 8px;
  padding: 40px 20px;
  text-align: center;
  background: var(--paper);
}

.upload-placeholder-simple {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.upload-icon {
  font-size: 48px;
  opacity: 0.5;
}

.upload-text {
  color: var(--ink);
  font-size: 14px;
}

.upload-link {
  color: var(--accent);
  cursor: pointer;
  text-decoration: underline;
}

.upload-hint {
  color: var(--ink-faint);
  font-size: 12px;
}

/* ── PREVIEW AREA ── */
.preview-container {
  display: flex;
  gap: 15px;
  align-items: center;
}

.preview-container img {
  max-width: 150px;
  max-height: 150px;
  border-radius: 8px;
  border: 1px solid var(--ui-border);
}

.preview-info {
  flex: 1;
}

.preview-info div {
  margin-bottom: 5px;
  color: var(--ink);
  font-size: 13px;
}

/* ── EDIT MODE ── */
.edit-mode .gambar-placeholder {
  cursor: pointer !important;
  border-color: #2c5aa0 !important;
  background: #f0f7ff !important;
  position: relative;
  transition: all 0.3s ease !important;
}

.edit-mode .gambar-placeholder:hover {
  box-shadow: 0 0 0 2px #2c5aa0 !important;
}

.edit-mode .gambar-placeholder::after {
  content: "📷 Klik untuk upload gambar";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(44, 90, 160, 0.9);
  color: white;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
  white-space: nowrap;
  z-index: 10;
}

.edit-mode .gambar-placeholder:hover::after {
  opacity: 1;
}

/* Edit mode untuk gambar yang sudah diupload */
.edit-mode .gambar-container {
  cursor: pointer !important;
  position: relative;
  transition: all 0.3s ease !important;
}

.edit-mode .gambar-container:hover {
  transform: scale(1.02);
}

.edit-mode .gambar-container::after {
  content: "🔄 Klik untuk ganti gambar";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(40, 167, 69, 0.9);
  color: white;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
  white-space: nowrap;
  z-index: 10;
}

.edit-mode .gambar-container:hover::after {
  opacity: 1;
}

/* ===== THEME SELECTOR STYLING ===== */
.app-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 1;
  flex-wrap: nowrap;
  min-width: 0;
}

.theme-selector-wrapper {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  background: rgba(0,0,0,0.05);
  border-radius: 6px;
  border: 1px solid var(--ui-border);
}

[data-theme="dark"] .theme-selector-wrapper {
  background: rgba(255,255,255,0.05);
}

.theme-label {
  font-size: 0.9rem;
  cursor: pointer;
}

.theme-select {
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--ui-border);
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 0.75rem;
  font-weight: 500;
  cursor: pointer;
  outline: none;
  transition: border-color 0.2s ease;
}

.theme-select:hover,
.theme-select:focus {
  border-color: var(--accent);
}

/* ── Fitur Simpan ke Cloud ── */
.btn-simpan-cloud {
  background: var(--accent);
  color: #fff;
  border: 1px solid var(--accent);
  border-radius: 6px;
  padding: 6px 12px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-simpan-cloud:hover {
  background: #d46b30;
  border-color: #c55f2a;
  transform: translateY(-1px);
}

.btn-simpan-cloud:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.dokumen-item {
  border: 1px solid var(--ui-border);
  border-radius: 6px;
  padding: 10px 12px;
  margin-bottom: 8px;
  background: var(--paper);
  transition: border-color 0.2s;
}

.dokumen-item:hover { 
  border-color: var(--accent); 
}

.dokumen-nama {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dokumen-meta {
  font-size: 11px;
  color: var(--ink-faint);
  margin-bottom: 8px;
}

.dokumen-actions { 
  display: flex; 
  gap: 6px; 
}

.btn-buka-dokumen {
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 4px;
  border: 1px solid var(--accent);
  background: transparent;
  color: var(--accent);
  cursor: pointer;
  transition: all 0.2s;
}

.btn-buka-dokumen:hover {
  background: var(--accent);
  color: #fff;
}

.btn-hapus-dokumen {
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 4px;
  border: 1px solid #dc2626;
  background: transparent;
  color: #dc2626;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-hapus-dokumen:hover { 
  background: #dc2626; 
  color: #fff; 
}

.dokumen-kosong {
  font-size: 12px;
  color: var(--ink-faint);
  text-align: center;
  padding: 16px 0;
  font-style: italic;
}

/* ── ATP MODE INDICATOR ── */
.atp-mode-indicator {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: color-mix(in srgb, var(--accent) 10%, var(--paper));
  border: 1px solid var(--accent);
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 12px;
}

/* ── MATERI GRID LAYOUT ── */
.materi-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.materi-grid .checkbox-item {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  padding: 6px 8px;
  border-radius: 6px;
  background: var(--ui-bg);
  cursor: pointer;
  transition: background 0.15s;
}

.materi-grid .checkbox-item:hover {
  background: color-mix(in srgb, var(--accent) 8%, var(--ui-bg));
}

.materi-grid .checkbox-item input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
  margin-top: 2px;
}

.materi-grid .checkbox-item span {
  font-size: 12px;
  color: var(--ink);
  line-height: 1.4;
  word-break: break-word;
}

.btn-kecil {
  padding: 4px 10px;
  font-size: 11px;
  background: var(--paper);
  border: 1px solid var(--ui-border);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-kecil:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.ringkasan-badge {
  display: inline-block;
  padding: 4px 8px;
  background: color-mix(in srgb, var(--accent) 10%, var(--paper));
  border: 1px solid var(--accent);
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
}
