.tb-tool-page {
    padding: 32px max(24px, calc((100vw - 1100px) / 2)) 80px;
}

.tb-crumb {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: var(--tb-text-sm);
    color: var(--tb-text-faint);
    margin-bottom: 28px;
}

.tb-crumb a {
    color: var(--tb-text-muted);
    text-decoration: none;
    transition: color var(--tb-transition);
}

.tb-crumb a:hover {
    color: var(--tb-text);
}

.tb-crumb i {
    font-size: 11px;
}

/* ── Page header ──────────────────────────────────────────────── */
.tb-page-head {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 36px;
    padding-top: 20px;
}

.tb-page-head .tb-tool-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--tb-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}

.tb-page-title {
    font-size: 22px;
    font-weight: 600;
    letter-spacing: -0.02em;
    margin-bottom: 4px;
}

.tb-page-sub {
    font-size: var(--tb-text-sm);
    color: var(--tb-text-muted);
    line-height: 1.6;
    max-width: 560px;
    margin: 0;
}

/* ── Workspace: dua kolom ─────────────────────────────────────── */
.tb-workspace {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 16px;
    align-items: start;
}

/* ── Panel ────────────────────────────────────────────────────── */
.tb-panel {
    background: var(--tb-surface);
    border: 1px solid var(--tb-border);
    border-radius: var(--tb-radius-lg);
    overflow: hidden;
}

.tb-panel-body {
    padding: 20px;
}

/* ── Dropzone ─────────────────────────────────────────────────── */
.tb-drop {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1.5px dashed var(--tb-border-hover);
    border-radius: var(--tb-radius);
    padding: 48px 24px;
    text-align: center;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.01);
    transition: border-color var(--tb-transition), background var(--tb-transition);
}

.tb-drop:hover,
.tb-drop.is-over {
    border-color: var(--tb-primary);
    background: var(--tb-primary-dim);
}

.tb-drop-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--tb-radius);
    background: var(--tb-surface-2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: var(--tb-text-muted);
    margin-bottom: 4px;
}

.tb-drop-title {
    font-size: var(--tb-text-base);
    font-weight: 500;
    color: var(--tb-text);
}

.tb-drop-sub {
    font-size: var(--tb-text-sm);
    color: var(--tb-text-faint);
    line-height: 1.5;
    max-width: 320px;
}

.tb-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
}

/* ── Stage / preview area ─────────────────────────────────────── */
.tb-stage {
    position: relative;
    border-radius: var(--tb-radius);
    overflow: hidden;
    line-height: 0;
}

.tb-checker {
    background-color: var(--tb-surface-2);
    background-image:
        linear-gradient(45deg, var(--tb-surface-3) 25%, transparent 25%),
        linear-gradient(-45deg, var(--tb-surface-3) 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, var(--tb-surface-3) 75%),
        linear-gradient(-45deg, transparent 75%, var(--tb-surface-3) 75%);
    background-size: 16px 16px;
    background-position: 0 0, 0 8px, 8px -8px, -8px 0;
}

.tb-stage canvas {
    display: block;
    max-width: 100%;
    height: auto;
}

