/* ===== CSS VARIABLES ===== */
:root {
  --ink         : #1a1a1a;
  --ink-light   : #4a4a4a;
  --ink-faint   : #8a8a8a;
  --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: 8px;
    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);
    min-height: var(--header-height);
    overflow: hidden;
}

/* ===== HEADER LEFT WRAPPER ===== */
.header-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

/* Mobile Extended: 480px - 767px - reduce padding */
@media (min-width: 480px) and (max-width: 767px) {
    .app-header {
        padding: 0 16px;
        gap: 10px;
    }
}

.app-title {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: inherit;
    flex-shrink: 1;
    min-width: 0;
    overflow: hidden;
}

.app-title-text {
    display: flex;
    flex-direction: column;
    gap: 2px;
    line-height: 1;
}

.app-name {
    font-family: var(--ui-font);
    font-size: 1.4rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: #ffffff;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.app-subtitle {
    font-family: var(--ui-font);
    font-size: 0.7rem;
    font-weight: 500;
    color: rgba(255,255,255,0.7);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin: 0;
}

/* Mobile Extended: 480px - 767px - reduce title font size */
@media (min-width: 480px) and (max-width: 767px) {
    .app-name {
        font-size: 1.1rem;
    }
    
    .app-subtitle {
        font-size: 0.6rem;
    }
}

.header-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-left: auto;
    flex-wrap: nowrap;
    flex-shrink: 1;
    min-width: 0;
}

.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;
    margin-right: auto;
    transition: background 0.2s ease;
    line-height: 1;
    flex-shrink: 0;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

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

/* Header buttons - override width */
.header-actions .btn {
    width: auto;
    min-width: 44px;
    padding: 8px 12px;
    flex-shrink: 0;
}

/* Mobile Extended: 480px - 767px */
@media (min-width: 480px) and (max-width: 767px) {
    .header-actions .btn {
        padding: 7px 10px;
        font-size: 0.7rem;
    }
}

.btn-print {
    background: var(--color-btn-success);
    color: var(--color-btn-success-txt);
    border: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    text-align: center;
}

.btn-print:hover {
    background: var(--color-btn-success-hv);
    box-shadow: 0 4px 20px rgba(46,123,196,0.6);
    transform: translateY(-2px);
}

.btn-dashboard {
    background: var(--color-accent);
    color: var(--color-accent-txt);
    border: none;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-normal);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    white-space: nowrap;
}

.btn-dashboard:hover {
    background: var(--color-accent-hv);
    box-shadow: 0 4px 16px rgba(0,0,0,0.3);
    transform: translateY(-1px);
}

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

.btn-muat-elemen {
    background: var(--color-accent);
    color: var(--color-accent-txt);
    border: none;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    text-align: center;
}

.btn-muat-elemen:hover {
    background: var(--color-accent-hv);
    box-shadow: 0 4px 16px rgba(0,0,0,0.3);
    transform: translateY(-1px);
}

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

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

/* Tablet breakpoint: 768px - 1024px */
@media (max-width: 1024px) and (min-width: 768px) {
    .app-body {
        grid-template-columns: 50% 50%;
    }
}

/* Mobile: < 768px - single column, scroll */
@media (max-width: 767px) {
    .app-body {
        grid-template-columns: 1fr;
        grid-template-rows: auto 1fr;
        height: auto;
        min-height: calc(100vh - var(--header-height));
        overflow: visible;
    }
}

/* ===== PANEL KIRI ===== */
.panel-left {
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--rule-dark);
    background: var(--ui-bg);
    overflow-y: auto;
    min-height: 0;
    height: 100%;
    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: hidden;
    min-height: 0;
    height: 100%;
}

/* Mobile: < 768px - add overflow-y for preview */
@media (max-width: 767px) {
    .panel-right {
        overflow-y: auto;
        height: auto;
        min-height: 50vh;
    }
    
    .panel-left {
        height: auto;
        min-height: 0;
        overflow-y: visible;
        border-right: none;
        border-bottom: 1px solid var(--rule-dark);
    }
}

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

/* Mobile: < 420px - reduce font size */
@media (max-width: 419px) {
    .panel-label {
        font-size: 0.6rem;
        padding: 10px 12px;
        letter-spacing: 0.08em;
    }
}

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

