:root {
    --bg: #0d0f13;
    --panel: #11141a;
    --panel-2: #0b0d11;
    --line: #232833;
    --line-soft: #1b2029;
    --txt: #f3f4f6;
    --muted: #9aa4b2;
    --input-bg: #0f1319;
    --chip: #171b23;
    --accent: #ffffff;
    --accent-dark: #111111;
    --primary: #1f6feb;
    --shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
    --cost-table-header-bg: #13161c;

    --fs-ui-2xs: 0.72rem;
    --fs-ui-xs: 0.76rem;
    --fs-ui-sm: 0.8rem;
    --fs-ui-md: 0.84rem;
    --fs-ui-base: 0.88rem;
    --fs-ui-title-sm: 0.92rem;
    --fs-ui-lg: 0.94rem;
    --fs-ui-xl: 0.98rem;
    --fs-ui-2xl: 1.06rem;

    --doc-bg: #fff;
    --doc-txt: #111;
    --doc-line: #1c1c1c;
    --doc-soft: #666;
    --scrollbar-track: #0b0d11;
    --scrollbar-thumb: #313948;
    --scrollbar-thumb-hover: #465166;
}

html[data-theme="light"] {
    --bg: #f3f5f8;
    --panel: #ffffff;
    --panel-2: #f8fafc;
    --line: #d8dee7;
    --line-soft: #e7ebf2;
    --txt: #111827;
    --muted: #5f6b7a;
    --input-bg: #ffffff;
    --chip: #eff3f8;
    --accent: #111111;
    --accent-dark: #ffffff;
    --primary: #1f6feb;
    --shadow: 0 18px 40px rgba(15, 23, 42, 0.09);
    --cost-table-header-bg: #ffffff;
    --scrollbar-track: #edf2f7;
    --scrollbar-thumb: #c0c9d6;
    --scrollbar-thumb-hover: #a7b4c4;
}

html {
    color-scheme: dark;
}

html[data-theme="light"] {
    color-scheme: light;
}

html,
body {
    background: var(--bg);
    color: var(--txt);
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    min-height: 100%;
    height: 100%;
}

* {
    scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}

*::-webkit-scrollbar {
    width: 12px;
    height: 12px;
}

*::-webkit-scrollbar-track {
    background: var(--scrollbar-track);
}

*::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border: 3px solid var(--scrollbar-track);
    border-radius: 999px;
}

*::-webkit-scrollbar-thumb:hover {
    background: var(--scrollbar-thumb-hover);
}

*::-webkit-scrollbar-corner {
    background: var(--scrollbar-track);
}

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

body {
    margin: 0;
    overflow: hidden;
}

body.app-loading .app-shell {
    opacity: 0;
    pointer-events: none;
}

.app-loader {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: var(--bg);
    color: var(--txt);
    transition: opacity .24s ease, visibility .24s ease;
}

.app-loader.is-hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.app-loader-panel {
    width: min(360px, 100%);
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    box-shadow: var(--shadow);
    padding: 16px;
}

.app-loader-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    margin-bottom: 14px;
}

.app-loader-logo {
    width: 44px;
    height: 44px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--chip);
    color: var(--txt);
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
}

.app-loader-logo i {
    display: block;
    font-size: 1.2rem;
    line-height: 1;
    transform: rotate(45deg);
    transform-origin: center;
}

.app-loader-copy {
    min-width: 0;
}

.app-loader-title {
    font-size: var(--fs-ui-lg);
    font-weight: 800;
    line-height: 1.2;
}

.app-loader-subtitle {
    color: var(--muted);
    font-size: var(--fs-ui-xs);
    font-weight: 700;
    line-height: 1.3;
    margin-top: 2px;
}

.app-loader-progress {
    position: relative;
    height: 8px;
    overflow: hidden;
    border-radius: 999px;
    background: var(--panel-2);
    border: 1px solid var(--line-soft);
}

.app-loader-progress span {
    display: block;
    width: 0%;
    height: 100%;
    border-radius: inherit;
    background: var(--accent);
    transition: width .12s linear;
}

html[data-theme="light"] .app-loader-progress span {
    background: var(--accent);
}

.app-loader-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    color: var(--muted);
    font-size: var(--fs-ui-xs);
    font-weight: 800;
    line-height: 1.2;
    margin-top: 8px;
}

.app-shell {
    max-width: 1700px;
    height: calc(100vh - 28px);
    margin: 14px auto;
    padding: 0 10px;
}

.workspace {
    background: var(--panel);
    border: 1px solid var(--line-soft);
    border-radius: 18px;
    overflow: hidden;
    box-shadow: var(--shadow);
    min-width: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--line);
    background: #06070a;
}

html[data-theme="light"] .topbar {
    background: #ffffff;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 9px;
    min-width: 0;
}

.topbar-right {
    min-width: 0;
}

.topbar-logo {
    width: 44px;
    height: 44px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--chip);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--txt);
    flex: 0 0 auto;
}

.topbar-logo-icon {
    display: block;
    font-size: 1.2rem;
    line-height: 1;
    transform: rotate(45deg);
    transform-origin: center;
}

.topbar-copy {
    min-width: 0;
}

.topbar-title {
    font-size: var(--fs-ui-lg);
    font-weight: 700;
    margin: 0;
    line-height: 1.2;
}

.topbar-sub {
    font-size: var(--fs-ui-xs);
    color: var(--muted);
    margin: 0;
    line-height: 1.2;
}

.icon-btn,
.ghost-btn,
.primary-btn {
    border-radius: 8px;
    min-height: 36px;
    font-weight: 600;
    font-size: var(--fs-ui-base);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: background-color .18s ease, border-color .18s ease, color .18s ease, transform .18s ease, box-shadow .18s ease;
    line-height: 1.2;
    touch-action: manipulation;
}

.icon-btn {
    width: 36px;
    border: 1px solid var(--line);
    background: transparent;
    color: var(--txt);
}

.mobile-menu-btn {
    display: none;
}

.mobile-menu-only {
    display: none;
}

.ghost-btn {
    border: 1px solid var(--line);
    background: transparent;
    color: var(--txt);
    padding: 0 12px;
}

.ghost-btn:hover,
.icon-btn:hover {
    background: var(--chip);
}

.primary-btn {
    border: 0;
    background: #fff;
    color: #111;
    padding: 0 14px;
}

html[data-theme="light"] .primary-btn {
    background: #111;
    color: #fff;
}

@media (min-width: 1024px) {
    .topbar-right {
        display: flex;
        align-items: center;
        justify-content: flex-end;
        gap: 8px;
        flex-wrap: wrap;
    }

    .topbar-action-group {
        display: contents;
    }

    .topbar-action-group + .topbar-action-group {
        border-left: 0;
        padding-left: 0;
    }
}