/* Loading overlay */
.tb-stage-busy {
    position: absolute;
    inset: 0;
    background: rgba(14, 14, 15, 0.75);
    backdrop-filter: blur(4px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    font-size: var(--tb-text-sm);
    color: var(--tb-text-muted);
}

.tb-stage-busy[hidden] {
    display: none;
}

.tb-progress {
    width: 160px;
    height: 3px;
    background: var(--tb-surface-3);
    border-radius: var(--tb-radius-full);
    overflow: hidden;
}

.tb-progress span {
    display: block;
    height: 100%;
    background: var(--tb-primary);
    width: 0;
    transition: width 0.3s ease;
}

/* File info bar */
.tb-fileinfo {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 12px;
    font-size: var(--tb-text-sm);
    color: var(--tb-text-muted);
}

/* Alert */
.tb-alert {
    margin-top: 12px;
    padding: 10px 14px;
    border-radius: var(--tb-radius);
    background: var(--tb-coral-dim);
    border: 1px solid var(--tb-coral-border);
    color: var(--tb-coral);
    font-size: var(--tb-text-sm);
    line-height: 1.5;
}

.tb-alert[hidden] {
    display: none;
}

/* ── Settings sidebar ─────────────────────────────────────────── */
.tb-settings {
    padding: 0;
}

.tb-group {
    padding: 20px;
    border-bottom: 1px solid var(--tb-border);
}

.tb-group:last-child {
    border-bottom: none;
}

.tb-group-title {
    font-size: var(--tb-text-sm);
    font-weight: 500;
    color: var(--tb-text);
    margin-bottom: 14px;
}

/* Swatches */
.tb-swatches {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
}

.tb-swatch {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-family: var(--tb-font-sans);
    color: var(--tb-text-muted);
    background: var(--tb-surface-2);
    border: 1px solid var(--tb-border);
    border-radius: var(--tb-radius-full);
    padding: 4px 10px 4px 6px;
    cursor: pointer;
    transition: border-color var(--tb-transition), color var(--tb-transition);
}

.tb-swatch:hover {
    border-color: var(--tb-border-hover);
    color: var(--tb-text);
}

.tb-swatch.active {
    border-color: var(--tb-primary);
    color: var(--tb-text);
    background: var(--tb-primary-dim);
}

.tb-swatch-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.15);
    flex-shrink: 0;
}

.tb-swatch-dot.is-transparent {
    background: linear-gradient(135deg,
            #888 0%, #888 50%,
            #fff 50%, #fff 100%);
}

/* Color input */
.tb-color {
    width: 100%;
    height: 36px;
    padding: 2px 4px;
    border: 1px solid var(--tb-border);
    border-radius: var(--tb-radius);
    background: var(--tb-surface-2);
    cursor: pointer;
}

.tb-color:focus {
    outline: none;
    border-color: var(--tb-primary);
}

/* Chips */
.tb-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 14px;
}

.tb-chip {
    font-size: 12px;
    font-weight: 500;
    font-family: var(--tb-font-sans);
    padding: 5px 12px;
    border-radius: var(--tb-radius-full);
    border: 1px solid var(--tb-border);
    background: var(--tb-surface-2);
    color: var(--tb-text-muted);
    cursor: pointer;
    transition: all var(--tb-transition);
}

.tb-chip:hover {
    border-color: var(--tb-border-hover);
    color: var(--tb-text);
}

.tb-chip.active {
    background: var(--tb-primary-dim);
    border-color: var(--tb-primary);
    color: var(--tb-primary);
}

/* ── Input dengan unit di kanan ───────────────────────────────── */
.tb-field {
    margin-bottom: 0;
}

.tb-field+.tb-field {
    margin-top: 12px;
}

.tb-label {
    display: block;
    font-size: 11px;
    color: var(--tb-text-faint);
    margin-bottom: 5px;
}

.tb-input-unit {
    display: flex;
    align-items: stretch;
    border: 1px solid var(--tb-border);
    border-radius: var(--tb-radius);
    background: var(--tb-surface-2);
    overflow: hidden;
    transition: border-color var(--tb-transition);
}

.tb-input-unit:focus-within {
    border-color: var(--tb-primary);
}

.tb-input::placeholder {
    color: var(--tb-text-faint);
}

/* Saat preset dipilih: input tidak bisa diubah */
.tb-input:disabled {
    color: var(--tb-text-faint);
    cursor: not-allowed;
}

.tb-input-unit:has(.tb-input:disabled) {
    opacity: 0.55;
}

.tb-unit {
    padding: 0 10px;
    font-size: var(--tb-text-xs);
    font-family: var(--tb-font-mono);
    color: var(--tb-text-faint);
    background: var(--tb-surface-3);
    border-left: 1px solid var(--tb-border);
    display: flex;
    align-items: center;
    white-space: nowrap;
    user-select: none;
    flex-shrink: 0;
}

/* ── Range slider ─────────────────────────────────────────────── */
.tb-range-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.tb-range-head output {
    font-size: var(--tb-text-xs);
    font-family: var(--tb-font-mono);
    color: var(--tb-primary);
}

