/* ==========================================
   ACTION DRAWER — right-side extended panel
   ========================================== */

.action-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10, 22, 40, 0.45);
    backdrop-filter: blur(2px);
    z-index: 1100;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.action-modal-overlay.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.action-modal {
    position: fixed;
    top: 0;
    right: 0;
    width: min(1120px, 88vw);
    height: 100vh;
    max-height: 100vh;
    background: #fff;
    border-left: 1px solid var(--border-light);
    box-shadow: -16px 0 48px rgba(10, 22, 40, 0.14);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: translateX(100%);
    transition: transform 0.34s cubic-bezier(0.4, 0, 0.2, 1);
}

.action-modal-overlay.active .action-modal {
    transform: translateX(0);
}

.action-modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 22px 28px 18px;
    border-bottom: 1px solid var(--border-light);
    background: #fff;
    flex-shrink: 0;
}

.action-modal-title {
    margin: 0;
    font-family: 'Outfit', sans-serif;
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--navy-900);
}

.action-modal-subtitle {
    margin: 6px 0 0;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-tertiary);
}

.action-modal-close {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    border: 1px solid var(--border-light);
    background: #fff;
    color: var(--text-tertiary);
    cursor: pointer;
    display: grid;
    place-items: center;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
    flex-shrink: 0;
}

.action-modal-close:hover {
    background: var(--gray-50);
    color: var(--navy-800);
    border-color: var(--border-medium);
}

.action-modal-body {
    padding: 18px 28px 24px;
    overflow-y: auto;
    flex: 1;
    background: #f8fafc;
}

.action-modal-body.action-modal-body-iframe {
    padding: 0;
    overflow: hidden;
    background: #fff;
}

.action-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 28px;
    border-top: 1px solid var(--border-light);
    background: #fff;
    flex-shrink: 0;
    box-shadow: 0 -8px 24px rgba(10, 22, 40, 0.04);
}

.action-section {
    background: #fff;
    border: 1px solid var(--border-light);
    border-radius: 14px;
    padding: 14px 16px 16px;
    margin-bottom: 14px;
    box-shadow: 0 8px 24px rgba(10, 22, 40, 0.04);
}

.action-section-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px;
    font-size: 14px;
    font-weight: 800;
    color: var(--navy-900);
}

.action-section-icon {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    color: #2563eb;
    background: #dbeafe;
    font-size: 14px;
}

.action-detail-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px 18px;
}

.detail-item label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 4px;
}

.detail-item span {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: var(--navy-900);
    line-height: 1.35;
    word-break: break-word;
}

.action-form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px 16px;
}

.action-form-grid .form-group.full-width {
    grid-column: 1 / -1;
}

.action-form-grid label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    color: var(--navy-800);
    margin-bottom: 6px;
}

.action-form-grid input,
.action-form-grid select,
.action-form-grid textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-medium);
    border-radius: 10px;
    font-size: 13px;
    font-family: 'Manrope', sans-serif;
    background: #fff;
}

.action-form-grid textarea {
    min-height: 80px;
    resize: vertical;
}

.action-modal-iframe {
    width: 100%;
    min-height: 520px;
    height: calc(100vh - 160px);
    border: none;
    border-radius: 0;
    background: #fff;
}

.quote-summary-grid {
    display: grid;
    gap: 10px;
}

.quote-summary-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 14px;
    border: 1px solid var(--border-light);
    border-radius: 12px;
    background: var(--gray-50);
}

.quote-summary-card strong {
    font-size: 13px;
    color: var(--navy-900);
}

.quote-summary-card .meta {
    font-size: 12px;
    color: var(--text-tertiary);
    font-weight: 600;
}

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

.milestone-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid var(--border-light);
    border-radius: 10px;
    background: #fff;
    font-size: 13px;
    font-weight: 600;
    color: var(--navy-800);
}

.milestone-item input {
    width: 16px;
    height: 16px;
}

.action-modal-loading {
    padding: 48px 24px;
    text-align: center;
    color: var(--text-tertiary);
    font-weight: 600;
}

body.action-drawer-open {
    overflow: hidden;
}

