/* ===== CSS VARIABLES ===== */
:root {
  --ink         : #2c3e50;
  --ink-light   : var(--color-text-secondary);
  --ink-faint   : var(--color-text-muted);
  --paper       : var(--color-bg-app);
  --paper-warm  : var(--color-bg-section);
  --ui-bg       : var(--color-bg-app);
  --ui-border   : var(--color-border-panel);
  --accent      : var(--color-accent);
  --accent-light: var(--color-accent-hover);
  --rule        : var(--color-border-panel);
  --rule-dark   : var(--color-border-input);
  --shadow      : 0 2px 20px rgba(0,0,0,0.08),
                  0 1px 4px rgba(0,0,0,0.04);
  --ui-font     : var(--font-ui);
  --header-height: 60px;
  --radius-sm   : var(--radius-md);
  --radius-md   : var(--radius-lg);
}

[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 ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--ui-font);
    background: var(--paper);
    color: var(--ink);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ===== HEADER APLIKASI ===== */
.app-header {
    background: var(--color-bg-app-header);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    color: var(--paper);
    padding: 0 28px;
    height: var(--header-height);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 2px solid var(--accent);
    box-shadow: 0 1px 0 rgba(255,255,255,0.04), 0 4px 32px rgba(0,0,0,0.3);
}


.btn-toggle-panel {
    background: rgba(0,0,0,0.25);
    color: var(--color-text-app-header);
    border: 1px solid rgba(0,0,0,0.3);
    border-radius: 4px;
    padding: 4px 10px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    margin: 0;
    transition: background 0.2s ease;
    line-height: 1;
    flex-shrink: 0;
}

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

.theme-selector-wrapper {
    gap: 4px;
    padding: 4px 8px;
    margin-right: 8px;
}

.theme-select {
    font-size: 0.72rem;
    padding: 4px 6px;
    max-width: 110px;
}

.theme-label {
    font-size: 0.85rem;
}

.app-title {
    flex-shrink: 0;
    gap: 8px;
}

.btn-toggle-panel:hover {
    background: rgba(0,0,0,0.4);
}

.action-buttons {
    display: flex;
    gap: 8px;
}

/* ===== BUTTONS ===== */
.btn {
    font-family: var(--ui-font);
    font-size: 0.8rem;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    transition: all 0.18s ease;
    font-weight: 600;
    letter-spacing: 0.02em;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    white-space: nowrap;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
}

.btn-print {
    background: var(--accent);
    color: white;
    border: 1px solid rgba(255,255,255,0.15);
    box-shadow: 0 2px 12px rgba(196,98,46,0.4);
}

.btn-print:hover {
    background: var(--accent-light);
    box-shadow: 0 4px 20px rgba(196,98,46,0.6);
    transform: translateY(-2px);
}

.btn-dashboard {
    background: var(--accent);
    color: white;
    border: 1px solid rgba(255,255,255,0.15);
    padding: 7px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-normal);
    box-shadow: 0 2px 8px rgba(196,98,46,0.3);
    white-space: nowrap;
}

.btn-dashboard:hover {
    background: var(--accent-light);
    box-shadow: 0 4px 16px rgba(196,98,46,0.5);
    transform: translateY(-1px);
}

.btn-dashboard:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(196,98,46,0.3);
}

/* ===== MAIN LAYOUT ===== */
.app-body {
    flex: 1;
    display: grid;
    grid-template-columns: 30% 70%;
    gap: 0;
    height: calc(100vh - var(--header-height));
    overflow: hidden;
    transition: grid-template-columns 0.3s ease;
}

.app-body.panel-collapsed {
    grid-template-columns: 0% 100%;
}

/* ===== PANEL KIRI ===== */
.panel-left {
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--rule-dark);
    background: var(--ui-bg);
    overflow-y: auto;
    height: calc(100vh - 60px);
    transition: padding 0.3s ease;
}

.panel-left.collapsed {
    overflow: hidden;
    padding: 0;
    border-right: none;
}

/* ===== PANEL KANAN ===== */
.panel-right {
    display: flex;
    flex-direction: column;
    background: var(--paper);
    overflow-y: auto;
    height: calc(100vh - 60px);
}