.main-grid {
    display: grid;
    grid-template-columns: 18rem minmax(0, 1fr) minmax(0, 1fr);
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

body.preview-hidden .main-grid {
    grid-template-columns: 18rem minmax(0, 1fr);
}

.app-footer {
    border-top: 1px solid var(--line);
    background: var(--panel-2);
    color: var(--muted);
    font-size: var(--fs-ui-xs);
    line-height: 1.4;
    text-align: left;
    padding: 10px 16px;
}

.mobile-actionbar {
    display: none;
}

.sidebar {
    background: #07090c;
    border-right: 1px solid var(--line);
    padding: 14px 12px;
    overflow: hidden;
}

html[data-theme="light"] .sidebar {
    background: #fbfcfe;
}

.step-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.step-btn {
    width: 100%;
    min-width: 0;
    padding: 10px 10px;
    border-radius: 8px;
    border: 1px solid var(--line-soft);
    background: transparent;
    color: var(--txt);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    text-align: left;
    font-size: var(--fs-ui-base);
    transition: background-color .18s ease, border-color .18s ease, transform .18s ease, box-shadow .18s ease;
}

.step-btn.active {
    background: var(--chip);
    border-color: var(--line);
}

.step-left {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1 1 auto;
    min-width: 0;
}

.step-no {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 1px solid var(--line);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: var(--fs-ui-2xs);
    flex: 0 0 auto;
}

.step-label {
    white-space: normal;
    overflow: visible;
    text-overflow: clip;
    overflow-wrap: anywhere;
    font-size: var(--fs-ui-md);
    line-height: 1.3;
}

.step-dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: #22c55e;
    opacity: 0;
    flex: 0 0 auto;
    box-shadow: 0 0 0 rgba(34, 197, 94, 0);
    transition: opacity .2s ease, transform .2s ease, box-shadow .25s ease;
}

.step-btn.active .step-dot {
    opacity: 1;
    transform: scale(1);
    box-shadow:
        0 0 0 3px rgba(34, 197, 94, 0.16),
        0 0 10px rgba(34, 197, 94, 0.75),
        0 0 18px rgba(34, 197, 94, 0.35);
}

.step-note {
    color: var(--muted);
    font-size: var(--fs-ui-xs);
    margin-top: 12px;
    line-height: 1.45;
    max-width: 100%;
}

.form-panel,
.preview-panel {
    padding: 16px 16px 18px;
    min-height: 0;
}

.form-panel {
    border-right: 1px solid var(--line);
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
}

.preview-panel {
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
}

body.preview-hidden .preview-panel {
    display: none;
}

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

.form-title {
    font-size: var(--fs-ui-2xl);
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 3px;
}

.form-desc {
    color: var(--muted);
    margin: 0;
    font-size: var(--fs-ui-md);
    line-height: 1.45;
}

.section-card {
    border: 1px solid var(--line-soft);
    background: transparent;
    border-radius: 8px;
    padding: 14px;
    margin-bottom: 14px;
    transition: background-color .18s ease, border-color .18s ease, transform .18s ease, box-shadow .18s ease;
}

.section-card-title {
    font-size: var(--fs-ui-title-sm);
    font-weight: 800;
    margin-bottom: 3px;
    line-height: 1.3;
}

.section-card-desc {
    color: var(--muted);
    font-size: var(--fs-ui-sm);
    line-height: 1.45;
    margin-bottom: 12px;
}

.form-label {
    font-size: var(--fs-ui-sm);
    font-weight: 700;
    margin-bottom: 6px;
}

.form-control,
.form-select,
.form-control:focus,
.form-select:focus,
textarea.form-control {
    background: var(--input-bg);
    color: var(--txt);
    border-color: var(--line);
    border-radius: 8px;
    box-shadow: none;
}

.form-control,
.form-select {
    min-height: 40px;
    font-size: var(--fs-ui-base);
}

input[type="date"].form-control {
    color-scheme: dark;
}

input[type="date"].form-control::-webkit-calendar-picker-indicator {
    cursor: pointer;
    -webkit-filter: brightness(0) invert(1);
    filter: brightness(0) invert(1);
    opacity: 1;
}

html[data-theme="light"] input[type="date"].form-control {
    color-scheme: light;
}

html[data-theme="light"] input[type="date"].form-control::-webkit-calendar-picker-indicator {
    -webkit-filter: none;
    filter: none;
    opacity: .8;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 .2rem rgba(31, 111, 235, .14);
}

.duration-input-group {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    align-items: stretch;
}

.duration-input-group .form-control,
.duration-input-group .form-select {
    margin: 0;
}

.duration-input-group .form-control {
    min-width: 0;
}

.duration-input-group .form-select {
    width: 120px;
    flex: 0 0 120px;
}

.submission-range-group {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    gap: 8px;
    align-items: center;
}

.submission-range-group .form-control {
    min-width: 0;
    font-size: 0.82rem;
}

.submission-range-separator {
    color: var(--muted);
    font-size: var(--fs-ui-xs);
    font-weight: 700;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
}

.editor-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.editor-toolbar-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.cost-total-summary {
    min-width: 0;
    min-height: 34px;
    margin-left: auto;
    border: 1px solid var(--line-soft);
    border-radius: 8px;
    background: var(--panel-2);
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 9px;
}

.cost-total-label {
    color: var(--muted);
    font-size: var(--fs-ui-xs);
    font-weight: 800;
    line-height: 1.15;
    white-space: nowrap;
}

.cost-total-values {
    min-width: 0;
    display: flex;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 4px 8px;
}

.cost-total-amount {
    color: var(--txt);
    font-size: var(--fs-ui-sm);
    font-weight: 800;
    line-height: 1.15;
    overflow-wrap: anywhere;
}

.cost-collapse-btn {
    display: none;
}

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

.summary-stat {
    min-width: 0;
    border: 1px solid var(--line-soft);
    border-radius: 8px;
    background: var(--panel-2);
    padding: 8px 9px;
    transition: background-color .18s ease, border-color .18s ease, transform .18s ease, box-shadow .18s ease;
}

.summary-stat-label {
    display: block;
    color: var(--muted);
    font-size: 0.7rem;
    font-weight: 800;
    line-height: 1.15;
    margin-bottom: 3px;
}