@media (max-width: 900px) {
    .action-modal {
        width: 100vw;
    }

    .action-detail-grid,
    .action-form-grid,
    .milestone-grid {
        grid-template-columns: 1fr;
    }

    .action-modal-body {
        padding: 14px 16px 18px;
    }

    .action-modal-header,
    .action-modal-footer {
        padding-left: 16px;
        padding-right: 16px;
    }

    .action-modal-iframe {
        height: calc(100vh - 300px);
    }
}

html.embedded-mode,
html.embedded-mode body {
    overflow-y: auto !important;
    height: auto !important;
    min-height: 100%;
}

.embedded-drawer-steps {
    display: none;
}

html.embedded-mode .embedded-drawer-steps,
body.embedded-mode .embedded-drawer-steps {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    position: sticky;
    top: 0;
    z-index: 40;
    background: #fff;
    padding: 10px 0 12px;
    pointer-events: auto;
}

html.embedded-mode .embedded-step,
body.embedded-mode .embedded-step {
    flex: 1;
    padding: 10px 12px;
    border-radius: 10px;
    border: 1px solid var(--border-light);
    background: #fff;
    font-size: 12px;
    font-weight: 800;
    color: var(--text-tertiary);
    text-align: center;
    cursor: pointer;
    font-family: 'Manrope', sans-serif;
    transition: background 0.2s, border-color 0.2s, color 0.2s;
    pointer-events: auto;
    position: relative;
    z-index: 41;
}

html.embedded-mode .embedded-step:hover,
body.embedded-mode .embedded-step:hover {
    border-color: #93c5fd;
    color: #1d4ed8;
    background: #f8fafc;
}

html.embedded-mode .embedded-step.active,
body.embedded-mode .embedded-step.active {
    background: #dbeafe;
    border-color: #93c5fd;
    color: #1d4ed8;
}

html.embedded-mode .embedded-step:focus-visible,
body.embedded-mode .embedded-step:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: 2px;
}

html.embedded-mode .embedded-drawer-title,
body.embedded-mode .embedded-drawer-title {
    display: block;
    margin: 0 0 14px;
    font-family: 'Outfit', sans-serif;
    font-size: 18px;
    font-weight: 800;
    color: var(--navy-900);
}

.embedded-drawer-title {
    display: none;
}

html.embedded-mode .embedded-panel[hidden],
body.embedded-mode .embedded-panel[hidden] {
    display: none !important;
}

html.embedded-mode .embedded-panel:not([hidden]),
body.embedded-mode .embedded-panel:not([hidden]) {
    display: block !important;
}

html.embedded-mode .wizard-panel.active,
body.embedded-mode .wizard-panel.active {
    display: block !important;
    animation: none !important;
}

html.embedded-mode .wizard-panel:not(.active):not(.embedded-panel),
body.embedded-mode .wizard-panel:not(.active):not(.embedded-panel) {
    display: none !important;
}

html.embedded-mode .card,
body.embedded-mode .card {
    padding: 20px 18px;
    border-radius: 12px;
}

/* Embedded pages loaded inside drawer iframe */
html.embedded-mode header,
body.embedded-mode header {
    display: none !important;
}

html.embedded-mode .page-header,
body.embedded-mode .page-header {
    display: none !important;
}

html.embedded-mode main,
body.embedded-mode main {
    padding: 0 !important;
}

html.embedded-mode .page-header .btn-secondary[onclick*="history"],
html.embedded-mode .page-header a.btn-secondary,
body.embedded-mode .page-header .btn-secondary[onclick*="history"],
body.embedded-mode .page-header a.btn-secondary {
    display: none !important;
}

html.embedded-mode .container,
body.embedded-mode .container {
    max-width: 100%;
    padding: 0;
}

html.embedded-mode .content,
body.embedded-mode .content {
    border: none;
    box-shadow: none;
    padding: 0;
    min-height: auto;
    margin: 0 !important;
    max-width: none !important;
}

html.embedded-mode .upload-track-container > .form-section:first-child,
body.embedded-mode .upload-track-container > .form-section:first-child {
    display: none !important;
}