.form-container {
    padding: 12px 14px;
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: visible;
}

/* ===== FORM SECTIONS ===== */
.form-section {
    margin-bottom: 8px;
    padding: 0;
    background: var(--paper-warm);
    border-radius: var(--radius-md, 8px);
    border: 1px solid var(--ui-border);
    overflow: hidden;
    box-shadow: 0 1px 3px color-mix(in srgb, black 6%, transparent);
    flex-shrink: 0;
}

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

.form-section > .section-header {
    background: var(--paper-warm);
    padding: 8px 12px;
    border-bottom: 1px solid var(--ui-border);
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: background 0.15s ease;
}

.form-section > .section-header:hover { background: color-mix(in srgb, black 3%, transparent); }

.form-section > .section-body {
    padding: 8px 12px;
}

/* Form Section Group (collapsible card) */
.form-section-group {
    margin-bottom: 8px;
    border: 1px solid var(--ui-border);
    border-radius: var(--radius-md, 8px);
    overflow: hidden;
    background: var(--paper-warm);
    box-shadow: 0 1px 3px color-mix(in srgb, black 6%, transparent);
    flex-shrink: 0;
}

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

.form-section-group .section-header {
    background: var(--paper-warm);
    padding: 8px 12px;
    border-bottom: 1px solid var(--ui-border);
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: background 0.15s ease;
}

.form-section-group .section-header:hover { background: color-mix(in srgb, black 3%, transparent); }

.form-section-group .section-title {
    font-size: var(--font-size-sm, 13px);
    font-weight: 600;
    color: var(--ink);
    margin: 0;
    text-transform: none;
    letter-spacing: normal;
}

.form-section-group .section-body {
    padding: 8px 12px;
}

.toggle-icon {
    font-size: 14px;
    color: var(--ink-faint);
    transition: transform 0.2s ease;
}

.form-section h3.section-title {
    font-size: var(--font-size-sm, 13px);
    font-weight: 600;
    color: var(--ink);
    margin: 0;
    text-transform: none;
    letter-spacing: normal;
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-section h3.section-title::before {
    display: none;
}

/* Section toggle icon rotation */
.section-toggle {
    font-size: 12px;
    color: var(--ink-faint);
    transition: transform 0.2s ease;
}


/* ===== SECTION BODY (COLLAPSIBLE CONTENT) ===== */
.section-body {
    overflow: visible;
    transition: opacity 0.2s ease, max-height 0.3s ease;
    opacity: 1;
}


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


/* ===== FORM GROUPS ===== */
.form-group {
    margin-bottom: 10px;
}

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

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

/* ===== INPUT STYLES ===== */
input[type="text"],
input[type="number"],
input[type="date"],
select,
textarea {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--ui-border);
    border-radius: var(--radius-sm, 4px);
    font-family: var(--ui-font);
    font-size: var(--font-size-sm, 13px);
    color: var(--ink);
    background: var(--color-bg-panel);
    transition: border-color 0.15s ease;
    outline: none;
}

input[type="text"]:focus,
input[type="number"]:focus,
input[type="date"]:focus,
select:focus,
textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 20%, transparent);
}

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

/* Mobile: < 480px - reduce placeholder font size */
@media (max-width: 479px) {
    input[type="text"]::placeholder,
    input[type="number"]::placeholder,
    textarea::placeholder {
        font-size: 0.75rem;
    }
}

select { cursor: pointer; }

textarea {
    resize: vertical;
    min-height: 120px;
    line-height: 1.5;
}

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

