/* ============================================================
   APP.CSS — Styling Panel UI Aplikasi LKPD Kemenag
   v2.0 — Single Panel Wizard Layout
   ============================================================ */

@import url('../../shared/form-base.css');
@import url('../../shared/dokumen-list.css');
@import url('../../shared/components.css');

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

body {
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  font-size: 13px;
  background: #f0f2f5;
  color: #1a1a2e;
  min-height: 100vh;
  overflow: hidden;
}

/* ── LAYOUT UTAMA ── */
.app-wrapper {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

/* ── HEADER ── */
.app-header {
  background: #1a1a2e;
  color: #fff;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-shrink: 0;
  min-height: 52px;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.btn-toggle-panel {
  background: none;
  border: none;
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  padding: 4px 8px;
  display: block;
}

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

.header-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: nowrap;
}

.app-title {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #fff;
}

.app-subtitle {
  font-size: 11px;
  color: #aaa;
  margin-top: 1px;
}

/* ── BODY ── */
.app-body {
  display: flex;
  flex: 1;
  overflow: hidden;
  min-height: 0;
}

/* ── PANEL KIRI ── */
.panel-input {
  width: 42%;
  height: calc(100vh - 52px);
  min-width: 300px;
  max-width: 480px;
  background: #f8f9fa;
  border-right: 1px solid #e0e0e0;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex-shrink: 0;
}

/* ── PANEL KANAN ── */
.panel-preview {
  flex: 1;
  height: calc(100vh - 52px);
  background: #dde1e7;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.preview-content {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
}

/* ── BLOK ── */
.blok {
  background: #fff;
  border: 1px solid #e4e4e4;
  border-radius: 8px;
  overflow: hidden;
  flex-shrink: 0;
}

.blok-header {
  background: #f1f3f5;
  padding: 8px 14px;
  font-size: 10px;
  font-weight: 700;
  color: #666;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  border-bottom: 1px solid #e4e4e4;
}

.blok-body {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ── FORM ELEMENTS ── */
label {
  font-size: 11px;
  font-weight: 600;
  color: #444;
  display: block;
  margin-bottom: 3px;
}

textarea,
select,
input[type="number"] {
  width: 100%;
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 7px 10px;
  font-size: 12px;
  font-family: inherit;
  color: #333;
  background: #fff;
  transition: border-color 0.2s;
  display: block;
}

textarea:focus,
select:focus,
input[type="number"]:focus {
  outline: none;
  border-color: #e07b39;
  box-shadow: 0 0 0 2px rgba(224,123,57,0.12);
}

textarea.json-input {
  font-family: 'Courier New', monospace;
  font-size: 10.5px;
  min-height: 100px;
  resize: vertical;
  line-height: 1.5;
}

/* ── TOMBOL ── */
.btn {
  display: block;
  width: 100%;
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, transform 0.1s;
  text-align: center;
  font-family: inherit;
}

.btn:active { transform: scale(0.98); }

.btn-primary {
  background: #e07b39;
  color: #fff;
}

.btn-primary:hover { background: #c96a2a; }

.btn-secondary {
  background: #f0f0f0;
  color: #333;
}

.btn-secondary:hover { background: #e0e0e0; }

.preview-controls {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 14px;
}

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

.modal-content {
  background: white;
  border-radius: 8px;
  width: 90%;
  max-width: 500px;
  max-height: 80vh;
  overflow: hidden;
}

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

.modal-header h3 {
  margin: 0;
  font-size: 18px;
  color: #333;
}

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

.modal-close:hover { color: #333; }

.modal-body {
  padding: 20px;
}

.upload-area {
  border: 2px dashed #ddd;
  border-radius: 8px;
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.3s;
}

.upload-area:hover {
  border-color: #2c5aa0;
}

.upload-placeholder .upload-icon {
  font-size: 48px;
  margin-bottom: 10px;
}

.upload-placeholder p {
  margin: 10px 0 5px 0;
  font-weight: 600;
  color: #333;
}

.upload-placeholder small {
  color: #666;
}

.preview-area {
  text-align: center;
}

.preview-image-container {
  margin-bottom: 20px;
  max-height: 300px;
  overflow: hidden;
  border-radius: 8px;
}

.preview-image-container img {
  width: 100%;
  height: auto;
  object-fit: contain;
}

.preview-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}

/* ── DUAL PLACEHOLDER GAMBAR (SIDE-BY-SIDE) ── */
.placeholder-gambar-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 10px;
}

.placeholder-gambar-container .placeholder-gambar {
  margin-bottom: 0;
  height: 140px;
}

.placeholder-gambar-container .gambar-upload {
  height: 140px;
  max-height: 140px;
}

/* ── EDIT MODE ── */
.edit-mode .placeholder-gambar {
  cursor: pointer;
  border-color: #2c5aa0;
  background: #f0f7ff;
  position: relative;
}

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

.edit-mode .placeholder-gambar::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: 4px;
  font-size: 11px;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}

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

.gambar-upload {
  width: 100%;
  height: auto;
  max-height: 400px;
  object-fit: contain;
  border-radius: 4px;
  aspect-ratio: 16/9;
}

/* ── BUTTON STYLING (Standarisasi) ── */
.btn {
    font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
    font-size: 0.8rem;
    padding: 8px 16px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-weight: 500;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.btn-dashboard {
  background: #e07b39;
  color: white;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-dashboard:hover {
  background: #d06a30;
  box-shadow: 0 4px 16px rgba(224,123,57,0.5);
  transform: translateY(-1px);
}

.btn-dashboard:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(224,123,57,0.3);
}

.btn-print {
  background: #4CAF50;
  color: #fff;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-print:hover { 
    background: #45a049; 
    transform: translateY(-1px);
}

.btn-edit-image {
  background: #2196F3;
  color: #fff;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-edit-image:hover {
  background: #1976D2;
  transform: translateY(-1px);
}

.btn-fullscreen {
  background: #e07b39;
  color: #fff;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.btn-fullscreen:hover {
  background: #d06a30;
  transform: translateY(-1px);
}

/* ── Fitur Simpan ke Cloud ── */
.btn-simpan-cloud {
    background: #e07b39;
    color: #fff;
    border: 1px solid #d46b30;
    border-radius: 6px;
    padding: 8px 16px;
    cursor: pointer;
    font-size: 0.8rem;
    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 #e0e0e0;
    border-radius: 6px;
    padding: 10px 12px;
    margin-bottom: 8px;
    background: #fff;
    transition: border-color 0.2s;
}

.dokumen-item:hover { 
    border-color: #e07b39; 
}

.dokumen-nama {
    font-size: 13px;
    font-weight: 500;
    color: #1a1a2e;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dokumen-meta {
    font-size: 11px;
    color: #77767b;
    margin-bottom: 8px;
}

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

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

.btn-buka-dokumen:hover {
    background: #e07b39;
    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: #77767b;
    text-align: center;
    padding: 16px 0;
    font-style: italic;
}

/* ── Mobile Responsive ── */
@media (max-width: 768px) {
    .btn-toggle-panel {
        display: block;
    }

    .header-left {
        gap: 6px;
        flex-shrink: 1;
        min-width: 0;
    }

    .app-title {
        font-size: 14px;
    }
}

/* ── PROMPT MODE SECTION ── */
.prompt-mode-wrapper {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 4px 0;
}

.prompt-mode-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    align-items: stretch;
}

.prompt-mode-buttons .btn-copy,
.prompt-mode-buttons .btn-copy-oneshot {
    width: 100%;
    min-width: 0;
    min-height: 42px;
    margin-top: 0;
    font-size: 0.8rem;
    padding: 10px 12px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-weight: 500;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    box-sizing: border-box;
}

.prompt-mode-buttons .btn-copy {
    background-color: #2563eb;
    color: white;
}

.prompt-mode-buttons .btn-copy-oneshot {
    background-color: #16a34a;
    color: white;
}

.prompt-mode-buttons .btn-copy:hover {
    background-color: #1d4ed8;
}

.prompt-mode-buttons .btn-copy-oneshot:hover {
    background-color: #15803d;
}

.prompt-mode-buttons .btn-copy.copy-sukses,
.prompt-mode-buttons .btn-copy-oneshot.copy-sukses {
    background-color: #6b7280 !important;
    color: #ffffff !important;
    border-color: transparent !important;
}

@media (max-width: 560px) {
    .prompt-mode-buttons {
        grid-template-columns: 1fr;
    }
}

.prompt-mode-info {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.prompt-mode-info-title {
    font-weight: 700;
    font-size: 0.95rem;
    color: #1e293b;
    margin: 0;
}

.prompt-mode-card {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 12px 14px;
}

.prompt-card-title {
    font-weight: 700;
    font-size: 0.9rem;
    color: #1e293b;
    margin: 0 0 4px 0;
}

.prompt-card-desc {
    font-size: 0.85rem;
    color: #475569;
    margin: 0 0 8px 0;
    line-height: 1.5;
}

.prompt-card-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.prompt-card-list li {
    font-size: 0.83rem;
    color: #334155;
}

.prompt-card-list li.plus {
    color: #16a34a;
}

.prompt-card-list li.minus {
    color: #dc2626;
}

@media (max-width: 768px) {
    .app-subtitle {
        display: none;
    }

    .header-actions {
        flex-wrap: nowrap;
        gap: 6px;
        align-items: center;
    }

    .btn-dashboard, .btn-print, .btn-simpan-cloud, .btn-edit-image {
        font-size: 0.75rem;
        padding: 6px 10px;
        flex-shrink: 1;
        min-width: 0;
    }

    .btn-dashboard .btn-text,
    .btn-print .btn-text,
    .btn-simpan-cloud .btn-text,
    .btn-edit-image .btn-text {
        display: none;
    }
}

@media (max-width: 480px) {
    .header-left {
        gap: 6px;
        width: 100%;
    }

    .header-actions {
        flex-wrap: wrap;
        gap: 6px;
        align-items: stretch;
    }

    .btn-dashboard, .btn-print, .btn-simpan-cloud, .btn-edit-image {
        font-size: 0.72rem;
        padding: 6px 8px;
        width: 100%;
    }

    .btn-dashboard .btn-text,
    .btn-print .btn-text,
    .btn-simpan-cloud .btn-text,
    .btn-edit-image .btn-text {
        display: none;
    }
}

/* ── RINGKASAN DATA ── */
.ringkasan-box {
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
  border-radius: 6px;
  padding: 9px 12px;
  font-size: 11px;
  color: #166534;
  line-height: 1.7;
}

.ringkasan-box.error {
  background: #fff1f2;
  border-color: #fecdd3;
  color: #9f1239;
}

/* ── DETAIL LKPD ── */
.lkpd-detail-box {
  background: #fafafa;
  border: 1px solid #e0e0e0;
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 11px;
  color: #444;
  line-height: 1.7;
}

.lkpd-detail-box .lkpd-judul-kecil {
  font-weight: 700;
  font-size: 12px;
  color: #222;
  margin-bottom: 4px;
}

/* ── PROMPT AREA ── */
.prompt-area {
  font-family: 'Courier New', monospace;
  font-size: 10px;
  min-height: 140px;
  background: #1a1a2e;
  color: #e8f5e9;
  border: none;
  border-radius: 6px;
  padding: 10px;
  resize: vertical;
  width: 100%;
  line-height: 1.5;
  display: block;
}

/* ── KONFIGURASI GRID ── */
.config-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

/* ── PREVIEW PLACEHOLDER ── */
.preview-placeholder {
  color: #aaa;
  text-align: center;
  margin-top: 60px;
  font-size: 13px;
  line-height: 1.8;
}

.preview-placeholder .icon {
  font-size: 44px;
  display: block;
  margin-bottom: 10px;
}

/* ═══════════════════════════════════════════════════
   PREVIEW OPTIMIZATION — Step 3
   ═══════════════════════════════════════════════════ */

body.wizard-layout .wizard-preview {
  background: transparent;
  max-height: none;
  overflow: visible;
  min-height: 200px;
  padding: 0;
  position: relative;
}

body.wizard-layout .wizard-preview #previewDokumen {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 10px;
  gap: 16px;
}

body.wizard-layout .wizard-preview .page {
  width: 210mm;
  min-height: 297mm;
  margin: 0 auto 24px auto;
  padding: 30px 40px;
  background: #fff;
  border-radius: 2px;
  box-shadow: 0 4px 28px rgba(0,0,0,0.10), 0 1px 4px rgba(0,0,0,0.06);
  animation: docRenderIn 0.45s ease-out both;
  position: relative;
  box-sizing: border-box;
}

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

@media (max-width: 768px) {
  body.wizard-layout .wizard-preview {
    max-height: 70vh;
    overflow-y: auto;
    min-height: 250px;
  }
  body.wizard-layout .wizard-preview .page {
    width: 100%;
    min-height: auto;
    margin: 0 0 16px 0;
    padding: 20px;
    animation: none;
  }
}

@media print {
  body.wizard-layout .wizard-preview .page {
    transform: none !important;
    animation: none !important;
    box-shadow: none !important;
    max-width: none !important;
  }
}

/* ── Render loading overlay ── */
.render-loading-overlay {
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 10;
  gap: 12px;
  border-radius: var(--radius-lg, 12px);
}
[data-theme="dark"] .render-loading-overlay {
  background: rgba(15,23,42,0.7);
}

.render-loading-text {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text-primary, #0f172a);
  text-align: center;
}
[data-theme="dark"] .render-loading-text {
  color: #f1f5f9;
}

/* ═══════════════════════════════════════════════════
   CARD STEPPER — Wizard Progress Card
   ═══════════════════════════════════════════════════ */

.wizard-progress-card {
  background: var(--color-bg-panel, #ffffff);
  border: 1px solid var(--color-border-panel, #e2e8f0);
  border-radius: 12px;
  padding: 14px 18px;
  margin-bottom: 24px;
}

.wizard-progress-card-title-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--color-border-panel, #e2e8f0);
}

.wizard-card-app-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--color-text-primary, #0f172a);
  margin: 0;
  letter-spacing: -0.02em;
  font-family: var(--font-ui, 'Inter', system-ui, sans-serif);
}

.wizard-card-app-subtitle {
  font-size: 11px;
  font-weight: 500;
  color: var(--color-text-muted, #94a3b8);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  font-family: var(--font-ui, 'Inter', system-ui, sans-serif);
}

[data-theme="dark"] .wizard-progress-card-title-row {
  border-bottom-color: var(--color-border-panel, #1f2937);
}

.wizard-progress-card-identity {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px dashed var(--color-border-panel, #e2e8f0);
  font-size: 11px;
  color: var(--color-text-muted, #94a3b8);
  flex-wrap: wrap;
}

.wizard-progress-card-identity.visible {
  display: flex;
}

.wiz-id-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  min-width: 0;
}

.wiz-id-item {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
}

.wiz-id-item i[data-lucide] {
  flex-shrink: 0;
  opacity: 0.5;
}

.wiz-id-sep {
  opacity: 0.35;
  font-weight: 300;
  flex-shrink: 0;
}

.wiz-id-ttd-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  margin-left: auto;
}

.wiz-id-ttd-toggle {
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}

.wiz-id-ttd-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--color-text-muted, #94a3b8);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  user-select: none;
}

.wiz-id-ttd-hint-text {
  font-size: 9px;
  color: var(--color-text-muted, #94a3b8);
  white-space: nowrap;
  line-height: 1;
  background: var(--color-accent-light, #E6F2DD);
  padding: 2px 7px;
  border-radius: 10px;
  border: 1px solid color-mix(in srgb, var(--color-accent, #659287) 20%, transparent);
}

[data-theme="dark"] .wiz-id-ttd-hint-text {
  background: rgba(101, 146, 135, 0.1);
  border-color: rgba(101, 146, 135, 0.2);
}

.wiz-id-date {
  padding: 3px 6px;
  font-size: 10px;
  border: 1px solid var(--color-border-panel, #e2e8f0);
  border-radius: 5px;
  background: var(--color-bg-input, #ffffff);
  color: var(--color-text-primary, #0f172a);
  font-family: var(--font-ui, 'Inter', system-ui, sans-serif);
  width: 112px;
  height: 26px;
}

/* small toggle switch for identity row */
.toggle-switch-sm {
  width: 32px;
  height: 18px;
}

.toggle-switch-sm .toggle-slider::before {
  width: 14px;
  height: 14px;
  left: 2px;
  top: 2px;
}

.toggle-switch-sm input:checked + .toggle-slider::before {
  transform: translateX(14px);
}

[data-theme="dark"] .wizard-progress-card-identity {
  border-bottom-color: var(--color-border-panel, #1f2937);
}

[data-theme="dark"] .wiz-id-date {
  background: var(--color-bg-input, #1e293b);
  border-color: var(--color-border-panel, #334155);
  color: var(--color-text-primary, #f1f5f9);
}

.wizard-progress-card-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.wizard-progress-card-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 40px;
  padding: 3px 10px;
  background: var(--color-accent, #659287);
  color: #ffffff;
  font-size: 12px;
  font-weight: 700;
  border-radius: 20px;
  font-family: var(--font-ui, 'Inter', system-ui, sans-serif);
  transition: all 0.25s ease;
}

.wizard-progress-card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text-primary, #0f172a);
  font-family: var(--font-ui, 'Inter', system-ui, sans-serif);
  transition: color 0.25s ease;
}

.wizard-progress-card-steps {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}

.wizard-progress-card-step {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 5px 12px;
  border: 1px solid var(--color-border-panel, #e2e8f0);
  border-radius: 6px;
  background: transparent;
  color: var(--color-text-muted, #94a3b8);
  font-size: 12px;
  font-weight: 500;
  font-family: var(--font-ui, 'Inter', system-ui, sans-serif);
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
}

.wizard-progress-card-step:hover {
  background: var(--color-bg-hover, rgba(0,0,0,0.04));
  color: var(--color-text-primary, #0f172a);
}

.wizard-progress-card-step.active {
  background: var(--color-accent, #659287);
  border-color: var(--color-accent, #659287);
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 1px 4px rgba(101, 146, 135, 0.3);
}

.wizard-progress-card-step.done {
  background: var(--color-success-bg, #f0fdf4);
  border-color: var(--color-success-border, #86efac);
  color: #16a34a;
  font-weight: 600;
}

.wizard-progress-card-arrow {
  display: flex;
  align-items: center;
  color: var(--color-text-muted, #94a3b8);
  flex-shrink: 0;
}

[data-theme="dark"] .wizard-progress-card {
  background: var(--color-bg-panel, #111827);
  border-color: var(--color-border-panel, #1f2937);
}

[data-theme="dark"] .wizard-progress-card-step {
  border-color: var(--color-border-panel, #1f2937);
}

[data-theme="dark"] .wizard-progress-card-step:hover {
  background: var(--color-bg-hover, rgba(255,255,255,0.05));
}

[data-theme="dark"] .wizard-progress-card-step.done {
  background: rgba(22, 163, 74, 0.1);
  border-color: rgba(22, 163, 74, 0.3);
}

@media (max-width: 600px) {
  .wizard-progress-card {
    padding: 10px 12px;
    border-radius: 10px;
  }

  .wizard-progress-card-title {
    font-size: 12px;
  }

  .wizard-progress-card-badge {
    font-size: 11px;
    min-width: 34px;
    padding: 2px 8px;
  }

  .wizard-progress-card-step {
    font-size: 11px;
    padding: 4px 8px;
  }

  .wizard-progress-card-identity {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  .wiz-id-ttd-controls {
    margin-left: 0;
    width: 100%;
    justify-content: flex-end;
  }

  .wiz-id-item {
    max-width: 160px;
  }
}

@media print {
  .wizard-progress-card {
    display: none !important;
  }
}

/* ═══════════════════════════════════════════════════
   HEADER OVERRIDE — WIZARD LAYOUT (Hidden)
   Judul dipindah ke wizard-progress-card.
   ═══════════════════════════════════════════════════ */

body.wizard-layout .app-header[data-shared-header="v1"] {
  display: none;
}

/* ═══════════════════════════════════════════════════
   PREVIEW THEME BAR — Step 4
   ═══════════════════════════════════════════════════ */

.preview-theme-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  margin-bottom: 12px;
  background: var(--color-bg-panel, #ffffff);
  border: 1px solid var(--color-border-panel, #e2e8f0);
  border-radius: 8px;
}

.preview-theme-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text-secondary, #475569);
  white-space: nowrap;
  flex-shrink: 0;
}

.preview-theme-bar .theme-select {
  flex: 1;
  min-width: 0;
  padding: 5px 10px;
  font-size: 13px;
  font-family: var(--font-ui, 'Inter', system-ui, sans-serif);
  border: 1px solid var(--color-border-panel, #e2e8f0);
  border-radius: 6px;
  background: var(--color-bg-input, #ffffff);
  color: var(--color-text-primary, #0f172a);
  cursor: pointer;
}

[data-theme="dark"] .preview-theme-bar {
  background: var(--color-bg-panel, #111827);
  border-color: var(--color-border-panel, #1f2937);
}

[data-theme="dark"] .preview-theme-bar .theme-select {
  background: var(--color-bg-input, #1e293b);
  border-color: var(--color-border-panel, #334155);
  color: var(--color-text-primary, #f1f5f9);
}

@media print {
  .preview-theme-bar {
    display: none !important;
  }
}

/* ═══════════════════════════════════════════════════
   FLOATING SIDEBAR
   ═══════════════════════════════════════════════════ */

.floating-sidebar {
  position: fixed;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 30;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  background: var(--color-bg-panel, #ffffff);
  border: 1px solid var(--color-border-panel, #e2e8f0);
  border-radius: 12px;
  padding: 6px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.08), 0 1px 3px rgba(0,0,0,0.04);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.floating-sidebar.visible {
  opacity: 1;
  pointer-events: auto;
}

.floating-sidebar-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--color-text-secondary, #475569);
  cursor: pointer;
  transition: all 0.15s ease;
  position: relative;
}

.floating-sidebar-btn:hover {
  background: var(--color-bg-hover, rgba(0,0,0,0.04));
  color: var(--color-text-primary, #0f172a);
}

.floating-sidebar-btn:active {
  transform: scale(0.95);
}

.floating-sidebar-btn-primary {
  background: var(--color-accent, #659287);
  color: #ffffff;
}

.floating-sidebar-btn-primary:hover {
  background: var(--color-accent-hover, #51746b);
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(101, 146, 135, 0.3);
}

.floating-sidebar-btn-primary:active {
  transform: scale(0.95);
}

.floating-sidebar-tooltip {
  position: absolute;
  right: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%);
  background: #0f172a;
  color: #ffffff;
  font-size: 11px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 6px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease;
  font-family: var(--font-ui, 'Inter', system-ui, sans-serif);
  line-height: 1.3;
}

.floating-sidebar-btn:hover .floating-sidebar-tooltip {
  opacity: 1;
}

.floating-sidebar-divider {
  width: 24px;
  height: 1px;
  background: var(--color-border-panel, #e2e8f0);
  margin: 4px 0;
}

/* ═══════════════════════════════════════════════════
   DRAWER — Dokumen Tersimpan
   ═══════════════════════════════════════════════════ */

.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  z-index: 80;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  animation: drawerFadeIn 0.2s ease;
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(400px, 85vw);
  max-width: 480px;
  background: var(--color-bg-panel, #ffffff);
  z-index: 90;
  box-shadow: -4px 0 24px rgba(0,0,0,0.10);
  display: flex;
  flex-direction: column;
  animation: drawerSlideIn 0.25s ease-out;
  overflow: hidden;
}

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-bottom: 1px solid var(--color-border-panel, #e2e8f0);
  flex-shrink: 0;
}

.drawer-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 600;
  color: var(--color-text-primary, #0f172a);
  margin: 0;
}

.drawer-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--color-text-secondary, #475569);
  cursor: pointer;
  transition: all 0.15s ease;
}

.drawer-close:hover {
  background: var(--color-bg-hover, rgba(0,0,0,0.04));
  color: var(--color-text-primary, #0f172a);
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
}

@keyframes drawerFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes drawerSlideIn {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

/* ═══════════════════════════════════════════════════
   FAB — Floating Action Button (mobile)
   ═══════════════════════════════════════════════════ */

.fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 60;
  display: none;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border: none;
  border-radius: 50%;
  background: var(--color-accent, #659287);
  color: #ffffff;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(101, 146, 135, 0.35);
  transition: all 0.2s ease;
}

.fab:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(101, 146, 135, 0.45);
}

.fab:active {
  transform: scale(0.93);
}

/* ═══════════════════════════════════════════════════
   BOTTOM SHEET (mobile)
   ═══════════════════════════════════════════════════ */

.bottom-sheet-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  z-index: 90;
  animation: drawerFadeIn 0.2s ease;
}

.bottom-sheet {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 95;
  background: var(--color-bg-panel, #ffffff);
  border-radius: 16px 16px 0 0;
  box-shadow: 0 -4px 24px rgba(0,0,0,0.10);
  animation: bottomSheetSlideUp 0.3s ease-out;
  max-height: 70vh;
  overflow-y: auto;
  padding-bottom: env(safe-area-inset-bottom, 16px);
}

.bottom-sheet-handle {
  width: 36px;
  height: 4px;
  background: var(--color-border-panel, #e2e8f0);
  border-radius: 2px;
  margin: 10px auto 6px;
  flex-shrink: 0;
}

.bottom-sheet-actions {
  padding: 8px 16px 16px;
}

.bottom-sheet-action {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 14px 16px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: var(--color-text-primary, #0f172a);
  font-size: 14px;
  font-weight: 500;
  font-family: var(--font-ui, 'Inter', system-ui, sans-serif);
  cursor: pointer;
  transition: background 0.15s ease;
}

.bottom-sheet-action:hover {
  background: var(--color-bg-hover, rgba(0,0,0,0.04));
}

.bottom-sheet-action span {
  flex: 1;
  text-align: left;
}

.bottom-sheet-divider {
  height: 1px;
  background: var(--color-border-panel, #e2e8f0);
  margin: 6px 16px;
}

@keyframes bottomSheetSlideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

/* ═══════════════════════════════════════════════════
   RESPONSIVE — Sembunyikan/Munculkan Elemen
   ═══════════════════════════════════════════════════ */

@media (min-width: 1024px) {
  .floating-sidebar {
    opacity: 1;
    pointer-events: auto;
  }

  .fab,
  .bottom-sheet,
  .bottom-sheet-overlay {
    display: none !important;
  }
}

@media (max-width: 1023px) {
  .floating-sidebar {
    display: none !important;
  }

  .fab {
    display: flex;
  }
}

/* ═══════════════════════════════════════════════════
   DARK MODE — Sidebar, Drawer, Bottom Sheet
   ═══════════════════════════════════════════════════ */

[data-theme="dark"] .floating-sidebar {
  background: var(--color-bg-panel, #111827);
  border-color: var(--color-border-panel, #1f2937);
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

[data-theme="dark"] .floating-sidebar-btn:hover {
  background: var(--color-bg-hover, rgba(255,255,255,0.05));
}

[data-theme="dark"] .floating-sidebar-tooltip {
  background: #1e293b;
  color: #f1f5f9;
}

[data-theme="dark"] .drawer {
  background: var(--color-bg-panel, #111827);
}

[data-theme="dark"] .drawer-header {
  border-bottom-color: var(--color-border-panel, #1f2937);
}

[data-theme="dark"] .bottom-sheet {
  background: var(--color-bg-panel, #111827);
}

[data-theme="dark"] .bottom-sheet-action:hover {
  background: var(--color-bg-hover, rgba(255,255,255,0.05));
}

/* ═══════════════════════════════════════════════════
   LUCIDE ICON — Style Default
   ═══════════════════════════════════════════════════ */

.icon {
  display: inline-block;
  vertical-align: middle;
}

i[data-lucide] {
  display: inline-block;
  vertical-align: middle;
}

.btn i[data-lucide] {
  width: 1em;
  height: 1em;
  flex-shrink: 0;
}

.section-title i[data-lucide] {
  width: 16px;
  height: 16px;
  margin-right: 6px;
}

.icon-spin {
  animation: iconSpin 1s linear infinite;
}

@keyframes iconSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* ═══════════════════════════════════════════════════
   PRINT — Sembunyikan sidebar, drawer, FAB
   ═══════════════════════════════════════════════════ */
@media print {
  .floating-sidebar,
  .fab,
  .drawer,
  .drawer-overlay,
  .bottom-sheet,
  .bottom-sheet-overlay,
  .preview-theme-bar {
    display: none !important;
  }
}

/* ═══════════════════════════════════════════════════
   STANDALONE .btn-copy & .btn-generate STYLES
   ═══════════════════════════════════════════════════ */

.btn-copy {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  font-size: 14px;
  font-weight: 700;
  border: none;
  border-radius: var(--radius-md, 8px);
  cursor: pointer;
  font-family: var(--font-ui, 'Inter', system-ui, sans-serif);
  transition: all 0.18s ease;
  background: var(--color-accent, #659287);
  color: #ffffff;
  box-shadow: 0 1px 3px rgba(101, 146, 135, 0.3);
}

.btn-copy:hover {
  background: var(--color-accent-hover, #51746b);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(101, 146, 135, 0.4);
}

.btn-copy:active {
  transform: scale(0.98);
}

.btn-copy.copy-sukses {
  background: var(--color-btn-neutral, #e2e8f0) !important;
  color: var(--color-btn-neutral-txt, #475569) !important;
  box-shadow: none !important;
}

.btn-generate {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  font-size: 14px;
  font-weight: 700;
  border: none;
  border-radius: var(--radius-md, 8px);
  cursor: pointer;
  font-family: var(--font-ui, 'Inter', system-ui, sans-serif);
  transition: all 0.18s ease;
  background: var(--accent, #4f46e5);
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(79, 70, 229, 0.3);
}

.btn-generate:hover {
  background: var(--color-accent-hover, #4338ca);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(79, 70, 229, 0.4);
}

.btn-render {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  font-size: 14px;
  font-weight: 700;
  border: none;
  border-radius: var(--radius-md, 8px);
  cursor: pointer;
  font-family: var(--font-ui, 'Inter', system-ui, sans-serif);
  transition: all 0.18s ease;
  width: 100%;
  background: var(--color-btn-success, #16a34a);
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(22, 163, 74, 0.3);
}

.btn-render:hover {
  background: var(--color-btn-success-hv, #15803d);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(22, 163, 74, 0.4);
}

/* ═══════════════════════════════════════════════════
   MODAL — Dark Mode
   ═══════════════════════════════════════════════════ */

[data-theme="dark"] .modal-content {
  background: var(--color-bg-panel, #111827);
}

[data-theme="dark"] .modal-header {
  border-bottom-color: var(--color-border-panel, #1f2937);
}

[data-theme="dark"] .modal-header h3 {
  color: var(--color-text-primary, #f1f5f9);
}

[data-theme="dark"] .upload-area {
  border-color: var(--color-border-panel, #374151);
}

[data-theme="dark"] .upload-placeholder p {
  color: var(--color-text-primary, #f1f5f9);
}

/* ═══════════════════════════════════════════════════
   PRINT OVERRIDE — Wizard Layout
   ═══════════════════════════════════════════════════ */

@media print {
  @page {
    margin: 0mm;
  }

  html {
    height: auto !important;
    min-height: 0 !important;
  }

  body {
    height: auto !important;
    min-height: 0 !important;
    display: block !important;
    flex-direction: unset !important;
  }

  .wizard-container,
  .wizard-content,
  .wizard-step,
  .wizard-preview {
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    flex: unset !important;
    display: block !important;
    overflow: visible !important;
  }

  * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }

  body {
    background: white !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .app-header,
  .wizard-progress,
  .wizard-step-header,
  .wizard-nav,
  .wizard-actions,
  .wizard-content > .form-section,
  .form-section .section-header,
  .prompt-mode-wrapper,
  .preview-empty-state,
  ::-webkit-scrollbar,
  #btnEditGambar,
  [onclick*="goToStep"] {
    display: none !important;
  }

  #previewDokumen {
    display: block !important;
    width: 100% !important;
    height: auto !important;
    overflow: visible !important;
    padding: 0 !important;
    margin: 0 !important;
    background: white !important;
  }

  #previewDokumen .page {
    width: 210mm !important;
    min-height: 0 !important;
    height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    box-shadow: none !important;
    background: white !important;
    border: none !important;
  }

  #previewDokumen,
  #previewDokumen .page {
    min-height: 0 !important;
    height: auto !important;
  }

  table { 
    page-break-inside: auto !important; 
  }
  
  tr { 
    page-break-inside: avoid !important; 
    page-break-after: auto !important; 
  }

  thead {
    display: table-header-group !important;
  }

  html, body {
    height: auto !important;
    overflow: visible !important;
  }
}