.summary-stat-value {
    display: block;
    color: var(--txt);
    font-size: var(--summary-font-size, 0.82rem);
    font-weight: 800;
    line-height: 1.1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.summary-stat-value.is-negative {
    color: #fca5a5;
}

.summary-stat-value.is-positive {
    color: #86efac;
}

.summary-realisasi-card:not(.has-usd) .summary-receipt-usd,
.summary-realisasi-card:not(.has-usd) .summary-expense-usd,
.summary-realisasi-card:not(.has-usd) .summary-difference-usd {
    display: none;
}

.mini-btn {
    border: 1px solid var(--line);
    background: transparent;
    color: var(--txt);
    border-radius: 8px;
    min-height: 34px;
    padding: 0 10px;
    font-weight: 600;
    font-size: var(--fs-ui-sm);
    transition: background-color .18s ease, border-color .18s ease, color .18s ease, transform .18s ease;
}

.mini-btn:hover {
    background: var(--chip);
}

.danger-btn {
    border-color: rgba(239, 68, 68, .55);
    color: #fca5a5;
}

.danger-btn:hover {
    background: rgba(239, 68, 68, .12);
}

.cost-editor-wrap {
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
}

.cost-editor-table {
    width: 100%;
    min-width: 760px;
    border-collapse: separate;
    border-spacing: 0;
}

.cost-editor-table th,
.cost-editor-table td {
    border-bottom: 1px solid var(--line-soft);
    padding: 8px;
    vertical-align: top;
    background: transparent;
}

.cost-editor-table th {
    font-size: var(--fs-ui-xs);
    font-weight: 800;
    color: var(--muted);
    background: var(--cost-table-header-bg);
}

.cost-type-cell {
    width: 104px;
    min-width: 104px;
}

.cost-description-cell {
    min-width: 280px;
}

.cost-editor-table tr:last-child td {
    border-bottom: 0;
}

.cost-row-actions-cell {
    white-space: nowrap;
}

@media (min-width: 1024px) {
    .cost-editor-table .cost-description-cell {
        position: sticky;
    }

    .cost-editor-table td.cost-description-cell {
        left: 0;
        background: var(--panel);
        background-clip: border-box;
        z-index: 2;
    }

    .cost-editor-table th.cost-description-cell {
        left: 0;
        background: var(--cost-table-header-bg);
        background-clip: border-box;
        z-index: 4;
    }
}

.cost-editor-table tr.cost-row-moved td:not(.mobile-cost-card-cell) {
    animation: cost-row-move-glow .9s ease;
    background-repeat: no-repeat;
}

.cost-row-actions {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.cost-row-action-btn {
    width: 34px;
    min-width: 34px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.cost-row-action-btn i {
    line-height: 1;
}

.cost-row-action-btn .bi-arrow-up-short,
.cost-row-action-btn .bi-arrow-down-short {
    font-size: 1.35rem;
}

.cost-row-action-btn:disabled {
    opacity: .45;
    cursor: not-allowed;
}

.cost-row-action-btn:disabled:hover {
    background: transparent;
}

@keyframes cost-row-move-glow {
    0% {
        background-image: linear-gradient(rgba(31, 111, 235, .2), rgba(31, 111, 235, .2));
    }
    45% {
        background-image: linear-gradient(rgba(31, 111, 235, .12), rgba(31, 111, 235, .12));
    }
    100% {
        background-image: linear-gradient(rgba(31, 111, 235, 0), rgba(31, 111, 235, 0));
    }
}

.mobile-cost-card-cell {
    display: none;
}

.table-scroll {
    overflow-x: auto;
}

.row-type-badge {
    min-width: max-content;
    width: max-content;
    padding-left: 6px;
    padding-right: 22px;
}

.signature-uploader {
    border: 1px dashed var(--line);
    border-radius: 8px;
    padding: 10px;
    background: transparent;
}

.company-logo-input-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 40px;
    align-items: stretch;
    gap: 8px;
}

.company-logo-clear-btn {
    width: 40px;
    min-height: 40px;
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

.signature-preview-mini {
    width: 100%;
    max-width: 160px;
    height: 60px;
    object-fit: contain;
    background: #fff;
    border-radius: 8px;
    border: 1px solid var(--line-soft);
    padding: 5px;
    display: block;
}

.delete-sign-btn {
    width: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
}

.preview-head {
    margin-bottom: 12px;
}

.preview-head > div {
    min-width: 0;
}

.preview-head h4 {
    font-weight: 800;
    margin: 0 0 4px;
    font-size: var(--fs-ui-xl);
    line-height: 1.25;
}

.preview-head p {
    color: var(--muted);
    margin: 0;
    font-size: var(--fs-ui-sm);
    line-height: 1.4;
}

.preview-back-btn {
    display: none;
}

.cost-edit-panel,
.confirm-dialog-panel,
.draft-modal-panel,
.mobile-actionbar,
.topbar-right,
.cost-editor-wrap,
.mobile-cost-edit-btn {
    transition: transform .18s ease, opacity .18s ease, box-shadow .18s ease, border-color .18s ease, background-color .18s ease;
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation: none !important;
        transition-duration: 0s !important;
        scroll-behavior: auto !important;
    }
}

.preview-scroll {
    flex: 1;
    min-height: 0;
    overflow: auto;
    overscroll-behavior: contain;
    border-radius: 8px;
    padding: 4px;
    min-width: 0;
    display: flex;
    align-items: flex-start;
    justify-content: center;
}

.preview-stage {
    position: relative;
    width: 794px;
    height: 1123px;
    min-height: 0;
    margin: 0 auto;
    flex: 0 0 auto;
}

.preview-pages {
    position: absolute;
    top: 0;
    left: 0;
    width: 794px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    transform-origin: top left;
    transform: scale(var(--preview-scale, 1));
}

#previewDocument.preview-source-page {
    display: none;
}

#previewDocument.preview-source-page .doc-footer {
    display: none;
}

.preview-page-clone {
    position: relative;
    height: 1123px;
    min-height: 1123px;
    margin: 0;
    overflow: hidden;
    flex: 0 0 1123px;
}

.preview-page-footer {
    position: absolute;
    left: 34px;
    right: 34px;
    bottom: 28px;
    margin-top: 0;
    padding-top: 0;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: baseline;
    line-height: 1.28;
}

.preview-page-footer .doc-footer-center {
    display: block;
    grid-column: 2;
    text-align: center;
}

.preview-page-footer .doc-footer-page {
    grid-column: 3;
    justify-self: end;
    text-align: right;
    white-space: nowrap;
}

.doc-page {
    width: 794px;
    min-height: 1123px;
    background: var(--doc-bg);
    color: var(--doc-txt);
    margin: 0 auto;
    padding: 26px 34px 28px;
    box-shadow: 0 10px 24px rgba(0, 0, 0, .18);
    font-family: Arial, Helvetica, sans-serif;
    font-size: 14px;
    line-height: 1.28;
    display: flex;
    flex-direction: column;
}

.doc-top {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: start;
    gap: 12px;
    margin-bottom: 38px;
}

.doc-company {
    font-size: 20px;
    font-weight: 700;
    letter-spacing: .2px;
    text-transform: uppercase;
}

.doc-brand {
    min-width: 0;
    min-height: 76px;
}

.doc-brand:not(.has-logo) .doc-company {
    padding-top: 18px;
}

.doc-brand.has-logo .doc-company {
    display: none;
}

.doc-company-logo {
    max-width: 420px;
    max-height: 76px;
    object-fit: contain;
    object-position: left top;
    display: none;
}

.doc-company-logo.has-image {
    display: block;
}

.doc-date {
    font-size: 14px;
    margin-top: 18px;
}

.doc-title {
    text-align: center;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: .3px;
    margin-bottom: 18px;
    text-transform: uppercase;
}

.doc-info {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 10px;
}