/* Mobile: < 576px - single column */
@media (max-width: 575px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

/* Mobile Extended: 576px - 767px - single column */
@media (min-width: 576px) and (max-width: 767px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

/* ===== MUAT ELEMEN CP CONTROLS ===== */
.muat-elemen-group label {
    font-size: 0.8rem;
}

.muat-elemen-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.muat-elemen-controls select {
    flex: 1;
    height: 40px;
}

.muat-elemen-controls .btn-muat-elemen {
    width: auto;
    min-width: 96px;
    padding: 7px 12px;
    height: 40px;
    font-size: 0.8rem;
}

@media (max-width: 768px) {
    .muat-elemen-controls {
        flex-direction: column;
        align-items: stretch;
    }

    .muat-elemen-controls .btn-muat-elemen {
        width: 100%;
        min-width: 0;
    }
}

/* ===== INPUT DATE STYLING ===== */
input[type="date"] {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--ui-border);
    border-radius: var(--radius-sm);
    font-family: var(--ui-font);
    font-size: 0.85rem;
    color: var(--ink);
    background: var(--color-bg-panel);
    transition: all 0.18s ease;
    outline: none;
}

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

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

select {
    cursor: pointer;
}

textarea {
    resize: vertical;
    min-height: 120px;
    line-height: 1.5;
}

/* ===== INPUT WITH ICON ===== */
.input-with-icon {
    position: relative;
    display: flex;
    align-items: center;
}

.input-with-icon input[type="text"] {
    width: 100%;
    padding-right: 44px;
}

.btn-icon-add {
    position: absolute;
    right: 8px;
    background: none;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--ink-faint);
    flex-shrink: 0;
}

.btn-icon-add:hover {
    background: var(--paper-warm);
    color: var(--accent);
    transform: scale(1.1);
}

.btn-icon-add:active {
    transform: scale(0.95);
}

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

/* ===== INPUT WITH BUTTON (DEPRECATED - kept for compatibility) ===== */
.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: 12px 16px;
    white-space: nowrap;
    font-size: 0.85rem;
    font-weight: 600;
}

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

.btn-generate {
    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(46,123,196,0.4);
    margin-top: 8px;
}

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

/* ── Generate Prompt Status (Tab 2) ── */
.generate-row {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.prompt-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 10px;
    border-radius: 999px;
    border: 1px solid var(--rule);
    background: var(--paper-warm);
    color: var(--ink-faint);
    font-size: 0.78rem;
    line-height: 1;
    min-height: 30px;
    min-width: 160px;
    box-sizing: border-box;
}

.prompt-status:empty {
    display: none;
}

.prompt-status.is-loading {
    background: #fff7ed;
    border-color: #fed7aa;
    color: #9a3412;
}

.prompt-status.is-success {
    background: #ecfdf5;
    border-color: #a7f3d0;
    color: #065f46;
}

.prompt-status.is-error {
    background: #fef2f2;
    border-color: #fecaca;
    color: #991b1b;
}

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

.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;
    align-items: flex-start;
    gap: 8px;
    color: var(--ink);
    font-family: var(--ui-font);
    font-size: 0.8rem;
    text-align: justify;
    margin-bottom: 5px;
}

.elemen-nomor {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
    background: var(--accent);
    color: #ffffff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: 700;
    font-family: var(--ui-font);
    margin-top: 1px;
}
.elemen-text {
    flex: 1;
    line-height: 1.6;
    padding: 0 4px;
}
.elemen-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.elemen-desc {
    font-size: 0.75rem;
    color: var(--color-text-secondary, #77767b);
    line-height: 1.4;
}
.btn-hapus {
    flex-shrink: 0;
    background: none;
    border: 1px solid var(--color-btn-danger);
    color: var(--color-btn-danger);
    border-radius: var(--radius-sm);
    padding: 3px 10px;
    font-size: 0.75rem;
    font-family: var(--ui-font);
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    margin-top: 1px;
}
.btn-hapus:hover {
    background: var(--color-btn-danger);
    color: #ffffff;
}

/* ── Jumlah TP per Elemen ── */
.tp-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid var(--rule);
    font-family: var(--ui-font);
    font-size: 0.85rem;
}
.tp-row:last-of-type {
    border-bottom: none;
}
.tp-label {
    flex: 1;
    color: var(--ink);
    font-family: var(--ui-font);
    font-size: 0.85rem;
    line-height: 1.4;
}
.tp-input-group {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}
.tp-input-group input {
    width: 60px;
    text-align: center;
    padding: 6px 8px;
    font-family: var(--ui-font);
    font-size: 0.85rem;
    border: 1px solid var(--ui-border);
    border-radius: var(--radius-sm);
    background: var(--color-bg-panel);
    color: var(--ink);
}
.tp-satuan {
    font-family: var(--ui-font);
    font-size: 0.85rem;
    color: var(--ink-light);
    font-weight: 500;
}
.tp-total {
    text-align: center;
    margin-top: 12px;
    padding: 8px;
    font-family: var(--ui-font);
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--accent);
    background: var(--paper-warm);
    border-radius: var(--radius-sm);
    border: 1px solid var(--rule);
}
.tp-empty-msg {
    text-align: center;
    color: var(--ink-faint);
    font-style: italic;
    font-family: var(--ui-font);
    font-size: 0.85rem;
    margin: 20px 0;
    line-height: 1.6;
}

