/* Karta Wdrożenia PNG (1080x1350, FRAME v2) w portalu /lab.
 * Geometria FRAME: border-radius: 0, cienkie linie 1px, #F9F8FD papier, #09080E tusz, #9959FF/#6525EF akcent.
 */

.kw-section {
    margin-top: 24px;
    background: #ffffff;
    border: 1px solid var(--lab-line, #d8d5e4);
    border-radius: 0;
    padding: clamp(20px, 2.4vw, 32px);
    color: #09080e;
}

.kw-section[hidden] {
    display: none;
}

.kw-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px 24px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--lab-line-soft, #e6e3f0);
}

.kw-eyebrow {
    margin: 0 0 6px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #6525ef;
}

.kw-title {
    margin: 0;
    font-size: clamp(1.2rem, 1.8vw, 1.45rem);
    font-weight: 700;
    line-height: 1.25;
    color: #09080e;
}

.kw-lead {
    margin: 6px 0 0;
    font-size: 0.9375rem;
    line-height: 1.5;
    color: #4a4754;
    max-width: 62ch;
}

/* Stan przed pierwszym ukończeniem (np. Master 0/12) */
.kw-locked-note {
    margin: 18px 0 0;
    padding: 16px 18px;
    background: #f9f8fd;
    border: 1px solid var(--lab-line, #d8d5e4);
    border-radius: 0;
    font-size: 0.9375rem;
    line-height: 1.5;
    color: #322f3d;
}

/* Skala oceny 0 do 10 */
.kw-rating-block {
    margin-top: 20px;
}

.kw-rating-question {
    margin: 0 0 12px;
    font-size: 0.9375rem;
    font-weight: 600;
    color: #09080e;
}

.kw-rating-scale {
    display: grid;
    grid-template-columns: repeat(11, minmax(0, 1fr));
    gap: 6px;
}

.kw-rate-btn {
    min-height: 44px;
    padding: 0 4px;
    border: 1px solid var(--lab-line, #d8d5e4);
    border-radius: 0;
    background: #f9f8fd;
    color: #09080e;
    font-size: 0.9375rem;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    transition: background-color 0.14s ease, color 0.14s ease, border-color 0.14s ease;
}

.kw-rate-btn:hover {
    border-color: #09080e;
    background: #ffffff;
}

.kw-rate-btn:focus-visible {
    outline: 2px solid #6525ef;
    outline-offset: 2px;
}

.kw-rate-btn.is-selected {
    background: #09080e;
    border-color: #09080e;
    color: #ffffff;
}

.kw-rate-btn.is-selected.is-promoter {
    background: #6525ef;
    border-color: #6525ef;
    color: #ffffff;
}

.kw-rating-anchors {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-top: 8px;
    font-size: 0.8125rem;
    color: #5b5768;
}

.kw-rating-feedback {
    margin: 14px 0 0;
    padding: 14px 16px;
    background: #f9f8fd;
    border: 1px solid var(--lab-line, #d8d5e4);
    border-radius: 0;
    font-size: 0.9rem;
    line-height: 1.5;
    color: #322f3d;
}

.kw-rating-feedback a {
    color: #6525ef;
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* Panel generatora Karty Wdrożenia (rozwijany przy ocenie 8, 9 albo 10) */
.kw-builder {
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid #09080e;
}

.kw-builder[hidden] {
    display: none;
}

.kw-builder-head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px 16px;
    margin-bottom: 20px;
}

.kw-builder-title {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 700;
    color: #09080e;
}

.kw-privacy-note {
    margin: 0;
    font-size: 0.8125rem;
    color: #5b5768;
}

.kw-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(260px, 340px);
    gap: clamp(20px, 3vw, 36px);
    align-items: start;
}

.kw-controls {
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 0;
}

/* Przełącznik portfela (klient 2+ programów) */
.kw-portfolio-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--lab-line-soft, #e6e3f0);
}

.kw-portfolio-bar[hidden] {
    display: none;
}

.kw-mode-btn {
    min-height: 40px;
    padding: 8px 14px;
    border: 1px solid var(--lab-line, #d8d5e4);
    border-radius: 0;
    background: #f9f8fd;
    color: #09080e;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
}

.kw-mode-btn:hover {
    border-color: #09080e;
}

.kw-mode-btn.is-active {
    background: #09080e;
    border-color: #09080e;
    color: #ffffff;
}

.kw-mode-btn:focus-visible {
    outline: 2px solid #6525ef;
    outline-offset: 2px;
}

.kw-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.kw-field[hidden] {
    display: none;
}

.kw-field label {
    font-size: 0.875rem;
    font-weight: 600;
    color: #09080e;
}

.kw-field select,
.kw-field input[type="text"],
.kw-field textarea {
    width: 100%;
    box-sizing: border-box;
    padding: 10px 12px;
    border: 1px solid var(--lab-line, #d8d5e4);
    border-radius: 0;
    background: #f9f8fd;
    color: #09080e;
    font-family: var(--frame-font, 'Geist', -apple-system, BlinkMacSystemFont, sans-serif);
    font-size: 0.9375rem;
    line-height: 1.5;
}

.kw-field select:focus,
.kw-field input[type="text"]:focus,
.kw-field textarea:focus {
    outline: 2px solid #6525ef;
    outline-offset: 0;
    background: #ffffff;
    border-color: #6525ef;
}

.kw-field-hint {
    margin: 0;
    font-size: 0.8125rem;
    color: #5b5768;
}

.kw-post-preview {
    min-height: 158px;
    resize: vertical;
    background: #ffffff;
}

/* Przełącznik linku polecającego (domyślnie WYŁĄCZONY) */
.kw-ref-row {
    padding: 12px 14px;
    background: #f9f8fd;
    border: 1px solid var(--lab-line-soft, #e6e3f0);
    border-radius: 0;
}

.kw-ref-toggle {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
    font-weight: 600;
    color: #09080e;
    cursor: pointer;
}

.kw-ref-toggle input[type="checkbox"] {
    width: 18px;
    height: 18px;
    margin: 0;
    accent-color: #6525ef;
    cursor: pointer;
}

.kw-ref-note {
    margin: 8px 0 0;
    font-size: 0.8125rem;
    line-height: 1.45;
    color: #4a4754;
}

.kw-ref-note[hidden] {
    display: none;
}

.kw-ref-note a {
    color: #6525ef;
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 2px;
}

/* Akcje 1-klik */
.kw-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.kw-btn-primary,
.kw-btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 10px 18px;
    border-radius: 0;
    font-size: 0.9375rem;
    font-weight: 600;
    line-height: 1.2;
    cursor: pointer;
    text-decoration: none;
    transition: background-color 0.14s ease, color 0.14s ease, border-color 0.14s ease;
}

.kw-btn-primary {
    border: 1px solid #09080e;
    background: #09080e;
    color: #ffffff;
}

.kw-btn-primary:hover {
    background: #6525ef;
    border-color: #6525ef;
}

.kw-btn-secondary {
    border: 1px solid #09080e;
    background: #ffffff;
    color: #09080e;
}

.kw-btn-secondary:hover {
    background: #f9f8fd;
    border-color: #6525ef;
    color: #6525ef;
}

.kw-btn-primary:focus-visible,
.kw-btn-secondary:focus-visible {
    outline: 2px solid #6525ef;
    outline-offset: 2px;
}

.kw-status {
    margin: 0;
    min-height: 1.3em;
    font-size: 0.875rem;
    color: #4a4754;
}

/* Podgląd karty PNG (4:5, 1080x1350) */
.kw-preview-col {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: stretch;
    min-width: 0;
}

.kw-canvas-frame {
    background: #f9f8fd;
    border: 1px solid var(--lab-line, #d8d5e4);
    border-radius: 0;
    padding: 8px;
}

.kw-canvas {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 4 / 5;
    background: #f9f8fd;
}

.kw-preview-meta {
    margin: 0;
    font-size: 0.8125rem;
    color: #5b5768;
    text-align: center;
}

/* Szuflada Karty Wdrożenia wewnątrz #shareModal (Next Level) */
.kw-modal-trigger-row {
    margin: 12px 0;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.kw-modal-open-btn {
    min-height: 40px;
    padding: 8px 14px;
    border: 1px solid #09080e;
    border-radius: 0;
    background: #f9f8fd;
    color: #09080e;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
}

.kw-modal-open-btn:hover {
    border-color: #6525ef;
    color: #6525ef;
}

.kw-modal-drawer {
    margin: 12px 0 14px;
    padding: 14px;
    background: #f9f8fd;
    border: 1px solid #09080e;
    border-radius: 0;
}

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

.kw-modal-drawer-grid {
    display: grid;
    grid-template-columns: minmax(140px, 190px) minmax(0, 1fr);
    gap: 16px;
    align-items: center;
}

.kw-modal-drawer-copy {
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 0;
}

.kw-modal-drawer-copy p {
    margin: 0;
    font-size: 0.875rem;
    line-height: 1.45;
    color: #322f3d;
}

@media (max-width: 960px) {
    .kw-grid {
        grid-template-columns: 1fr;
    }

    .kw-preview-col {
        max-width: 340px;
        width: 100%;
        margin: 0 auto;
    }
}

@media (max-width: 640px) {
    .kw-section {
        padding: 18px 16px;
    }

    .kw-rating-scale {
        grid-template-columns: repeat(6, minmax(0, 1fr));
    }

    .kw-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .kw-btn-primary,
    .kw-btn-secondary {
        width: 100%;
    }

    .kw-modal-drawer-grid {
        grid-template-columns: 1fr;
    }
}