.doc-info td {
    padding: 1px 0;
    vertical-align: top;
    font-size: 13px;
}

.doc-info .label {
    width: 195px;
    font-weight: 700;
    text-transform: uppercase;
}

.doc-info .colon {
    width: 16px;
    text-align: center;
    font-weight: 700;
}

.doc-cost {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    margin: 8px 0 14px;
    font-size: 13px;
}

.doc-cost td,
.doc-cost th {
    border: var(--preview-table-border-width, 0.2px) solid var(--doc-line);
    padding: 3px 5px;
    vertical-align: top;
}

.doc-cost thead th {
    background: #204E78;
    color: #fff;
    text-align: center;
    font-weight: 700;
    vertical-align: middle;
}

.doc-cost tfoot td {
    background: #EEEEEE;
    border-top: var(--preview-table-border-width, 0.2px) solid var(--doc-line);
    color: #111;
}

.doc-cost .no-col {
    width: 34px;
    text-align: center;
}

.doc-cost .desc-col {
    width: auto;
}

.doc-cost .rp-col,
.doc-cost .usd-col {
    width: 132px;
    text-align: right;
    white-space: nowrap;
}

.doc-cost .center {
    text-align: center;
}

.doc-cost .total-label {
    font-weight: 700;
    text-align: center;
}

.doc-cost .total-value {
    font-weight: 700;
}

.doc-note-title {
    font-weight: 700;
    margin-bottom: 4px;
    font-size: 13px;
}

.doc-note-lines {
    font-size: 13px;
    line-height: 1.35;
    margin-bottom: 18px;
    white-space: pre-line;
}

.doc-summary {
    display: none;
    grid-template-columns: 1fr 1fr;
    gap: 28px;
    margin: 8px 0 18px;
    font-size: 13px;
}

.doc-summary.active {
    display: grid;
}

.summary-col .summary-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 14px;
    align-items: end;
    margin-bottom: 6px;
}

.summary-col-usd .summary-row > span:first-child {
    padding-left: 28px;
}

.summary-value {
    min-width: 110px;
    border-bottom: 1px solid #111;
    text-align: right;
    font-weight: 700;
    padding-bottom: 2px;
}

.doc-signatures {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 36px;
    margin-top: 34px;
    text-align: center;
}

.doc-sign-role {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    margin-bottom: 24px;
}

.doc-sign-image-wrap {
    height: 62px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    margin-bottom: 8px;
}

.doc-sign-image {
    max-width: 150px;
    max-height: 54px;
    object-fit: contain;
    display: none;
}

.doc-sign-image.has-image {
    display: block;
}

.doc-sign-name {
    display: inline-block;
    min-width: 160px;
    padding-top: 6px;
    border-top: 1px solid #111;
    font-size: 13px;
}

.doc-footer {
    margin-top: auto;
    padding-top: 18px;
    color: #777;
    font-size: 10px;
    text-align: center;
}

.draft-modal[hidden] {
    display: none;
}

.about-modal[hidden] {
    display: none;
}

.whats-new-modal[hidden] {
    display: none;
}

@media (min-width: 1024px) {
    .about-modal {
        display: none !important;
    }
}

.draft-modal {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: grid;
    place-items: center;
    padding: 18px;
}

.about-modal {
    position: fixed;
    inset: 0;
    z-index: 1210;
    display: grid;
    place-items: center;
    padding: 18px;
}

.whats-new-modal {
    position: fixed;
    inset: 0;
    z-index: 1220;
    display: grid;
    place-items: center;
    padding: 22px;
}

.draft-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .62);
}

.about-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .62);
}

.whats-new-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(5, 8, 12, .56);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
}

.draft-modal-panel {
    position: relative;
    width: min(760px, 100%);
    max-height: min(760px, calc(100vh - 36px));
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    color: var(--txt);
    box-shadow: 0 24px 60px rgba(0, 0, 0, .36);
}

.about-modal-panel {
    position: relative;
    width: min(340px, 100%);
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--panel);
    color: var(--txt);
    box-shadow: 0 20px 48px rgba(0, 0, 0, .34);
    overflow: hidden;
}

.whats-new-modal-panel {
    position: relative;
    width: min(512px, 100%);
    border: 1px solid var(--line);
    border-radius: 20px;
    background: var(--panel);
    color: var(--txt);
    box-shadow: 0 28px 80px rgba(0, 0, 0, .42);
    overflow: hidden;
}

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

.draft-modal-title {
    font-size: var(--fs-ui-2xl);
    font-weight: 800;
    line-height: 1.2;
}

.draft-modal-desc {
    color: var(--muted);
    font-size: var(--fs-ui-sm);
    margin-top: 2px;
}

.draft-search {
    position: relative;
    padding: 12px 14px;
    border-bottom: 1px solid var(--line-soft);
    background: var(--panel);
}

.draft-search i {
    position: absolute;
    left: 27px;
    top: 50%;
    color: var(--muted);
    font-size: .9rem;
    transform: translateY(-50%);
    pointer-events: none;
}

.draft-search .form-control {
    height: 38px;
    padding-left: 38px;
    border-color: var(--line-soft);
    background: var(--panel-2);
    color: var(--txt);
    font-size: var(--fs-ui-sm);
}

.draft-search .form-control::placeholder {
    color: var(--muted);
}

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

.about-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.about-brand-mark {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    background: rgba(34, 197, 94, .12);
    color: #22c55e;
    border: 1px solid rgba(34, 197, 94, .18);
    flex: 0 0 auto;
}

.about-brand-mark i {
    font-size: .95rem;
    transform: rotate(45deg);
}

.about-brand-copy {
    min-width: 0;
}

.about-modal-title {
    font-size: var(--fs-ui-lg);
    font-weight: 800;
    line-height: 1.2;
}

.about-modal-desc {
    color: var(--muted);
    font-size: var(--fs-ui-sm);
    margin-top: 2px;
}

.about-modal-body {
    display: grid;
    gap: 6px;
    padding: 12px 14px 14px;
    color: var(--txt);
    font-size: var(--fs-ui-md);
    line-height: 1.55;
}

.whats-new-modal-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    column-gap: 16px;
    row-gap: 12px;
    align-items: start;
    padding: 20px 20px 16px;
    border-bottom: 1px solid var(--line-soft);
    background: var(--panel);
}

.whats-new-modal-copy {
    display: grid;
    gap: 12px;
    min-width: 0;
}

.whats-new-kicker {
    display: inline-flex;
    align-items: center;
    justify-self: start;
    min-height: 22px;
    padding: 0 8px;
    border: 1px solid #315e99;
    border-radius: 999px;
    background: #22467a;
    color: #e8f1ff;
    font-size: .64rem;
    font-weight: 800;
    letter-spacing: .1em;
    text-transform: uppercase;
}

.whats-new-modal-title {
    font-size: 1.2rem;
    font-weight: 800;
    letter-spacing: -.02em;
    line-height: 1.12;
}