/* Elemen UI yang tidak perlu justify */
.app-header,
.app-name,
.app-subtitle,
.section-title,
.btn,
input,
select,
textarea,
.tp-input-group,
.tp-satuan,
.tp-total,
label {
    text-align: left;
}

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

/* ===== INSTRUCTION TEXT ===== */
.instruction-text {
    font-size: 0.8rem;
    color: var(--ink-faint);
    font-style: italic;
    margin-bottom: 12px;
    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);
}

/* ── DUAL PROMPT MODE (Polish UI) ── */
.prompt-mode-wrapper {
    display: flex;
    flex-direction: column;
    gap: 12px;
    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; /* override margin-top global .btn-copy */
    font-size: 0.8rem;
    padding: 10px 12px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-weight: 600;
    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: #ffffff;
}

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

.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: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

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

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

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

.prompt-card-desc {
    font-size: 0.82rem;
    color: #475569;
    margin: 0;
    line-height: 1.45;
}

.btn-render {
    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: 10px 12px;
    }
    
    .form-section {
        margin-bottom: 8px;
    }
    
    .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;
    }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .app-header {
        padding: 0 12px;
    }
    
    .app-name {
        font-size: 1.1rem;
    }
    
    .app-subtitle {
        font-size: 0.6rem;
    }
}

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


/* ===== THEME SELECTOR STYLING ===== */
.theme-selector-wrapper {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    background: rgba(255,255,255,0.1);
    border-radius: 6px;
    border: 1px solid rgba(255,255,255,0.15);
    margin-right: 12px;
    flex-shrink: 0;
}

.theme-label {
    font-size: 0.9rem;
    color: var(--color-text-app-header);
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.theme-label:hover {
    opacity: 0.7;
}

.theme-select {
    background: rgba(255,255,255,0.15);
    color: var(--color-text-app-header);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    outline: none;
    transition: all 0.2s ease;
    width: auto;
}

.theme-select:hover {
    background: rgba(255,255,255,0.2) !important;
    border-color: rgba(255,255,255,0.3) !important;
}

.theme-select:focus {
    border-color: rgba(255,255,255,0.5) !important;
    box-shadow: 0 0 0 2px rgba(255,255,255,0.1) !important;
}

.theme-select option {
    background: var(--color-bg-app-header) !important;
    color: var(--color-text-app-header) !important;
}

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

/* Simpan cloud button - auto width in header */
.header-actions .btn-simpan-cloud {
    width: auto;
    white-space: nowrap;
}

/* Mobile: < 480px - hide theme selector, stack buttons */
@media (max-width: 479px) {
    .theme-selector-wrapper {
        display: flex;
    }

    .selector-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 4px;
        width: 100%;
    }
    
    .action-buttons {
        gap: 4px;
    }
    
    .btn-dashboard {
        display: none;
    }
}

/* Mobile Extended: 480px - 767px - reduce theme selector */
@media (min-width: 480px) and (max-width: 767px) {
    .theme-selector-wrapper {
        padding: 4px 8px;
        gap: 4px;
        margin-right: 4px;
    }
    
    .theme-label {
        font-size: 0.8rem;
    }
    
    .theme-select {
        font-size: 0.65rem !important;
        padding: 3px 6px !important;
    }
}