/* ===== PANEL LABEL ===== */
.panel-label {
    padding: 12px 20px;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--ink-faint);
    border-bottom: 1px solid var(--rule);
    background: var(--paper-warm);
    font-family: 'JetBrains Mono', monospace;
    border-left: 3px solid var(--accent);
    position: relative;
}

/* Panel label responsive */
@media (max-width: 768px) {
    .panel-label {
        padding: 10px 16px;
        font-size: 0.65rem;
        border-left-width: 2px;
    }
}

@media (max-width: 480px) {
    .panel-label {
        padding: 8px 12px;
        font-size: 0.6rem;
        border-left: none;
    }
}

@media (max-width: 375px) {
    .panel-label {
        padding: 6px 10px;
        font-size: 0.55rem;
    }
}

/* ===== PANEL CONTENT ===== */
.panel-content {
    flex: 1;
    padding: 0;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

/* Panel content responsive - handle inline padding style */
@media (max-width: 768px) {
    .panel-content {
        padding: 0 !important;
    }

    .panel-content > * {
        padding: 16px !important;
    }
}

@media (max-width: 480px) {
    .panel-content > * {
        padding: 12px !important;
    }
}

@media (max-width: 375px) {
    .panel-content > * {
        padding: 10px !important;
    }
}

.form-container {
    padding: var(--form-container-padding, 16px);
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* ── STEPPER NAVIGATOR ── */
.stepper-nav {
  display: flex;
  align-items: center;
  gap: 0;
  background: var(--color-bg-panel);
  border-bottom: 2px solid var(--ui-border);
  padding: 8px 12px;
  flex-shrink: 0;
  margin-bottom: var(--spacing-md, 12px);
  overflow-x: hidden;
}

.step-connector {
  flex: 1;
  height: 2px;
  background: var(--ui-border);
  min-width: 6px;
  max-width: 20px;
  transition: background 0.3s ease;
}

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

.step-item:hover {
  background: var(--color-bg-hover, rgba(0,0,0,0.05));
}

.step-circle {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--ui-border);
  color: var(--ink-faint);
  font-size: 11px;
  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-label disembunyikan — tidak informatif di ruang sempit */
.step-label {
  display: none;
}

/* step-info + step-title: hanya tampil di step active */
.step-info {
  display: none;
  flex-direction: column;
  gap: 1px;
  line-height: 1;
}

.step-item.active .step-info {
  display: flex;
}

.step-title {
  font-size: 10px;
  font-weight: 700;
  color: var(--ink-faint);
  white-space: nowrap;
  max-width: 90px;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* State: aktif */
.step-item.active .step-circle {
  background: var(--color-stepper-active, #e67e22);
  border-color: var(--color-stepper-active, #e67e22);
  color: white;
  box-shadow: 0 2px 8px rgba(230,126,34,0.35);
}

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

/* State: selesai (done) */
.step-item.done .step-circle {
  background: var(--color-stepper-done, #2e7d32);
  border-color: var(--color-stepper-done, #2e7d32);
  color: white;
}

.step-item.done .step-label,
.step-item.done .step-title {
  color: var(--color-stepper-done, #2e7d32);
}

.step-item.done + .step-connector {
  background: var(--color-stepper-done, #2e7d32);
}

/* Dark mode */
[data-theme="dark"] .step-item:hover {
  background: rgba(255,255,255,0.05);
}

/* Responsive stepper — sudah ditangani oleh logika active di atas */
@media (max-width: 1024px) {
  .stepper-nav {
    padding: 6px 8px;
  }
  .step-circle {
    width: 22px;
    height: 22px;
    font-size: 10px;
  }
  .step-connector {
    min-width: 4px;
  }
}

.module-panel {
  display: none;
  flex: 1;
}

.module-panel.active {
  display: flex;
  flex-direction: column;
}

/* Button lanjut tab */
.btn-lanjut-tab2 {
  width: 100%;
  background: var(--accent);
  color: white;
  border: none;
  padding: 12px 20px;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.18s ease;
  margin-top: 16px;
}

.btn-lanjut-tab2:hover {
  background: var(--accent-light);
  transform: translateY(-1px);
}

/* ── BADGE OPSIONAL ── */
.badge-opsional {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  color: #6c757d;
  background: #e9ecef;
  padding: 2px 6px;
  border-radius: 3px;
  margin-left: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

[data-theme="dark"] .badge-opsional {
  color: #adb5bd;
  background: #495057;
}

/* ── CTA LANJUT TAB ── */
.tab1-cta-lanjut {
  margin: 8px 0 16px;
  padding: 14px 16px;
  background: var(--color-bg-section, #f8f9fa);
  border: 1px solid var(--color-border-panel, #e9ecef);
  border-radius: var(--radius-sm);
  text-align: center;
}

.tab1-cta-info {
  font-size: 13px;
  color: #2e7d32;
  font-weight: 600;
  margin-bottom: 8px;
}

[data-theme="dark"] .tab1-cta-lanjut {
  background: var(--color-bg-section);
  border-color: var(--color-border-panel);
}

[data-theme="dark"] .tab1-cta-info {
  color: #81c784;
}

/* ── TOGGLE SWITCH VISUAL ── */
.toggle-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--ink);
  margin: 0;
  padding: 0;
  margin-bottom: 0;
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  cursor: pointer;
}

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

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: .4s;
  border-radius: 24px;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .4s;
  border-radius: 50%;
}

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

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

[data-theme="dark"] .toggle-slider {
  background-color: #555;
}

[data-theme="dark"] .toggle-slider:before {
  background-color: #fff;
}

/* ── TIP CARD GUIDANCE ── */
.prompt-tip-card {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  background: #e3f2fd;
  border: 1px solid #bbdefb;
  border-radius: var(--radius-sm);
  padding: 12px;
  margin-bottom: 16px;
  font-size: 13px;
  line-height: 1.5;
}

.prompt-tip-icon {
  font-size: 15px;
  flex-shrink: 0;
  margin-top: 1px;
}

.prompt-tip-teks {
  flex: 1;
}

.prompt-tip-teks strong {
  color: #1976d2;
}

[data-theme="dark"] .prompt-tip-card {
  background: #1a237e;
  border-color: #3949ab;
  color: #c5cae9;
}

[data-theme="dark"] .prompt-tip-teks strong {
  color: #64b5f6;
}

/* ── COPY EXPERIENCE ENHANCEMENT ── */
.btn-copy {
  position: relative;
  transition: all 0.2s ease;
}

.btn-copy.copy-sukses {
  background: #e8f5e9 !important;
  color: #2e7d32 !important;
  border-color: #c8e6c9 !important;
}

.btn-copy.copy-sukses:hover {
  background: #c8e6c9 !important;
}

[data-theme="dark"] .btn-copy.copy-sukses {
  background: #1b3a1e !important;
  color: #81c784 !important;
  border-color: #2e5c32 !important;
}

[data-theme="dark"] .btn-copy.copy-sukses:hover {
  background: #234a27 !important;
}

/* ===== FORM SECTIONS ===== */
.form-section {
    margin-bottom: var(--form-section-gap, 12px);
    padding: 12px 14px;
    background: var(--paper-warm);
    border-radius: 8px;
    border-bottom: none;
}

.form-section:last-child {
    border-bottom: none;
    margin-bottom: 0;
}

/* ===== SECTION HEADER (COLLAPSIBLE) ===== */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    user-select: none;
    padding: 0;
    margin: 0;
    gap: 12px;
}

.section-header:hover .section-title {
    color: var(--accent);
}

/* ===== SECTION BODY (COLLAPSIBLE CONTENT) ===== */
.section-body {
    max-height: 2000px;
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.3s ease;
    opacity: 1;
    margin-top: 16px;
}

.section-body.collapsed {
    max-height: 0;
    opacity: 0;
    margin-top: 0;
}

/* ===== SECTION TOGGLE ICON ===== */
.section-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    color: var(--ink-faint);
    transition: transform 0.3s ease;
    flex-shrink: 0;
    width: 20px;
    height: 20px;
}

.section-toggle.collapsed {
    transform: rotate(-90deg);
}

.section-title {
    font-family: var(--ui-font);
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--ink);
    margin-bottom: 0;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.section-title::before {
    content: '';
    width: 3px;
    height: 16px;
    background: var(--accent);
    border-radius: 2px;
    flex-shrink: 0;
}

/* ===== FORM GROUPS ===== */
.form-group {
    margin-bottom: var(--form-group-gap, 8px);
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-group label {
    display: block;
    font-family: var(--ui-font);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--ink);
    margin-bottom: var(--form-label-gap, 3px);
    letter-spacing: 0.02em;
}

/* ===== CHECKBOX STYLING ===== */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--ink);
    margin: 0;
    padding: 0;
    margin-bottom: 0;
}

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

/* ===== FORM ROW (untuk layout horizontal) ===== */
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.form-row .form-group {
    margin-bottom: 0;
}

/* ===== READONLY FIELDS ===== */
.form-group.readonly input {
    background-color: #f5f5f5;
    border-color: #ddd;
    cursor: not-allowed;
    color: #666;
}

.form-group.readonly label::after {
    content: " (auto-fill dari Profil)";
    font-size: 11px;
    color: #999;
    font-weight: normal;
    margin-left: 6px;
}

/* ===== HELP TEXT ===== */
.help-text {
    display: block;
    margin-top: 4px;
    font-size: 11px;
    color: #666;
}

.help-text a {
    color: var(--accent);
    text-decoration: none;
}

.help-text a:hover {
    text-decoration: underline;
}

/* ===== INPUT STYLES ===== */
input[type="text"],
select,
textarea {
    width: 100%;
    padding: var(--form-input-padding-v, 6px) var(--form-input-padding-h, 8px);
    border: 1px solid var(--ui-border);
    border-radius: var(--radius-sm);
    font-family: var(--ui-font);
    font-size: 0.78rem;
    color: var(--ink);
    background: var(--color-bg-panel);
    transition: all 0.18s ease;
    outline: none;
}

input[type="date"] {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid var(--ui-border);
    border-radius: var(--radius-sm);
    font-family: var(--ui-font);
    font-size: 0.78rem;
    color: var(--ink);
    background: var(--color-bg-panel);
    transition: all 0.18s ease;
    outline: none;
}

input[type="text"]:hover,
input[type="date"]:hover,
select:hover,
textarea:hover {
    border-color: var(--ui-border);
    box-shadow: 0 2px 6px rgba(0,0,0,0.08);
}

input[type="text"]:focus,
input[type="date"]:focus,
select:focus,
textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(196, 98, 46, 0.1);
}

input[type="text"]::placeholder,
textarea::placeholder {
    color: var(--ink-faint);
    font-style: italic;
}

select {
    cursor: pointer;
}

textarea {
    resize: vertical;
    min-height: 90px;
    line-height: 1.4;
}

/* ===== INPUT WITH BUTTON ===== */
.input-with-button {
    display: flex;
    gap: 8px;
    align-items: flex-end;
}

.input-with-button input[type="text"] {
    flex: 1;
}

/* ===== BUTTON VARIANTS ===== */
.btn-add {
    background: var(--ink-light);
    color: white;
    border: none;
    padding: 10px 16px;
    white-space: nowrap;
    font-size: 0.8rem;
}

.btn-add:hover {
    background: var(--ink);
    transform: translateY(-1px);
}

.btn-generate {
    width: 100%;
    background: var(--accent);
    color: white;
    border: none;
    padding: 12px 20px;
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    box-shadow: 0 2px 12px rgba(196,98,46,0.4);
    margin-top: 8px;
}

.btn-generate:hover {
    background: var(--accent-light);
    box-shadow: 0 4px 20px rgba(196,98,46,0.6);
    transform: translateY(-2px);
}

/* ===== ELEMEN LIST ===== */
.elemen-list {
    margin-top: 16px;
    padding: 12px;
    background: var(--paper-warm);
    border: 1px solid var(--rule);
    border-radius: var(--radius-sm);
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--ink-faint);
    font-style: italic;
    font-size: 0.85rem;
}

.elemen-list:not(:empty) {
    justify-content: flex-start;
    align-items: stretch;
    flex-direction: column;
    gap: 8px;
}

.elemen-item {
    background: var(--color-bg-panel);
    border: 1px solid var(--rule);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    color: var(--ink);
}

.elemen-item button {
    background: none;
    border: none;
    color: var(--ink-faint);
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.75rem;
}

.elemen-item button:hover {
    background: var(--rule);
    color: var(--ink);
}

/* ===== FORM DIVIDER ===== */
.form-divider {
    height: 1px;
    background: var(--rule);
    margin: 8px 0;
    opacity: 0.6;
}

/* ===== INSTRUCTION TEXT ===== */
.instruction-text {
    font-size: 0.75rem;
    color: var(--ink-faint);
    font-style: italic;
    margin-bottom: 8px;
    line-height: 1.4;
}

/* ===== READONLY TEXTAREA ===== */
textarea[readonly] {
    background: var(--paper-warm);
    color: var(--ink-light);
    cursor: not-allowed;
    resize: none;
}

textarea[readonly]:focus {
    border-color: var(--rule);
    box-shadow: none;
}

textarea[readonly]::placeholder {
    color: var(--ink-faint);
    opacity: 0.7;
}

/* ===== BUTTON VARIANTS ===== */
.btn-copy {
    width: 100%;
    background: var(--ink-light);
    color: white;
    border: 1px solid var(--ink-light);
    padding: 10px 16px;
    font-size: 0.8rem;
    font-weight: 600;
    margin-top: 8px;
}

.btn-copy:hover {
    background: var(--ink);
    border-color: var(--ink);
    transform: translateY(-1px);
}

.btn-render {
    width: 100%;
    background: var(--color-btn-success);
    color: white;
    border: none;
    padding: 12px 20px;
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    box-shadow: 0 2px 12px rgba(40, 167, 69, 0.3);
    margin-top: 8px;
}

.btn-render:hover {
    background: var(--color-btn-success-hv);
    box-shadow: 0 4px 20px rgba(40, 167, 69, 0.4);
    transform: translateY(-2px);
}

/* ===== RESPONSIVE FORM ===== */
@media (max-width: 768px) {
    .form-container {
        padding: 16px;
    }

    .form-section {
        margin-bottom: 20px;
        padding-bottom: 16px;
    }

    .input-with-button {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }

    .input-with-button input[type="text"] {
        width: 100%;
    }

    .btn-add {
        width: 100%;
        padding: 10px;
    }
}

/* ═══════════════════════════════════════════
   HEADER RESPONSIVE
   ═══════════════════════════════════════════ */

/* Tablet (≤768px) */
@media (max-width: 768px) {
    .app-header {
        padding: 0 16px;
        height: 56px;
    }

    .header-left {
        gap: 8px;
    }

    .app-title {
        gap: 8px;
    }

    .app-name {
        font-size: 1.2rem;
    }

    .app-subtitle {
        display: none;
    }

    .btn-toggle-panel {
        padding: 4px 8px;
        font-size: 0.9rem;
    }

    .theme-selector-wrapper {
        padding: 4px 8px;
        margin-right: 8px;
    }

    .theme-label {
        font-size: 0.8rem;
    }

    .theme-select {
        font-size: 0.7rem;
        padding: 3px 6px;
        max-width: 90px;
    }

    .btn-dashboard {
        padding: 7px;
        font-size: 0;
        min-width: 34px;
        min-height: 34px;
        justify-content: center;
    }

    .btn-dashboard span {
        display: none;
    }

    .btn-print,
    .btn-simpan-cloud {
        padding: 7px;
        font-size: 0;
        min-width: 34px;
        min-height: 34px;
        justify-content: center;
    }

    .btn-print span,
    .btn-simpan-cloud span {
        display: none;
    }

    .btn {
        font-size: 0.75rem;
        padding: 6px 12px;
    }

    .header-actions {
        gap: 8px;
    }

    .action-buttons {
        gap: 6px;
    }
}

/* Mobile besar (≤480px) */
@media (max-width: 480px) {
    /* Header: layout kolom vertikal */
    .app-header {
        padding: 0 12px;
        height: auto;
        min-height: 52px;
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
    }

    .header-left {
        gap: 6px;
        width: 100%;
        justify-content: space-between;
    }

    /* Header actions: kolom vertikal */
    .header-actions {
        width: 100%;
        display: flex;
        flex-direction: column;
        gap: 6px;
    }

    .selector-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 4px;
        width: 100%;
    }

    .selector-grid .theme-selector-wrapper {
        margin-right: 0;
        width: 100%;
        justify-content: center;
    }

    .app-title {
        gap: 6px;
        flex: 1;
        min-width: 0;
        align-items: center;
    }

    .app-name {
        font-size: 1rem;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .app-subtitle {
        display: none;
    }

    .btn-toggle-panel {
        padding: 4px 6px;
        font-size: 0.85rem;
    }

    /* Theme selectors - compact */
    .theme-selector-wrapper {
        padding: 3px 6px;
        margin-right: 0;
        gap: 4px;
    }

    .theme-label {
        font-size: 14px;
    }

    .theme-select {
        font-size: 10px;
        padding: 2px 4px;
        max-width: 80px;
    }

    /* Dashboard button: full width */
    .btn-dashboard {
        width: 100%;
        padding: 8px 12px;
        min-height: 38px;
        justify-content: center;
    }

    .btn-dashboard span {
        display: inline;
    }

    /* Action buttons: stack vertikal full width */
    .action-buttons {
        width: 100%;
        display: flex;
        flex-direction: column;
        gap: 6px;
    }

    .btn-print,
    .btn-simpan-cloud {
        width: 100%;
        padding: 8px 12px;
        min-height: 38px;
        justify-content: center;
    }

    /* Tampilkan teks tombol lagi */
    .btn-print span,
    .btn-simpan-cloud span {
        display: inline;
    }
}

/* Mobile kecil (≤375px) */
@media (max-width: 375px) {
    .app-header {
        padding: 0 8px;
        gap: 6px;
    }

    .app-title {
        gap: 4px;
    }

    .app-name {
        font-size: 0.9rem;
    }

    .btn-toggle-panel {
        padding: 3px 5px;
        font-size: 0.8rem;
    }

    .theme-selector-wrapper {
        padding: 2px 4px;
    }

    .theme-select {
        font-size: 9px;
        padding: 2px 3px;
        max-width: 70px;
    }

    .btn-dashboard {
        padding: 6px 10px;
    }

    .btn-print,
    .btn-simpan-cloud {
        padding: 6px 10px;
    }
}

/* ═══════════════════════════════════════════
   PANEL LAYOUT RESPONSIVE
   ═══════════════════════════════════════════ */

@media (max-width: 768px) {
    .app-body {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
    }

    .panel-left {
        border-right: none;
        border-bottom: 1px solid var(--rule-dark);
        max-height: 50vh;
    }

    .panel-right {
        min-height: 400px;
    }
}

/* ===== PRINT STYLES ===== */
@media print {
  @page {
    size: A4 portrait;
    margin: 0mm;
  }

  /* Reset semua tinggi dari layout normal */
  html {
    height: auto !important;
    min-height: 0 !important;
  }

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

  /* Reset semua flex container */
  .app-layout,
  .app-container,
  .main-container,
  .panel-right,
  #preview-container,
  #document-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;
    flex-direction: unset !important;
  }

  /* Sembunyikan semua elemen UI */
  .app-header,
  .panel-left,
  .panel-divider,
  #preview-container > *:not(#document-preview),
  .preview-placeholder,
  .panel-label,
  ::-webkit-scrollbar {
    display: none !important;
  }

  /* Layout print */
  .app-layout,
  .panel-right {
    display: block !important;
    width: 100% !important;
    height: auto !important;
    overflow: visible !important;
    padding: 0 !important;
    margin: 0 !important;
    border: none !important;
    background: white !important;
  }

  .panel-right {
    background: white !important;
    border: none !important;
    outline: none !important;
    box-shadow: none !important;
  }

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

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

  /* Dokumen A4 */
  .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;
    outline: none !important;
  }

  /* Pastikan tidak ada elemen lain 
     yang menambah tinggi halaman */
  #document-preview,
  #preview-container {
    min-height: 0 !important;
    height: auto !important;
  }

  /* Footer dokumen tidak boleh jadi 
     halaman terpisah */
  .doc-footer {
    page-break-before: avoid !important;
    page-break-after: avoid !important;
  }

  /* Semua section tidak memulai 
     halaman baru kecuali diperlukan */
  .section-title {
    page-break-after: avoid !important;
    page-break-inside: avoid !important;
  }

  table.main,
  table.fase,
  table.ppp {
    page-break-before: avoid !important;
  }

  /* Hanya hindari baris tabel 
     terpotong di tengah */
  table { 
    page-break-inside: auto !important; 
  }
  
  tr { 
    page-break-inside: avoid !important; 
    page-break-after: auto !important; 
  }

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

  /* Hapus halaman kosong */
  html, body {
    height: auto !important;
    overflow: visible !important;
  }
}

