/* Deploy application-theme bridge.
   This styles the deployment workspace only. It deliberately owns no
   connection, upload, remote-browser, credential, or generated-app state. */

body.deploy-body {
    --ftp-bg: var(--pp-app-bg, #f4f6f9);
    --ftp-pane: var(--pp-surface, #ffffff);
    --ftp-raised: var(--pp-surface-raised, #ffffff);
    --ftp-head: var(--pp-surface-soft, #eef1f6);
    --ftp-subtle: var(--pp-surface-muted, #f8fafc);
    --ftp-border: var(--pp-border, #dfe3ea);
    --ftp-border-strong: var(--pp-border-strong, #cbd5e1);
    --ftp-text: var(--pp-text, #1f2733);
    --ftp-muted: var(--pp-text-muted, #6b7684);
    --ftp-input: var(--pp-input-bg, #ffffff);
    --ftp-row-hover: #edf4ff;
    --ftp-row-sel: #dceaff;
    background: var(--ftp-bg);
    color: var(--ftp-text);
}

html[data-pp-theme="dark"] body.deploy-body {
    --ftp-bg: var(--pp-app-bg, #0b1120);
    --ftp-pane: var(--pp-surface, #111827);
    --ftp-raised: var(--pp-surface-raised, #172033);
    --ftp-head: var(--pp-surface-soft, #172033);
    --ftp-subtle: var(--pp-surface-muted, #1e293b);
    --ftp-border: var(--pp-border, #2b3a52);
    --ftp-border-strong: var(--pp-border-strong, #3a4b66);
    --ftp-text: var(--pp-text, #e7edf7);
    --ftp-muted: var(--pp-text-muted, #9cabc1);
    --ftp-input: var(--pp-input-bg, #101827);
    --ftp-row-hover: #18243a;
    --ftp-row-sel: #203555;
    color-scheme: dark;
}

body.deploy-body .main-area,
body.deploy-body .right-workspace,
body.deploy-body .ftp-app,
body.deploy-body .ftp-panes {
    background: var(--ftp-bg) !important;
    color: var(--ftp-text);
}

body.deploy-body .ftp-connbar {
    background: linear-gradient(180deg, color-mix(in srgb, var(--ftp-raised) 92%, #1d4ed8 8%), var(--ftp-pane));
    color: var(--ftp-text);
    border-bottom: 1px solid var(--ftp-border);
    box-shadow: 0 1px 0 var(--ftp-border);
}

body.deploy-body .cb-brand {
    background: color-mix(in srgb, var(--ftp-accent) 14%, var(--ftp-raised));
}

body.deploy-body .cb-field label,
body.deploy-body .cb-status,
body.deploy-body .cb-btngroup .btn {
    color: var(--ftp-muted);
}

body.deploy-body .cb-select,
body.deploy-body .ub-select,
body.deploy-body .segmented {
    background-color: var(--ftp-input);
    border-color: var(--ftp-border);
    color: var(--ftp-text);
}

/* ── FILES mode — the selected option must be unmistakable ──────────
   A blanket `.seg` fill here outranks the base stylesheet's
   `.seg.active`, which flattened all three buttons to the same colour
   and left only a slightly bolder font as the cue. So: mute the
   unselected options and give the selected one a solid accent fill in
   the current theme's colour. */
body.deploy-body .segmented .seg {
    border-color: var(--ftp-border);
    transition: background-color .15s, color .15s, box-shadow .15s;
}
body.deploy-body .segmented .seg:not(.active) {
    background-color: var(--ftp-input);
    color: var(--ftp-muted);
    font-weight: 500;
}
body.deploy-body .segmented .seg:not(.active):hover {
    background-color: color-mix(in srgb, var(--pp-accent, #3b82f6) 16%, var(--ftp-input));
    color: var(--ftp-text);
}
body.deploy-body .segmented .seg.active {
    background-color: var(--pp-accent, #3b82f6);
    border-color: var(--pp-accent, #3b82f6);
    color: var(--pp-accent-contrast, #fff);
    font-weight: 700;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .22), 0 1px 5px rgba(0, 0, 0, .28);
}

body.deploy-body .cb-select {
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 16 16' fill='%238a97a8'><path d='M4 6l4 4 4-4'/></svg>");
}

body.deploy-body .cb-status,
body.deploy-body .cb-btngroup {
    background: var(--ftp-subtle);
    border-color: var(--ftp-border);
}

body.deploy-body .cb-actions .btn-outline-light,
body.deploy-body .cb-btngroup .btn {
    color: var(--ftp-text);
}

body.deploy-body .cb-actions .btn-outline-light:hover,
body.deploy-body .cb-btngroup .btn:hover:not(:disabled) {
    background: var(--ftp-row-hover);
    color: var(--ftp-accent);
}

body.deploy-body .ftp-uploadbar,
body.deploy-body .pane,
body.deploy-body .ftp-dock,
body.deploy-body .dock-panel {
    background: var(--ftp-pane);
    border-color: var(--ftp-border);
    color: var(--ftp-text);
}

body.deploy-body .pane {
    box-shadow: 0 3px 12px var(--pp-shadow-color, rgba(15, 23, 42, .06));
}

body.deploy-body .pane-head,
body.deploy-body .crumbs,
body.deploy-body .dock-tabs {
    background: var(--ftp-head);
    border-color: var(--ftp-border);
    color: var(--ftp-text);
}

body.deploy-body .crumbs,
body.deploy-body .frow,
body.deploy-body .hist-table td,
body.deploy-body .diag-stage {
    border-color: var(--ftp-border);
}

body.deploy-body .pane-btn:hover,
body.deploy-body .frow .factions button:hover {
    background: var(--ftp-raised);
    border-color: var(--ftp-border);
}

body.deploy-body .frow .factions {
    background: linear-gradient(90deg, transparent, var(--ftp-row-hover) 22%);
}

body.deploy-body .ftp-uploadbar .btn-outline-secondary,
body.deploy-body .pane-btn,
body.deploy-body .dock-tab {
    border-color: var(--ftp-border);
    color: var(--ftp-muted);
}

body.deploy-body .ftp-uploadbar .btn-outline-secondary:hover,
body.deploy-body .dock-tab:hover:not(.active) {
    background: var(--ftp-subtle);
    color: var(--ftp-text);
}

body.deploy-body .dock-tab.active,
body.deploy-body .dock-stats b,
body.deploy-body .pane-title,
body.deploy-body .frow .flabel {
    color: var(--ftp-text);
}

body.deploy-body .log-error {
    background: #fff1f2;
}

html[data-pp-theme="dark"] body.deploy-body .log-error {
    background: #33191d;
}

body.deploy-body .diag-summary.ok,
body.deploy-body .h-success {
    background: #dcfce7;
    color: #15803d;
}

body.deploy-body .diag-summary.bad,
body.deploy-body .h-failed {
    background: #fee2e2;
    color: #b91c1c;
}

body.deploy-body .h-partial {
    background: #fef9c3;
    color: #854d0e;
}

html[data-pp-theme="dark"] body.deploy-body .diag-summary.ok,
html[data-pp-theme="dark"] body.deploy-body .h-success {
    background: #12351f;
    color: #86efac;
}

html[data-pp-theme="dark"] body.deploy-body .diag-summary.bad,
html[data-pp-theme="dark"] body.deploy-body .h-failed {
    background: #3b171b;
    color: #fca5a5;
}

html[data-pp-theme="dark"] body.deploy-body .h-partial {
    background: #3a3013;
    color: #fde68a;
}

body.deploy-body .ftp-statusbar {
    background: var(--ftp-head);
    border-top: 1px solid var(--ftp-border);
    color: var(--ftp-muted);
}

/* Connection and production-database editors */
body.deploy-body .conn-modal .modal-content {
    background: var(--ftp-pane);
    border: 1px solid var(--ftp-border);
    color: var(--ftp-text);
    box-shadow: 0 22px 60px var(--pp-shadow-color, rgba(15, 23, 42, .28));
}

body.deploy-body .conn-modal .modal-header,
body.deploy-body .conn-modal .modal-footer,
body.deploy-body .conn-testbar,
body.deploy-body .modal-diag:not(:empty) {
    background: var(--ftp-head);
    border-color: var(--ftp-border);
    color: var(--ftp-text);
}

body.deploy-body .conn-modal .modal-header {
    min-height: 48px;
    padding-inline: 1rem !important;
}

body.deploy-body .conn-modal .btn-close {
    margin: 0 0 0 auto;
    padding: .55rem;
    border-radius: 8px;
    opacity: .72;
}

body.deploy-body .conn-modal .btn-close:hover {
    background-color: var(--ftp-subtle);
    opacity: 1;
}

html[data-pp-theme="dark"] body.deploy-body .conn-modal .btn-close {
    filter: invert(1) grayscale(100%) brightness(180%);
}

body.deploy-body .cf .form-label,
body.deploy-body .cf .form-check-label,
body.deploy-body .modal-diag .diag-stage .ds-name,
body.deploy-body .modal-diag .diag-stage .ds-detail {
    color: var(--ftp-text);
}

body.deploy-body .cf .form-label .text-muted,
body.deploy-body .cf .text-muted,
body.deploy-body .conn-testbar .text-muted,
body.deploy-body .modal-diag .diag-stage .ds-detail {
    color: var(--ftp-muted) !important;
}

body.deploy-body .conn-modal :is(.form-control, .form-select) {
    background-color: var(--ftp-input);
    border-color: var(--ftp-border-strong);
    color: var(--ftp-text);
}

body.deploy-body .conn-modal :is(.form-control, .form-select)::placeholder {
    color: var(--ftp-muted);
    opacity: .82;
}

body.deploy-body .conn-modal :is(.form-control, .form-select):focus {
    background-color: var(--ftp-input);
    border-color: var(--ftp-accent);
    color: var(--ftp-text);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--ftp-accent) 22%, transparent);
}

body.deploy-body .conn-modal .input-group .btn-outline-secondary,
body.deploy-body .conn-modal .modal-footer .btn-outline-secondary {
    background: var(--ftp-raised);
    border-color: var(--ftp-border-strong);
    color: var(--ftp-text);
}

body.deploy-body .cf .cf-note {
    background: color-mix(in srgb, var(--ftp-accent) 9%, var(--ftp-raised));
    border-color: color-mix(in srgb, var(--ftp-accent) 25%, var(--ftp-border));
    color: var(--ftp-text);
}

body.deploy-body .cf .cf-hr {
    border-color: var(--ftp-border);
}

body.deploy-body .modal-backdrop.show {
    opacity: .58;
}

/* Bootstrap overlays created outside the module tree. */
body.deploy-body .tooltip.ftp-tip .tooltip-inner {
    background: var(--ftp-raised);
    border-color: var(--ftp-border);
    color: var(--ftp-text);
    box-shadow: 0 10px 30px var(--pp-shadow-color, rgba(15, 23, 42, .28));
}

body.deploy-body .swal2-popup {
    background: var(--ftp-raised);
    color: var(--ftp-text);
    border: 1px solid var(--ftp-border);
}

body.deploy-body .swal2-title,
body.deploy-body .swal2-html-container {
    color: var(--ftp-text);
}

body.deploy-body .swal2-input,
body.deploy-body .swal2-select,
body.deploy-body .swal2-textarea {
    background: var(--ftp-input);
    border-color: var(--ftp-border-strong);
    color: var(--ftp-text);
}

@media (max-width: 767.98px) {
    body.deploy-body .ftp-connbar,
    body.deploy-body .ftp-uploadbar {
        padding-inline: .65rem;
    }

    body.deploy-body .cb-actions,
    body.deploy-body .cb-btngroup,
    body.deploy-body .ub-group {
        max-width: 100%;
    }

    body.deploy-body .segmented {
        overflow-x: auto;
    }
}