.btn-dashboard {
    background: rgba(255,255,255,0.15);
    color: var(--color-text-app-header);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 6px;
    padding: 8px 12px;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-dashboard:hover {
    background: rgba(255,255,255,0.25);
    border-color: rgba(255,255,255,0.3);
}

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

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

/* ═══════════════════════════════════════════
   HEADER RESPONSIVE - COMPREHENSIVE
   ═══════════════════════════════════════════ */

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

    .btn-dashboard {
        padding: 6px 12px;
        font-size: 11px;
    }

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

    .header-actions {
        gap: 8px;
    }

    .action-buttons {
        gap: 6px;
    }

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

    .btn-dashboard,
    .btn-print,
    .btn-simpan-cloud {
        white-space: nowrap;
        min-width: 34px;
        padding: 6px 8px;
        justify-content: center;
        display: inline-flex;
        align-items: center;
    }
}

/* Mobile besar (≤480px) */
@media (max-width: 480px) {
    .app-header {
        padding: 0 12px;
        height: auto;
        min-height: 52px;
        flex-wrap: wrap;
        gap: 8px;
    }

    .header-left {
        gap: 6px;
        width: 100%;
    }

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

    .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;
        order: -1;
    }

    /* 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 - icon only */
    .btn-dashboard {
        padding: 6px 8px;
        min-width: 34px;
        min-height: 34px;
        justify-content: center;
        display: inline-flex;
        align-items: center;
    }

    .btn-dashboard span {
        display: none;
    }

    /* Action buttons - full width row */
    .action-buttons {
        order: 3;
        width: 100%;
        gap: 4px;
    }

    .header-actions .btn-simpan-cloud {
        flex: 1;
        width: 100%;
        white-space: normal;
        min-width: 0;
    }

    .btn-print,
    .btn-simpan-cloud {
        flex: 1;
        padding: 6px 4px;
        font-size: 1rem;
        min-width: 0;
        max-width: none;
        width: 100%;
        white-space: normal;
        justify-content: center;
        display: inline-flex;
        align-items: center;
        box-sizing: border-box;
    }

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

/* 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: 5px;
        min-width: 32px;
    }

    .btn-print,
    .btn-simpan-cloud {
        padding: 5px 3px;
    }
}

/* ── Fitur Simpan ke Cloud ── */
.btn-simpan-cloud {
    background: var(--color-accent, #e07b39);
    color: #fff;
    border: 1px solid #d46b30;
    border-radius: 6px;
    padding: 8px 12px;
    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 {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border: 1px solid var(--ui-border);
    border-radius: var(--radius-sm, 4px);
    padding: 10px 12px;
    margin-bottom: 8px;
    background: var(--color-bg-panel);
    transition: border-color 0.2s;
}

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

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

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

.dokumen-meta {
    font-size: 11px;
    color: var(--ink-faint);
    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; }


/* ── NAVIGASI TAB MODUL ── */
.module-nav {
  display: flex;
  gap: 0;
  background: var(--color-bg-panel);
  border-bottom: 2px solid var(--ui-border);
  margin: 0 calc(-1 * 20px);
  padding: 0 20px;
  flex-shrink: 0;
  margin-bottom: 20px;
}

.module-tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  padding: 8px 10px;
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-faint);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  flex: 1;
  text-align: center;
  font-family: var(--ui-font);
  letter-spacing: 0.02em;
}

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

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

.module-panel {
  display: none;
}

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

/* ── PANEL INPUT FLEX LAYOUT ── */
.panel-content .module-panel {
  flex: 1;
  display: none;
  flex-direction: column;
  overflow: hidden;
}

.panel-content .module-panel.active {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: visible;
}

/* Scrollbar untuk panel input */
.panel-content .module-panel.active {
  scrollbar-width: thin;
  scrollbar-color: var(--ui-border) var(--paper-warm);
}

.panel-content .module-panel.active::-webkit-scrollbar {
  width: 8px;
}

.panel-content .module-panel.active::-webkit-scrollbar-track {
  background: var(--paper-warm);
  border-radius: 4px;
}

.panel-content .module-panel.active::-webkit-scrollbar-thumb {
  background: var(--ui-border);
  border-radius: 4px;
}

.panel-content .module-panel.active::-webkit-scrollbar-thumb:hover {
  background: var(--ink-faint);
}