html.embedded-mode .wizard-tabs,
body.embedded-mode .wizard-tabs {
    display: none !important;
}

html.embedded-mode #panel3,
body.embedded-mode #panel3,
html.embedded-mode.sl-embedded #panel2,
body.embedded-mode.sl-embedded #panel2 {
    display: none !important;
}

/* Client master drawer: never hide panel2 */
html.embedded-mode.cm-embedded #panel2:not([hidden]),
body.embedded-mode.cm-embedded #panel2:not([hidden]) {
    display: block !important;
}

html.embedded-mode .cm-page,
body.embedded-mode .cm-page,
html.embedded-mode .sl-page,
body.embedded-mode .sl-page {
    padding: 0 !important;
}

html.embedded-mode .wizard-panel,
body.embedded-mode .wizard-panel {
    padding-top: 0 !important;
}

html.embedded-mode .action-modal-footer,
body.embedded-mode .action-modal-footer {
    display: none !important;
}

html.embedded-mode .form-actions,
body.embedded-mode .form-actions {
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
    padding-top: 16px;
    padding-bottom: 20px;
    margin-top: 20px;
}

html.embedded-mode .form-actions .btn,
body.embedded-mode .form-actions .btn {
    flex: 0 1 auto;
    max-width: 100%;
}

html.embedded-mode .form-actions-bar,
body.embedded-mode .form-actions-bar {
    flex-wrap: wrap;
    justify-content: flex-end;
}

html.embedded-mode .form-actions-bar .pdf-dropdown-wrap,
body.embedded-mode .form-actions-bar .pdf-dropdown-wrap {
    flex: 1 1 100%;
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px;
}

html.embedded-mode .embedded-form-grid-2,
body.embedded-mode .embedded-form-grid-2 {
    grid-template-columns: 1fr !important;
}

html.embedded-mode .global-search-floating,
body.embedded-mode .global-search-floating {
    display: none !important;
}

/* Back to Dashboard — not needed inside drawer (parent has Cancel/close) */
html.embedded-mode .step-actions .btn-secondary[onclick*="location.href"],
body.embedded-mode .step-actions .btn-secondary[onclick*="location.href"],
html.embedded-mode .form-actions .btn-secondary[onclick*="dashboard"],
html.embedded-mode .form-actions .btn-secondary[onclick*="goBack"],
html.embedded-mode .form-actions .btn-secondary[onclick*="location.href"],
html.embedded-mode .form-actions .btn-secondary[onclick*='location.href="/'],
html.embedded-mode .form-actions .btn-secondary[onclick*="location.href='/"],
html.embedded-mode .form-actions .btn-secondary[onclick*="location.href=\"/"],
body.embedded-mode .form-actions .btn-secondary[onclick*="dashboard"],
body.embedded-mode .form-actions .btn-secondary[onclick*="goBack"],
body.embedded-mode .form-actions .btn-secondary[onclick*="location.href"],
body.embedded-mode .form-actions .btn-secondary[onclick*='location.href="/'],
body.embedded-mode .form-actions .btn-secondary[onclick*="location.href='/"],
body.embedded-mode .form-actions .btn-secondary[onclick*="location.href=\"/"],
html.embedded-mode #quoteConfirmationPage .pricing-card-header button,
body.embedded-mode #quoteConfirmationPage .pricing-card-header button,
html.embedded-mode #postConfirmEditDetailsBtn,
body.embedded-mode #postConfirmEditDetailsBtn,
html.embedded-mode #postConfirmGoTrackingBtn,
body.embedded-mode #postConfirmGoTrackingBtn,
html.embedded-mode #postConfirmViewBreakdownBtn,
body.embedded-mode #postConfirmViewBreakdownBtn,
html.embedded-mode .page-header .btn-secondary[onclick*="history"],
html.embedded-mode .page-header a.btn-secondary[href="/"],
html.embedded-mode .page-header a.btn-secondary[href="/#dashboard"],
body.embedded-mode .page-header .btn-secondary[onclick*="history"],
body.embedded-mode .page-header a.btn-secondary[href="/"],
body.embedded-mode .page-header a.btn-secondary[href="/#dashboard"] {
    display: none !important;
}