.whats-new-modal-desc {
    grid-column: 1 / -1;
    color: var(--muted);
    font-size: .88rem;
    line-height: 1.56;
}

.whats-new-modal-close {
    width: 36px;
    min-height: 36px;
    border-color: var(--line-soft);
    border-radius: 12px;
    color: var(--muted);
}

.whats-new-modal-close i {
    font-size: .92rem;
    line-height: 1;
}

.whats-new-modal-close:hover {
    background: var(--chip);
    color: var(--txt);
}

.whats-new-modal-body {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
    padding: 12px 18px 8px;
}

.whats-new-date-label {
    margin: 2px 2px -2px;
    color: var(--muted);
    font-size: .68rem;
    font-weight: 800;
    letter-spacing: .06em;
    line-height: 1.2;
    text-transform: uppercase;
}

.whats-new-feature {
    position: relative;
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 12px;
    align-items: center;
    padding: 13px 14px;
    border: 1px solid var(--line-soft);
    border-radius: 13px;
    background: var(--panel-2);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .03);
}

.whats-new-feature-platform-badge {
    position: absolute;
    top: -8px;
    right: 0;
    z-index: 1;
    min-height: 16px;
    padding: 0 5px;
    border: 1px solid #22c55e;
    border-radius: 999px;
    background: #14532d;
    color: #dcfce7;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: .5rem;
    font-weight: 900;
    letter-spacing: .03em;
    line-height: 1;
    pointer-events: none;
    white-space: nowrap;
}

.whats-new-feature-no {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    height: 32px;
    padding: 0 7px;
    border-radius: 10px;
    background: #10284b;
    color: #9bc4ff;
    font-size: var(--fs-ui-xs);
    font-weight: 800;
    letter-spacing: .04em;
}

.whats-new-feature-no i {
    font-size: .88rem;
    line-height: 1;
}

.whats-new-feature-copy {
    color: var(--txt);
    font-size: .85rem;
    font-weight: 500;
    letter-spacing: -.01em;
    line-height: 1.38;
}

.whats-new-modal-actions {
    display: flex;
    justify-content: flex-end;
    padding: 4px 20px 20px;
}

html[data-theme="light"] .whats-new-modal-backdrop {
    background: rgba(15, 23, 42, .18);
}

html[data-theme="light"] .whats-new-modal-panel {
    background: var(--panel);
    box-shadow: 0 26px 70px rgba(15, 23, 42, .16);
}

html[data-theme="light"] .whats-new-kicker {
    background: #dceafe;
    border-color: #bfd4fb;
    color: #1750a7;
}

html[data-theme="light"] .whats-new-feature {
    background: #fff;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .5);
}

html[data-theme="light"] .whats-new-feature-no {
    background: #dceafe;
    color: #1750a7;
}

html[data-theme="light"] .whats-new-feature-platform-badge {
    background: #dcfce7;
    border-color: #86efac;
    color: #166534;
}

.about-lead {
    margin: 0;
    color: var(--txt);
}

.about-note {
    color: var(--muted);
    font-size: var(--fs-ui-xs);
    line-height: 1.45;
}

.draft-list {
    overflow: auto;
    padding: 14px;
}

.draft-item {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    border: 1px solid var(--line-soft);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 8px;
    background: var(--panel-2);
}

.draft-item:last-child {
    margin-bottom: 0;
}

.draft-item-main {
    min-width: 0;
}

.draft-item-title {
    font-size: var(--fs-ui-lg);
    font-weight: 800;
    margin-bottom: 4px;
}

.draft-item-meta {
    color: var(--muted);
    font-size: var(--fs-ui-sm);
    line-height: 1.45;
}

.draft-item-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
}

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

.toast-region {
    position: fixed;
    left: 50%;
    top: 20px;
    z-index: 1400;
    width: min(420px, calc(100vw - 24px));
    display: grid;
    gap: 8px;
    pointer-events: none;
    transform: translateX(-50%);
}

.app-toast {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    min-width: 0;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel-2);
    color: var(--txt);
    box-shadow: 0 18px 42px rgba(0, 0, 0, .34);
    padding: 12px;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity .18s ease, transform .18s ease;
}

.app-toast.show {
    opacity: 1;
    transform: translateY(0);
}

.app-toast i {
    flex: 0 0 auto;
    line-height: 1.25;
}

.app-toast-message {
    min-width: 0;
    font-size: var(--fs-ui-sm);
    font-weight: 700;
    line-height: 1.35;
}

.app-toast-success i {
    color: #22c55e;
}

.app-toast-error i,
.app-toast-danger i {
    color: #ef4444;
}

.app-toast-warning i {
    color: #f59e0b;
}

.confirm-dialog[hidden] {
    display: none;
}

.confirm-dialog {
    position: fixed;
    inset: 0;
    z-index: 1300;
    display: grid;
    place-items: center;
    padding: 18px;
}

.confirm-dialog-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .64);
}

.confirm-dialog-panel {
    position: relative;
    width: min(420px, 100%);
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    color: var(--txt);
    box-shadow: 0 24px 60px rgba(0, 0, 0, .38);
    padding: 16px;
}

.confirm-dialog-icon {
    width: 38px;
    height: 38px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--chip);
    color: #f59e0b;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    margin-bottom: 12px;
}

.confirm-dialog-panel.danger .confirm-dialog-icon {
    color: #ef4444;
}

.confirm-dialog-copy {
    min-width: 0;
}

.confirm-dialog-title {
    font-size: var(--fs-ui-2xl);
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 5px;
}

.confirm-dialog-message {
    color: var(--muted);
    font-size: var(--fs-ui-sm);
    line-height: 1.45;
}

.confirm-dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 16px;
}

.cost-edit-sheet[hidden] {
    display: none;
}

.cost-edit-sheet {
    position: fixed;
    inset: 0;
    z-index: 1320;
    display: grid;
    place-items: center;
    padding: 18px;
}

.cost-edit-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .64);
}

.cost-edit-panel {
    position: relative;
    width: min(460px, 100%);
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    color: var(--txt);
    box-shadow: 0 24px 60px rgba(0, 0, 0, .38);
    overflow: hidden;
}

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

.cost-edit-kicker {
    color: var(--muted);
    font-size: var(--fs-ui-xs);
    font-weight: 800;
    line-height: 1.2;
    margin-bottom: 3px;
    text-transform: uppercase;
}

.cost-edit-title {
    font-size: var(--fs-ui-2xl);
    font-weight: 800;
    line-height: 1.2;
}

.cost-edit-body {
    display: grid;
    gap: 8px;
    padding: 14px 16px;
}

.cost-edit-money-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.cost-edit-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr);
    gap: 8px;
    padding: 14px 16px 16px;
    border-top: 1px solid var(--line);
}

.cost-edit-actions .mini-btn,
.cost-edit-actions .primary-btn {
    min-height: 44px;
}

.text-muted-small {
    color: var(--muted);
    font-size: var(--fs-ui-md);
}