/* ── 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(--paper-warm);
}

/* ── RESPONSIVE UNTUK MOBILE ── */
@media (max-width: 1024px) {
  .module-nav {
    margin: 0 calc(-1 * 16px);
    padding: 0 8px;
  }
  .module-tab {
    padding: 8px 6px;
    font-size: 10px;
  }
}

@media (max-width: 768px) {
  .module-nav {
    margin: 0 calc(-1 * 16px);
    padding: 0 8px;
  }
  .module-tab {
    padding: 6px 4px;
    font-size: 9px;
  }
}

/* ══════════════════════════════════════════
   STEPPER NAVIGATOR — TAB REDESIGN UI/UX
   ══════════════════════════════════════════ */

.stepper-nav {
  display: flex;
  align-items: center;
  gap: 0;
  background: var(--color-bg-panel);
  border-bottom: 2px solid var(--ui-border);
  padding: 6px 10px;
  flex-shrink: 0;
  overflow-x: auto;
  flex-wrap: nowrap;
  justify-content: flex-start;
  margin-bottom: 10px;
  -webkit-overflow-scrolling: touch;
}

.step-item {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 5px;
  background: transparent;
  border: none;
  cursor: pointer;
  border-radius: 5px;
  transition: all 0.2s ease;
  user-select: none;
  flex-shrink: 0;
  min-height: 44px;
  min-width: 44px;
}

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

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

.step-item.active .step-circle {
  background: var(--color-accent);
  color: white;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--color-accent) 15%, transparent);
}

.step-item.done .step-circle {
  background: var(--color-btn-success);
  color: white;
  border-color: var(--color-btn-success);
}

.step-info {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-width: 0;
  line-height: 1.15;
}

.step-label {
  display: none;
}

.step-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-faint);
  font-family: var(--ui-font);
  white-space: nowrap;
  line-height: 1.2;
}

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

.step-item.done .step-title {
  color: var(--color-btn-success);
}

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

.step-item.done + .step-connector {
  background: var(--color-btn-success);
}

.step-connector:last-of-type {
  display: none;
}

.step-item:last-of-type + .step-connector {
  display: none;
}

/* Mobile: < 480px - hide labels, smaller circles */
@media (max-width: 479px) {
  .step-info {
    display: none;
  }
  
  .step-item {
    padding: 4px 3px;
    min-width: 40px;
    min-height: 40px;
  }
  
  .step-circle {
    width: 20px;
    height: 20px;
    font-size: 10px;
  }
  
  .step-connector {
    width: 8px;
    margin: 0 1px;
  }
}

/* Mobile Extended: 480px - 767px - hide labels */
@media (min-width: 480px) and (max-width: 767px) {
  .step-info {
    display: none;
  }
  
  .step-item {
    padding: 4px 4px;
    min-width: 42px;
    min-height: 42px;
  }
  
  .step-circle {
    width: 22px;
    height: 22px;
    font-size: 10px;
  }
  
  .step-connector {
    width: 10px;
    margin: 0 1px;
  }
}

/* Tablet: 768px - 992px - show abbreviated labels */
@media (min-width: 768px) and (max-width: 992px) {
  .step-info {
    display: flex;
    flex-direction: column;
    gap: 0;
    min-width: 0;
    line-height: 1.15;
  }
  
  .step-label {
    display: none;
  }
  
  .step-title {
    font-size: 9px;
    font-weight: 600;
    color: var(--ink-faint);
    font-family: var(--ui-font);
    white-space: nowrap;
    line-height: 1.2;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  
  .step-item {
    padding: 4px 6px;
    gap: 4px;
    min-width: 50px;
    min-height: 44px;
  }
  
  .step-circle {
    width: 24px;
    height: 24px;
    font-size: 0.7rem;
  }
}

/* ─────────────────────────────────────────
   BANNER PANDUAN KONTEKSTUAL
   ───────────────────────────────────────── */

.step-guide-banner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  background: color-mix(in srgb, var(--color-accent) 8%, transparent);
  border: 1px solid color-mix(in srgb, var(--color-accent) 25%, transparent);
  border-left: 3px solid var(--color-accent);
  border-radius: 6px;
  margin-bottom: 12px;
  flex-shrink: 0;
}

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

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

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

.step-guide-text strong {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--ink);
  font-family: var(--ui-font);
  line-height: 1.3;
}