/* ── Fitur Simpan ke Cloud ── */
.btn-simpan-cloud {
    background: var(--color-accent, #e07b39);
    color: #fff;
    border: none;
    padding: 7px 14px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 0.8rem;
    margin-left: 8px;
    transition: opacity 0.2s;
}
.btn-simpan-cloud:hover { opacity: 0.85; }
.btn-simpan-cloud:disabled { opacity: 0.5; cursor: not-allowed; }

.dokumen-item {
    border: 1px solid var(--color-border, #e0e0e0);
    border-radius: 6px;
    padding: 10px 12px;
    margin-bottom: 8px;
    background: var(--color-bg-panel, #fff);
    transition: border-color 0.2s;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.dokumen-item:hover { border-color: var(--color-accent, #e07b39); }

.dokumen-info {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    flex: 1;
}

.dokumen-nama {
    font-size: 13px;
    font-weight: 500;
    color: var(--color-text-primary, #2c3e50);
    margin-bottom: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dokumen-meta {
    font-size: 11px;
    color: var(--color-text-secondary, #77767b);
    margin-bottom: 0;
    white-space: nowrap;
    flex-shrink: 0;
}

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

.btn-buka-dokumen {
    font-size: 11px;
    padding: 4px 10px;
    border-radius: 4px;
    border: 1px solid var(--color-accent, #e07b39);
    background: transparent;
    color: var(--color-accent, #e07b39);
    cursor: pointer;
    transition: all 0.2s;
}
.btn-buka-dokumen:hover {
    background: var(--color-accent, #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: var(--color-text-secondary, #77767b);
    text-align: center;
    padding: 16px 0;
    font-style: italic;
}

/* ── DARK MODE OVERRIDE ── */
[data-theme="dark"] .module-nav {
  background: var(--color-bg-panel);
  border-bottom-color: var(--ui-border);
}

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

/* ── RESPONSIVE TAB ── */
@media (max-width: 1024px) {
  .module-nav {
    margin: 0 calc(-1 * var(--spacing-lg, 20px));
    padding: 0 8px;
  }
  .module-tab {
    padding: 8px 6px;
    font-size: 10px;
  }
}

@media (max-width: 768px) {
  .module-tab {
    padding: 6px 4px;
    font-size: 9px;
  }
}

/* ═══════════════════════════════════════════
   SESI 3 — UI/UX POLISH
   Banner panduan + visual improvements
═══════════════════════════════════════════ */

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

.step-guide-final {
  background: linear-gradient(
    135deg,
    color-mix(in srgb, var(--color-btn-success) 8%, transparent) 0%,
    color-mix(in srgb, var(--color-btn-success) 4%, transparent) 100%
  );
  border-color: color-mix(in srgb, var(--color-btn-success) 20%, transparent);
  border-left-color: var(--color-btn-success);
}

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

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

.step-guide-text strong {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--accent);
  line-height: 1.3;
}

.step-guide-final .step-guide-text strong {
  color: var(--color-btn-success);
}

.step-guide-text span {
  font-size: 0.8rem;
  color: var(--ink-light);
  line-height: 1.5;
}

[data-theme="dark"] .step-guide-banner {
  background: linear-gradient(
    135deg,
    rgba(224,123,57,0.12) 0%,
    rgba(224,123,57,0.05) 100%
  );
  border-color: rgba(224,123,57,0.25);
}

[data-theme="dark"] .step-guide-final {
  background: linear-gradient(
    135deg,
    rgba(46,125,50,0.15) 0%,
    rgba(46,125,50,0.06) 100%
  );
}

/* ── EMPTY STATE PREVIEW ── */
.preview-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  min-height: 400px;
  gap: 16px;
  color: var(--ink-faint);
  text-align: center;
  padding: 40px;
}

.preview-empty-icon {
  font-size: 64px;
  opacity: 0.4;
}

.preview-empty-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--ink-light);
}

.preview-empty-desc {
  font-size: 0.85rem;
  line-height: 1.6;
  max-width: 280px;
  color: var(--ink-faint);
}

.preview-empty-steps {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
  text-align: left;
  width: 100%;
  max-width: 300px;
  max-height: 300px;
  overflow-y: auto;
  padding-right: 8px;
}

.preview-empty-step {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.8rem;
  color: var(--ink-light);
  background: var(--paper-warm);
  padding: 8px 12px;
  border-radius: 6px;
  border: 1px solid var(--rule);
}

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

/* Empty State Responsive - Tablet (≤768px) */
@media (max-width: 768px) {
  .preview-empty-state {
    min-height: 350px;
    padding: 30px 20px;
    gap: 14px;
  }

  .preview-empty-icon {
    font-size: 56px;
  }

  .preview-empty-title {
    font-size: 1rem;
  }

  .preview-empty-desc {
    font-size: 0.8rem;
    max-width: 260px;
  }

  .preview-empty-steps {
    max-height: 250px;
    max-width: 280px;
  }

  .preview-empty-step {
    font-size: 0.75rem;
    padding: 7px 10px;
    gap: 8px;
  }

  .preview-empty-step-num {
    width: 20px;
    height: 20px;
    font-size: 10px;
  }
}

/* Empty State Responsive - Mobile (≤480px) */
@media (max-width: 480px) {
  .preview-empty-state {
    min-height: 300px;
    padding: 24px 16px;
    gap: 12px;
  }

  .preview-empty-icon {
    font-size: 48px;
  }

  .preview-empty-title {
    font-size: 0.95rem;
  }

  .preview-empty-desc {
    font-size: 0.75rem;
    line-height: 1.5;
    max-width: 240px;
  }

  .preview-empty-steps {
    max-height: 200px;
    max-width: 260px;
    gap: 6px;
  }

  .preview-empty-step {
    font-size: 0.7rem;
    padding: 6px 8px;
    gap: 6px;
  }

  .preview-empty-step-num {
    width: 18px;
    height: 18px;
    font-size: 9px;
  }
}

/* Empty State Responsive - Mobile Kecil (≤375px) */
@media (max-width: 375px) {
  .preview-empty-state {
    min-height: 250px;
    padding: 20px 12px;
    gap: 10px;
  }

  .preview-empty-icon {
    font-size: 40px;
  }

  .preview-empty-title {
    font-size: 0.9rem;
  }

  .preview-empty-desc {
    font-size: 0.7rem;
    max-width: 220px;
  }

  .preview-empty-steps {
    max-height: 180px;
    max-width: 240px;
    gap: 5px;
  }

  .preview-empty-step {
    font-size: 0.65rem;
    padding: 5px 7px;
    gap: 5px;
  }

  .preview-empty-step-num {
    width: 16px;
    height: 16px;
    font-size: 8px;
  }
}

/* ── SECTION GENERATE LABEL ── */
.section-title-generate {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── RESPONSIVE BANNER ── */
@media (max-width: 768px) {
  .step-guide-banner {
    padding: 12px;
    gap: 10px;
  }
  .step-guide-icon {
    font-size: 20px;
  }
  .step-guide-text strong {
    font-size: 0.82rem;
  }
  .step-guide-text span {
    font-size: 0.75rem;
  }
}

/* ── 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;
}