@media (max-width: 1399.98px) {
    .main-grid {
        grid-template-columns: 17rem minmax(0, 1fr) minmax(0, 1fr);
    }

    body.preview-hidden .main-grid {
        grid-template-columns: 17rem minmax(0, 1fr);
    }
}

@media (max-width: 1023.98px) {
    html,
    body {
        height: auto;
    }

    body {
        --mobile-topbar-height: 65px;
        --mobile-tabbar-height: 44px;
        overflow: auto;
        overflow-x: hidden;
        overscroll-behavior-y: none;
    }

    body.mobile-menu-open {
        overflow: hidden;
    }

    body.mobile-menu-open::before {
        content: "";
        position: fixed;
        inset: 0;
        z-index: 55;
        background: rgba(0, 0, 0, .56);
        backdrop-filter: blur(2px);
    }

    html[data-theme="light"] body.mobile-menu-open::before {
        background: rgba(15, 23, 42, .26);
    }

    .app-shell {
        height: auto;
        min-height: 100dvh;
        max-width: none;
        margin: 0;
        padding: 0;
    }

    .workspace {
        height: auto;
        min-height: 100dvh;
        border-radius: 0;
        border-left: 0;
        border-right: 0;
    }

    .topbar {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 50;
        flex-wrap: nowrap;
        overflow: visible;
    }

    body.mobile-menu-open .topbar {
        z-index: 70;
    }

    .mobile-menu-btn {
        display: inline-flex;
        width: 44px;
        min-height: 44px;
        flex: 0 0 auto;
        font-size: 1.15rem;
    }

    body.mobile-menu-open .mobile-menu-btn {
        background: var(--chip);
    }

    .topbar-left {
        flex: 1 1 auto;
    }

    .topbar-right {
        position: fixed;
        top: auto;
        left: 50%;
        right: auto;
        bottom: 12px;
        bottom: calc(12px + env(safe-area-inset-bottom, 0px));
        z-index: 80;
        display: flex !important;
        flex-direction: column;
        flex-wrap: nowrap !important;
        align-items: stretch !important;
        gap: 6px !important;
        width: min(360px, calc(100vw - 24px));
        max-height: min(76dvh, 420px);
        overflow-y: auto;
        padding: 10px;
        border: 1px solid var(--line);
        border-radius: 8px;
        background: var(--panel-2);
        box-shadow: 0 18px 42px rgba(0, 0, 0, .36);
        opacity: 0;
        pointer-events: none;
        transform: translate(-50%, 18px);
        visibility: hidden;
        transition: opacity .18s ease, transform .18s ease, visibility .18s ease;
    }

    .topbar-action-group {
        display: contents;
    }

    .topbar-action-group + .topbar-action-group {
        border-left: 0;
        padding-left: 0;
    }

    body.cost-edit-open,
    body.confirm-dialog-open,
    body.about-modal-open,
    body.draft-modal-open,
    body.whats-new-modal-open {
        overflow: hidden;
    }

    .topbar-right::before {
        content: "Menu";
        color: var(--muted);
        font-size: var(--fs-ui-xs);
        font-weight: 800;
        line-height: 1.2;
        padding: 2px 4px 5px;
        text-transform: uppercase;
    }

    body.mobile-menu-open .topbar-right {
        opacity: 1;
        pointer-events: auto;
        transform: translate(-50%, 0);
        visibility: visible;
    }

    .topbar-right .ghost-btn,
    .topbar-right .primary-btn {
        width: 100%;
        max-width: 100%;
        min-width: 0;
        min-height: 44px;
        justify-content: flex-start;
        padding: 0 10px;
        text-align: left;
    }

    .topbar-right .ghost-btn:not(.mobile-menu-only):not(#themeToggleBtn),
    .topbar-right .primary-btn {
        display: none;
    }

    .topbar-right .ghost-btn i,
    .topbar-right .primary-btn i {
        width: 18px;
        text-align: center;
    }

    .topbar-right .mobile-menu-only {
        display: inline-flex;
    }

    .topbar-right .ghost-btn span,
    .topbar-right .primary-btn span {
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .main-grid {
        grid-template-columns: 1fr;
        align-content: start;
        overflow: visible;
        min-width: 0;
        padding-top: calc(var(--mobile-topbar-height) + var(--mobile-tabbar-height));
        padding-bottom: calc(86px + env(safe-area-inset-bottom, 0px));
    }

    body.preview-hidden .main-grid {
        grid-template-columns: 1fr;
    }

    body.mobile-preview-mode .main-grid {
        padding-top: var(--mobile-topbar-height);
    }

    .sidebar,
    .form-panel {
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }

    .sidebar {
        position: static;
        z-index: auto;
        overflow: visible;
        min-width: 0;
        padding: 0;
        border-bottom: 0;
        background: transparent;
    }

    .preview-panel {
        display: none;
        overflow: visible;
        min-width: 0;
        padding-top: 12px;
    }

    body.mobile-preview-mode .sidebar,
    body.mobile-preview-mode .form-panel {
        display: none;
    }

    body.mobile-preview-mode .preview-panel {
        display: block;
        border-bottom: 0;
    }

    .form-panel {
        overflow: visible;
        min-width: 0;
        padding-bottom: 12px;
    }

    .form-panel .tab-pane.active > .section-card:last-child {
        margin-bottom: 0;
    }

    .preview-head h4 {
        margin-top: 0;
    }

    .preview-head {
        display: flex;
        align-items: flex-start;
        justify-content: space-between;
        gap: 12px;
        margin-bottom: 14px;
    }

    .preview-back-btn {
        border: 1px solid var(--line);
        border-radius: 8px;
        background: var(--chip);
        color: var(--txt);
        min-height: 40px;
        padding: 0 10px;
        align-items: center;
        justify-content: center;
        gap: 6px;
        font-size: var(--fs-ui-sm);
        font-weight: 800;
        line-height: 1.2;
        flex: 0 0 auto;
    }

    body.mobile-preview-mode .preview-back-btn {
        display: inline-flex;
    }

    .preview-scroll {
        max-width: 100%;
        overflow-x: hidden;
        overflow-y: visible;
    }

    .step-list {
        position: fixed;
        top: var(--mobile-topbar-height);
        left: 0;
        right: 0;
        z-index: 44;
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        min-width: 0;
        padding: 8px 12px 10px;
        border-bottom: 1px solid var(--line);
        background: rgba(17, 20, 26, .92);
        backdrop-filter: blur(14px);
    }

    html[data-theme="light"] .step-list {
        background: rgba(255, 255, 255, .94);
    }

    .step-note {
        display: none;
    }

    .summary-realisasi-grid {
        gap: 6px;
    }

    .summary-stat {
        padding: 7px 7px 8px;
    }

    .summary-stat-label {
        font-size: 0.69rem;
        margin-bottom: 4px;
    }

    .summary-stat-value {
        line-height: 1.05;
        letter-spacing: 0;
        font-variant-numeric: tabular-nums;
        white-space: nowrap;
        overflow: visible;
        text-overflow: clip;
        overflow-wrap: normal;
    }

    .mobile-actionbar {
        position: fixed;
        left: 12px;
        right: 12px;
        bottom: 10px;
        bottom: calc(10px + env(safe-area-inset-bottom, 0px));
        z-index: 45;
        display: grid;
        grid-template-columns: repeat(6, minmax(0, 1fr));
        gap: 3px;
        padding: 6px;
        border: 1px solid var(--line);
        border-radius: 8px;
        background: rgba(11, 13, 17, .94);
        box-shadow: 0 16px 34px rgba(0, 0, 0, .32);
        backdrop-filter: blur(14px);
    }

    html[data-theme="light"] .mobile-actionbar {
        background: rgba(255, 255, 255, .94);
    }

    .mobile-actionbar-btn {
        min-width: 0;
        min-height: 48px;
        border: 1px solid transparent;
        border-radius: 8px;
        background: transparent;
        color: var(--muted);
        display: inline-flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 3px;
        font-size: var(--fs-ui-2xs);
        font-weight: 800;
        line-height: 1.1;
        padding: 4px 2px;
    }

    .mobile-actionbar-btn i {
        font-size: 1rem;
        line-height: 1;
    }

    .mobile-actionbar-btn.active {
        border-color: var(--line);
        background: var(--chip);
        color: var(--txt);
    }

    .about-modal {
        padding: 14px;
    }

    .whats-new-modal {
        padding: 12px;
    }

    .whats-new-modal-panel {
        width: min(520px, 100%);
        max-height: calc(100dvh - 24px);
        border-radius: 14px;
        display: flex;
        flex-direction: column;
    }

    .whats-new-modal-head {
        padding: 16px 16px 13px;
    }

    .whats-new-modal-body {
        overflow-y: auto;
        padding: 12px 14px 8px;
    }

    .whats-new-modal-actions {
        padding: 4px 16px 16px;
    }

    .app-footer {
        display: none;
    }

}

@media (max-width: 767.98px) {
    body {
        --mobile-topbar-height: 69px;
        --mobile-tabbar-height: 44px;
    }

    .app-shell {
        margin: 0;
        padding: 0;
    }

    .topbar {
        gap: 8px;
        padding: 12px 10px;
        min-width: 0;
    }

    .topbar-sub {
        display: block;
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-size: var(--fs-ui-xs);
        line-height: 1.2;
        margin-top: 3px;
    }

    .topbar {
        flex-direction: row;
        align-items: center;
    }

    .topbar-left {
        width: auto;
        flex: 1 1 auto;
        min-width: 0;
    }

    .topbar-left > div {
        min-width: 0;
    }

    .topbar-title {
        font-size: 1rem;
        line-height: 1.1;
    }

    .topbar-right {
        width: min(340px, calc(100vw - 20px));
    }

    .topbar-right .ghost-btn,
    .topbar-right .primary-btn {
        font-size: var(--fs-ui-sm);
    }

    .duration-input-group {
        grid-template-columns: minmax(0, 1fr) 96px;
        gap: 6px;
    }

    .duration-input-group .form-select {
        width: 96px;
        flex-basis: 96px;
    }

    .submission-range-group {
        grid-template-columns: 1fr auto 1fr;
        gap: 6px;
    }

    .submission-range-group .form-control {
        font-size: 15px;
    }

    .sidebar,
    .form-panel,
    .preview-panel {
        padding: 12px;
    }

    .form-panel {
        padding-bottom: 12px;
    }

    .preview-panel {
        padding: 14px 12px 12px;
    }

    .step-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 6px;
    }

    .step-btn {
        display: grid;
        grid-template-columns: 22px max-content 16px;
        align-items: center;
        justify-content: center;
        min-height: 44px;
        max-width: 100%;
        padding: 8px 10px;
        column-gap: 7px;
        background: var(--panel-2);
        border-color: var(--line-soft);
    }

    .step-left {
        display: contents;
    }

    .step-no {
        width: 22px;
        height: 22px;
        font-size: var(--fs-ui-2xs);
    }

    .step-btn.active .step-no {
        border-color: var(--line);
        background: rgba(255, 255, 255, .04);
    }

    .step-btn.active {
        background: var(--chip);
        border-color: var(--line);
        box-shadow: inset 0 1px 0 rgba(255, 255, 255, .03);
    }

    .step-btn:active,
    .mini-btn:active,
    .mobile-actionbar-btn:active,
    .mobile-cost-edit-btn:active {
        transform: translateY(1px);
    }

    .step-btn:focus-visible,
    .mini-btn:focus-visible,
    .mobile-actionbar-btn:focus-visible,
    .mobile-cost-edit-btn:focus-visible {
        outline: 2px solid rgba(59, 130, 246, .35);
        outline-offset: 2px;
    }

    .step-label {
        min-width: 0;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        font-size: 0;
        line-height: 1;
    }

    .step-label::after {
        content: attr(data-mobile-label);
        font-size: var(--fs-ui-xs);
        line-height: 1.2;
        font-weight: 800;
    }

    .step-dot {
        display: inline-flex;
        grid-column: 3;
        justify-self: center;
    }

    .step-note {
        display: none;
    }

    .form-title {
        font-size: 1rem;
        line-height: 1.15;
    }

    .form-desc {
        font-size: 0.78rem;
        line-height: 1.45;
    }

    .section-card-title {
        font-size: 0.95rem;
        line-height: 1.2;
    }

    .section-card-desc {
        font-size: 0.74rem;
        line-height: 1.4;
    }

    .section-card {
        padding: 11px;
        margin-bottom: 10px;
        background: rgba(17, 20, 26, .74);
        box-shadow: inset 0 1px 0 rgba(255, 255, 255, .02);
    }

    html[data-theme="light"] .section-card {
        background: rgba(255, 255, 255, .86);
    }

    .section-card.mobile-collapsible .section-card-title {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
        cursor: pointer;
        user-select: none;
        padding: 1px 0;
        transition: color .18s ease, transform .18s ease;
    }

    .section-card.mobile-collapsible .section-card-title::after {
        content: "-";
        width: 24px;
        height: 24px;
        border: 1px solid var(--line);
        border-radius: 8px;
        color: var(--muted);
        display: inline-flex;
        align-items: center;
        justify-content: center;
        font-size: var(--fs-ui-base);
        line-height: 1;
        flex: 0 0 auto;
        transition: background-color .18s ease, border-color .18s ease, transform .18s ease;
    }

    .section-card.mobile-collapsible.mobile-section-collapsed .section-card-title::after {
        content: "+";
    }

    .section-card.mobile-collapsible.mobile-section-collapsed > *:not(.section-card-title):not(.section-card-desc) {
        display: none !important;
    }

    .section-card.mobile-collapsible.mobile-section-collapsed .section-card-desc {
        display: block;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        margin-bottom: 0;
    }

    .section-card.mobile-collapsible:active .section-card-title {
        transform: translateY(1px);
    }

    .section-card.mobile-collapsible:active .section-card-title::after {
        background: var(--chip);
    }

    .row.g-3 {
        --bs-gutter-y: .8rem;
        --bs-gutter-x: .8rem;
    }

    .section-card .form-label {
        font-size: 0.72rem;
        line-height: 1.15;
        margin-bottom: 5px;
    }

    .form-control,
    .form-select {
        min-height: 44px;
        font-size: 16px;
    }

    textarea.form-control {
        font-size: 16px;
    }

    .editor-toolbar-actions {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
        width: 100%;
    }

    .editor-toolbar-actions .mini-btn {
        width: 100%;
        min-height: 44px;
    }

    .mini-btn,
    .icon-btn,
    .ghost-btn,
    .primary-btn,
    .step-btn,
    .mobile-actionbar-btn,
    .mobile-cost-edit-btn {
        transition: background-color .18s ease, border-color .18s ease, color .18s ease, transform .16s ease, box-shadow .18s ease;
    }

    .mini-btn:hover,
    .icon-btn:hover,
    .ghost-btn:hover,
    .primary-btn:hover {
        transform: translateY(0);
    }

    .cost-collapse-btn:not([hidden]) {
        display: inline-flex;
        width: 100%;
        min-height: 40px;
        align-items: center;
        justify-content: center;
        gap: 6px;
        margin-top: 8px;
    }

    .cost-total-summary {
        width: 100%;
        margin-left: 0;
        justify-content: space-between;
    }

    .cost-section.cost-collapsed .table-scroll {
        display: none;
    }

    .table-scroll {
        overflow: visible;
    }

    .cost-editor-wrap {
        border: 0;
        overflow: visible;
    }

    .cost-editor-table {
        display: block;
        min-width: 0;
    }

    .cost-editor-table thead {
        display: none;
    }

    .cost-editor-table tbody {
        display: block;
    }

    .cost-editor-table tr {
        display: block;
        margin-bottom: 10px;
        padding: 0;
        border: 0;
        border-radius: 0;
        background: transparent;
    }

    .cost-editor-table tr:last-child {
        margin-bottom: 0;
    }

    .cost-editor-wrap.cost-collapsed .cost-editor-table tbody tr:nth-child(n+2) {
        display: none;
    }

    .cost-editor-wrap.cost-collapsed .cost-editor-table tbody tr:first-child {
        margin-bottom: 0;
    }

    .cost-editor-table td {
        display: block;
        padding: 0;
        border-bottom: 0;
    }

    .cost-editor-table td:not(.mobile-cost-card-cell) {
        display: none;
    }

    .cost-editor-table .mobile-cost-card-cell {
        display: block;
    }

    .cost-editor-table td + td {
        margin-top: 10px;
    }

    .cost-editor-table td::before {
        content: attr(data-label);
        display: block;
        color: var(--muted);
        font-size: var(--fs-ui-xs);
        font-weight: 800;
        line-height: 1.2;
        margin-bottom: 6px;
    }

    .cost-editor-table td[data-label="Aksi"]::before {
        display: none;
    }

    .mobile-cost-card-cell::before {
        display: none !important;
    }

    .mobile-cost-card {
        display: grid;
        grid-template-columns: minmax(0, 1fr) 38px;
        align-items: stretch;
        gap: 8px;
        min-width: 0;
    }

    .mobile-cost-edit-btn {
        min-width: 0;
        border: 1px solid var(--line-soft);
        border-radius: 8px;
        background: var(--panel-2);
        color: var(--txt);
        display: grid;
        grid-template-columns: auto minmax(0, 1fr) auto;
        align-items: center;
        gap: 10px;
        padding: 10px;
        text-align: left;
    }

    .mobile-cost-edit-btn:active {
        background: var(--chip);
    }

    .mobile-cost-type {
        border: 1px solid var(--line);
        border-radius: 8px;
        color: var(--muted);
        display: inline-flex;
        align-items: center;
        justify-content: center;
        min-width: 42px;
        min-height: 28px;
        padding: 0 7px;
        font-size: var(--fs-ui-2xs);
        font-weight: 800;
        line-height: 1;
    }

    .mobile-cost-main {
        min-width: 0;
        display: grid;
        gap: 4px;
    }

    .mobile-cost-title {
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-size: var(--fs-ui-sm);
        font-weight: 800;
        line-height: 1.2;
    }

    .mobile-cost-amounts {
        min-width: 0;
        color: var(--muted);
        display: flex;
        flex-wrap: wrap;
        gap: 4px 8px;
        font-size: var(--fs-ui-xs);
        font-weight: 700;
        line-height: 1.2;
    }

    .mobile-cost-delete-btn.delete-row-btn {
        width: 38px;
        min-width: 38px;
        min-height: 100%;
        margin-top: 0;
        padding: 0;
    }

    .row-type-badge {
        width: 100%;
        min-width: 0;
    }

    .signature-preview-mini {
        max-width: none;
        height: 72px;
    }

    .company-logo-input-row {
        display: grid;
        grid-template-columns: minmax(0, 1fr) 44px;
        align-items: stretch;
    }

    .company-logo-clear-btn {
        width: 44px;
        min-height: 44px;
    }

    .delete-sign-btn {
        width: 100%;
        min-height: 44px;
    }

    .preview-head p {
        line-height: 1.45;
    }

    .preview-scroll {
        padding: 0;
    }

    .doc-page {
        width: 794px;
        min-width: 794px;
    }

    .draft-modal {
        padding: 10px;
    }

    .toast-region {
        top: auto;
        bottom: calc(82px + env(safe-area-inset-bottom, 0px));
    }

    .confirm-dialog {
        align-items: end;
        padding: 12px;
        padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    }

    .confirm-dialog-panel {
        width: 100%;
    }

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

    .confirm-dialog-actions .mini-btn {
        min-height: 44px;
    }

    .cost-edit-sheet {
        align-items: end;
        padding: 12px;
        padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    }

    .cost-edit-panel {
        width: 100%;
        max-height: calc(100dvh - 24px);
        display: flex;
        flex-direction: column;
        transform: translateY(12px);
    }

    body.cost-edit-open .cost-edit-panel,
    body.confirm-dialog-open .confirm-dialog-panel {
        transform: translateY(0);
    }

    .cost-edit-body {
        overflow: auto;
    }

    .cost-edit-actions {
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    }

    .draft-item {
        flex-direction: column;
    }

    .draft-item-actions {
        width: 100%;
    }

    .draft-item-actions .mini-btn {
        flex: 1 1 0;
    }

}

@media (max-width: 374.98px) {
    .step-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .cost-editor-table td {
        grid-template-columns: 1fr;
    }

    .cost-editor-table td::before {
        margin-bottom: -2px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .app-loader,
    .app-loader-progress span {
        transition: none;
    }

    .cost-editor-table tr.cost-row-moved td:not(.mobile-cost-card-cell) {
        animation: none;
    }
}