.step-guide-text span {
  font-size: 0.75rem;
  color: var(--ink-light);
  line-height: 1.3;
  font-family: var(--ui-font);
}

/* ─────────────────────────────────────────
   EMPTY STATE — PREVIEW PANEL
   ───────────────────────────────────────── */

.preview-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 32px 20px;
  text-align: center;
  min-height: 280px;
}

.preview-empty-icon {
  font-size: 3rem;
  opacity: 0.25;
  line-height: 1;
}

.preview-empty-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink);
  font-family: var(--ui-font);
}

.preview-empty-desc {
  font-size: 0.8rem;
  color: var(--ink-light);
  line-height: 1.4;
  font-family: var(--ui-font);
  max-width: 300px;
}

.preview-empty-steps {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-self: stretch;
  margin-top: 6px;
}

.preview-empty-step {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 7px 9px;
  background: var(--paper-warm);
  border: 1px solid var(--ui-border);
  border-radius: 6px;
  text-align: left;
}

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

.preview-empty-step span {
  font-size: 0.77rem;
  color: var(--ink);
  line-height: 1.3;
  font-family: var(--ui-font);
}

/* ─────────────────────────────────────────
   DARK MODE
   ───────────────────────────────────────── */

[data-theme="dark"] .stepper-nav {
  background: var(--color-bg-panel);
  border-bottom-color: var(--ui-border);
}

[data-theme="dark"] .step-circle {
  background: var(--color-bg-panel);
  border-color: var(--ui-border);
  color: var(--ink);
}

[data-theme="dark"] .step-guide-banner {
  background: color-mix(in srgb, var(--color-accent) 8%, transparent);
  border-color: color-mix(in srgb, var(--color-accent) 25%, transparent);
}

[data-theme="dark"] .preview-empty-step {
  background: var(--paper-warm);
  border-color: var(--ui-border);
}

/* ── DROPDOWN STYLING (JP PER MINGGU & TOTAL MINGGU EFEKTIF) ── */
#jp-per-minggu,
#total-minggu-efektif {
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 20px;
  padding-right: 36px;
}

#jp-per-minggu::-ms-expand,
#total-minggu-efektif::-ms-expand {
  display: none;
}

/* ── TOMBOL LANJUT KE TAB BERIKUTNYA ── */
/* Button wrapper — visual separator between form and action buttons */
.btn-wrapper {
    padding-top: 8px;
    margin-top: 8px;
    border-top: 1px dashed var(--ui-border);
}

/* ── ELEMEN INPUT GROUP ── */
.elemen-input-group {
  margin-bottom: 16px;
}

/* ── MUAT ELEMEN GROUP ── */
.muat-elemen-group {
  margin-bottom: 16px;
}


/* ══════════════════════════════════════════
   POLISH UI/UX — TAB NAVIGATION ENHANCEMENTS
   ══════════════════════════════════════════ */

/* ── DIVIDER GRUP ANTAR FASE ── */
.tab-grup-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 16px 0 10px;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-faint);
  flex-shrink: 0;
}

.tab-grup-divider--top {
  margin-top: 0;
}

.tab-grup-divider::before,
.tab-grup-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--ui-border);
}

/* ── FIELD REQUIRED / OPTIONAL BADGE ── */
.field-required {
  color: var(--accent);
  font-weight: 700;
  font-size: 0.85rem;
}

.field-optional {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--ink-faint);
  background: var(--paper-warm);
  border: 1px solid var(--ui-border);
  border-radius: 4px;
  padding: 1px 6px;
  letter-spacing: 0.04em;
  vertical-align: middle;
  margin-left: 4px;
}

/* ── BADGE OPSIONAL DI SECTION TITLE ── */
.badge-opsional {
  display: inline-block;
  font-size: 0.6rem;
  font-weight: 600;
  color: var(--ink-faint);
  background: var(--paper-warm);
  border: 1px dashed var(--ui-border);
  border-radius: 4px;
  padding: 1px 7px;
  letter-spacing: 0.04em;
  vertical-align: middle;
  margin-left: 6px;
  text-transform: lowercase;
}