.tb-range {
    width: 100%;
    accent-color: var(--tb-primary);
    cursor: pointer;
}

/* ── Meta info ────────────────────────────────────────────────── */
.tb-meta {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin: 0;
    padding: 12px;
    background: var(--tb-surface-2);
    border-radius: var(--tb-radius);
    border: 1px solid var(--tb-border);
}

.tb-meta dt {
    font-size: var(--tb-text-xs);
    color: var(--tb-text-faint);
    margin-bottom: 3px;
}

.tb-meta dd {
    font-size: var(--tb-text-sm);
    font-family: var(--tb-font-mono);
    color: var(--tb-text);
    margin: 0;
}

/* ── Hint text ────────────────────────────────────────────────── */
.tb-hint {
    font-size: var(--tb-text-xs);
    color: var(--tb-text-faint);
    line-height: 1.55;
    margin-top: 8px;
    margin-bottom: 0;
}

/* ── Actions area ─────────────────────────────────────────────── */
.tb-actions {
    padding: 20px;
}

.tb-actions .btn-tb-primary {
    width: 100%;
    justify-content: center;
    margin-bottom: 0;
}

/* ── Small ghost button ───────────────────────────────────────── */
.tb-btn-sm {
    font-size: 12px;
    padding: 5px 12px;
    white-space: nowrap;
}

/* ── Responsive ───────────────────────────────────────────────── */
@media (max-width: 768px) {
    .tb-tool-page {
        padding: 24px 16px 60px;
    }

    .tb-workspace {
        grid-template-columns: 1fr;
    }

    .tb-settings {
        order: -1;
        /* settings di atas di mobile */
    }
}

.tb-step-label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: var(--tb-text-sm);
    font-weight: 500;
    color: var(--tb-text-muted);
    margin-bottom: 14px;
}

.tb-step-num {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--tb-primary);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.tb-type-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.tb-type-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 16px 10px;
    background: var(--tb-surface-2);
    border: 1.5px solid var(--tb-border);
    border-radius: var(--tb-radius);
    cursor: pointer;
    transition: border-color var(--tb-transition), background var(--tb-transition);
    text-align: center;
    font-family: var(--tb-font-sans);
}

.tb-type-card:hover {
    border-color: var(--tb-border-hover);
    background: var(--tb-surface-3);
}

.tb-type-card.active {
    border-color: var(--tb-primary);
    background: var(--tb-primary-dim);
}

.tb-type-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--tb-radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.tb-type-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--tb-text);
}

.tb-type-ext {
    font-size: 10px;
    color: var(--tb-text-faint);
    line-height: 1.4;
}

.tb-file-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 60px 24px;
    text-align: center;
}

.tb-file-placeholder i {
    font-size: 48px;
    color: var(--tb-text-faint);
}

.tb-file-placeholder-name {
    font-size: var(--tb-text-base);
    font-weight: 500;
    color: var(--tb-text);
    word-break: break-all;
}

.tb-file-placeholder-meta {
    font-size: var(--tb-text-sm);
    color: var(--tb-text-muted);
    font-family: var(--tb-font-mono);
}

.tb-notice {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    background: var(--tb-primary-dim);
    border: 1px solid var(--tb-primary-border);
    border-radius: var(--tb-radius);
    font-size: var(--tb-text-sm);
    color: var(--tb-text-muted);
    line-height: 1.55;
}

.tb-notice i {
    color: var(--tb-primary);
    flex-shrink: 0;
    margin-top: 1px;
}

.tb-check {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    font-size: var(--tb-text-sm);
    color: var(--tb-text-muted);
    cursor: pointer;
    line-height: 1.5;
}

.tb-check input[type="checkbox"] {
    accent-color: var(--tb-primary);
    width: 15px;
    height: 15px;
    margin-top: 2px;
    flex-shrink: 0;
    cursor: pointer;
}

.tb-meta {
    grid-template-columns: 1fr 1fr;
}

@media (max-width: 575px) {
    .tb-type-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}