/* ── SECTION OPSIONAL (border putus-putus) ── */
.form-section-opsional {
  border: 1px dashed var(--ui-border) !important;
  background: transparent !important;
  opacity: 0.85;
  transition: opacity 0.2s ease;
}

.form-section-opsional:hover {
  opacity: 1;
}

/* ── FORM LEGEND ── */
.form-legend {
  font-size: 0.72rem;
  color: var(--ink-faint);
  margin-top: 12px;
  margin-bottom: 0;
  font-style: italic;
}

/* ── TOGGLE SWITCH TTD ── */
.ttd-toggle-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  background: var(--color-bg-panel);
  border: 1px solid var(--ui-border);
  border-radius: 8px;
  margin-bottom: 4px;
}

.ttd-toggle-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ttd-toggle-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink);
}

.ttd-toggle-desc {
  font-size: 0.72rem;
  color: var(--ink-faint);
  line-height: 1.3;
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

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

.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--ui-border);
  border-radius: 24px;
  transition: background 0.2s ease;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  top: 3px;
  background: white;
  border-radius: 50%;
  transition: transform 0.2s ease;
  box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}

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

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

/* ── ACCORDION PANDUAN ── */
.panduan-accordion {
  border: 1px solid var(--ui-border);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 4px;
}

.panduan-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--paper-warm);
  border: none;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink);
  font-family: var(--ui-font);
  text-align: left;
  transition: background 0.15s ease;
  gap: 8px;
}

.panduan-toggle:hover {
  background: var(--color-bg-hover, var(--ui-border));
}

.panduan-chevron {
  font-size: 0.65rem;
  color: var(--ink-faint);
  transition: transform 0.25s ease;
  flex-shrink: 0;
}

.panduan-toggle[aria-expanded="true"] .panduan-chevron {
  transform: rotate(180deg);
}

.panduan-body {
  padding: 12px 14px;
  background: var(--color-bg-panel);
  border-top: 1px solid var(--ui-border);
  animation: slideDown 0.2s ease;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.panduan-list {
  margin: 0;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.panduan-list li {
  font-size: 0.8rem;
  color: var(--ink-light);
  line-height: 1.5;
}

.panduan-list li strong {
  color: var(--ink);
}

/* ── TEXTAREA RENDER (JSON) ── */
.textarea-render {
  min-height: 200px !important;
  resize: vertical;
  font-family: 'JetBrains Mono', 'Courier New', monospace !important;
  font-size: 0.78rem !important;
  line-height: 1.5;
}

/* ── TOMBOL RENDER FULL-WIDTH ── */
.btn-render-dokumen {
  width: 100%;
  padding: 13px 20px;
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  margin-top: 12px;
}

/* ── EMPTY STATE DOKUMEN TERSIMPAN ── */
.dokumen-kosong {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 28px 16px;
  text-align: center;
}

.dokumen-kosong-icon {
  font-size: 2rem;
  opacity: 0.4;
  margin-bottom: 4px;
}

.dokumen-kosong-hint {
  font-size: 0.72rem;
  color: var(--ink-faint);
  font-style: italic;
  line-height: 1.4;
  max-width: 220px;
}

/* ── DARK MODE OVERRIDES ── */
[data-theme="dark"] .tab-grup-divider {
  color: var(--ink-faint);
}

[data-theme="dark"] .tab-grup-divider::before,
[data-theme="dark"] .tab-grup-divider::after {
  background: var(--ui-border);
}

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

[data-theme="dark"] .panduan-toggle:hover {
  background: var(--paper-warm);
}

[data-theme="dark"] .ttd-toggle-card {
  background: var(--paper-warm);
}

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  .tab-grup-divider {
    font-size: 0.65rem;
    margin: 16px 0 10px;
  }

  .ttd-toggle-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .toggle-switch {
    align-self: flex-end;
  }

  .textarea-render {
    min-height: 160px !important;
  }
}

/* Help-text styling */
.help-text {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  color: #6b7280;
  font-style: italic;
}

/* Readonly fields styling */
select[readonly], input[readonly] {
  background-color: #f9fafb;
  cursor: not-allowed;
}

select[readonly]:hover, input[readonly]:hover {
  background-color: #f9fafb;
}
