:root {
    --bg: #f4f6f8;
    --surface: #ffffff;
    --surface-soft: #f8fafc;
    --text: #172033;
    --muted: #687386;
    --border: #e2e7ed;
    --accent: #2563eb;
    --accent-soft: #eef4ff;
    --success: #0f8a5f;
    --success-soft: #eaf8f2;
    --warning-soft: #fff7e8;
    --radius: 18px;
    --shadow: 0 10px 30px rgba(23, 32, 51, .055);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    color: var(--text);
    background: var(--bg);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    -webkit-font-smoothing: antialiased;
}
button, input { font: inherit; }
button { cursor: pointer; }

/* --- Górny, prosty pasek procesu --- */
.app-shell { min-height: 100vh; display: block; }
.sidebar {
    width: 100%; min-height: 0; height: auto;
    position: static;
    background: #fff; color: var(--text);
    border-bottom: 1px solid var(--border);
    padding: 14px max(20px, calc((100vw - 1080px) / 2));
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 22px;
    z-index: 20;
}
.brand { display: flex; gap: 10px; align-items: center; white-space: nowrap; }
.brand-mark {
    width: 38px; height: 38px; border-radius: 11px;
    display: grid; place-items: center;
    background: linear-gradient(145deg, #2f72ff, #19a974);
    color: #fff; font-weight: 850;
}
.brand strong { display: block; font-size: 15px; line-height: 1.15; }
.brand span { display: block; margin-top: 2px; color: var(--muted); font-size: 11px; }
.sidebar-intro { display: none; }
.eyebrow { text-transform: uppercase; letter-spacing: .11em; font-size: 10px; font-weight: 850; color: var(--accent); }

.steps-nav {
    min-width: 0;
    display: flex;
    gap: 6px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
    padding: 2px;
}
.steps-nav::-webkit-scrollbar { display: none; }
.step-link {
    flex: 0 0 auto;
    border: 1px solid transparent;
    background: transparent;
    color: #778196;
    border-radius: 11px;
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 7px 9px;
    text-align: left;
    transition: .16s ease;
}
.step-link:hover { background: #f7f9fc; color: var(--text); }
.step-link.is-active { background: var(--accent-soft); border-color: #cddcff; color: #173f9d; }
.step-number {
    width: 26px; height: 26px; flex: 0 0 26px;
    border-radius: 8px; display: grid; place-items: center;
    background: #f0f3f7; color: #657085;
    font-size: 11px; font-weight: 850;
}
.step-link.is-active .step-number { background: var(--accent); color: #fff; }
.step-link.is-complete .step-number { background: var(--success); color: #fff; }
.step-label { font-size: 11px; font-weight: 750; white-space: nowrap; }
.step-state { display: none; }
.sidebar-actions { display: flex; align-items: center; gap: 6px; padding: 0; margin: 0; }
.ghost-btn, .text-btn { border: 0; border-radius: 9px; padding: 9px 11px; white-space: nowrap; }
.ghost-btn { background: #f1f5f9; color: var(--text); font-weight: 750; font-size: 12px; }
.text-btn { background: transparent; color: #8a94a6; font-size: 11px; }
.text-btn.danger:hover { color: #b42318; background: #fff3f2; }

/* --- Nagłówek bieżącego kroku --- */
.main-content { min-width: 0; }
.topbar {
    max-width: 900px;
    min-height: 0;
    margin: 0 auto;
    padding: 30px 24px 14px;
    background: transparent;
    border: 0;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    position: static;
}
.topbar h1 { margin: 5px 0 0; font-size: clamp(22px, 3vw, 30px); letter-spacing: -.025em; }
.mobile-menu { display: none !important; }
.progress-wrap { width: 210px; flex: 0 0 210px; text-align: right; font-size: 11px; color: var(--muted); }
.progress-track { height: 5px; border-radius: 999px; background: #e2e7ed; margin-top: 7px; overflow: hidden; }
.progress-track span { display: block; height: 100%; width: 11%; background: var(--accent); border-radius: inherit; transition: width .2s ease; }

/* --- Jedna karta = jeden krok --- */
.workspace {
    display: block;
    max-width: 900px;
    margin: 0 auto;
    padding: 8px 24px 56px;
}
.step-column { min-width: 0; }
.step-panel {
    display: none;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 22px;
    padding: 30px;
    box-shadow: var(--shadow);
}
.step-panel.is-active { display: block; animation: fadeIn .18s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }
.section-heading { margin-bottom: 6px; padding-bottom: 20px; border-bottom: 1px solid var(--border); }
.section-heading h2 { margin: 5px 0 8px; font-size: clamp(24px, 4vw, 34px); line-height: 1.15; letter-spacing: -.025em; }
.section-heading p { margin: 0; color: var(--muted); max-width: 720px; line-height: 1.6; font-size: 14px; }
.section-kicker { display: inline-block; color: var(--accent); font-weight: 850; font-size: 10px; text-transform: uppercase; letter-spacing: .1em; }

/* Pytania są sekcjami wewnątrz jednej karty, nie osobnymi boxami */
.question-card, .summary-card {
    background: transparent;
    border: 0;
    border-radius: 0;
    padding: 24px 0;
    margin: 0;
    box-shadow: none;
}
.question-card + .question-card,
.summary-card + .question-card { border-top: 1px solid var(--border); }
.question-card h3 { margin: 0 0 14px; font-size: 17px; line-height: 1.35; }
.question-card h4 { margin: 0 0 13px; font-size: 15px; }
.question-card p { color: var(--muted); line-height: 1.55; margin-top: 0; font-size: 14px; }

.choice-grid { display: grid; gap: 9px; }
.choice-grid.two-cols { grid-template-columns: repeat(2, minmax(0,1fr)); }
.choice-row { display: flex; gap: 9px; flex-wrap: wrap; }
.choice-row.three .choice { flex: 1 1 120px; }
.choice {
    border: 1px solid #dbe1e8;
    background: #fff;
    color: var(--text);
    border-radius: 11px;
    min-height: 50px;
    padding: 11px 14px;
    font-weight: 750;
    text-align: left;
    transition: .14s ease;
}
.choice:hover { border-color: #aebfe8; background: #fafcff; }
.choice.is-selected { border-color: var(--accent); background: var(--accent-soft); color: #173f9d; box-shadow: inset 0 0 0 1px var(--accent); }
.choice.small { min-height: 44px; font-size: 13px; }
.nested-choice { margin-top: 12px; }

.reveal { display: none; border-top: 1px dashed #dfe5ec; margin-top: 18px; padding-top: 18px; }
.reveal.is-visible { display: block; }
.mini-checklist, .check-grid { display: grid; gap: 10px; }
.check-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
.mini-checklist label, .check-grid label {
    display: flex; align-items: flex-start; gap: 9px;
    color: #3f4a5e; line-height: 1.45; font-size: 14px;
}
input[type="checkbox"] { width: 18px; height: 18px; margin-top: 1px; accent-color: var(--accent); flex: 0 0 auto; }
.inline-note {
    margin-top: 15px;
    background: #f7f9fc;
    border-left: 3px solid #aeb8c7;
    padding: 12px 14px;
    border-radius: 8px;
    color: #485469;
    line-height: 1.5;
    font-size: 13px;
}
.inline-note.warning { background: var(--warning-soft); border-color: #e5a43a; }
blockquote {
    margin: 14px 0 0;
    padding: 13px 15px;
    background: #f7f9fc;
    border-left: 3px solid var(--accent);
    color: #3c485b;
    border-radius: 8px;
    line-height: 1.55;
    font-size: 14px;
}

.tip-card {
    border-radius: 12px;
    padding: 13px 15px;
    margin: 18px 0 0;
    font-size: 13px;
}
.tip-card p { margin: 4px 0 0; line-height: 1.55; }
.tip-card.sales { background: var(--accent-soft); color: #244572; }
.tip-card.opportunity { background: var(--success-soft); color: #225c4a; }
.tip-card.compact { margin-bottom: 0; }

.knowledge-inline {
    display: flex; flex-wrap: wrap; gap: 7px;
    margin: 20px 0 0;
    padding-top: 20px;
    border-top: 1px solid var(--border);
}
.knowledge-link, .helper-link { border: 0; color: var(--accent); font-weight: 800; }
.knowledge-link {
    background: #f7f9fc;
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 8px 11px;
    font-size: 11px;
}
.knowledge-link:hover { border-color: #b9c8ea; background: var(--accent-soft); }

/* Fiszka jest pomocą po kroku, a nie drugą kolumną */
.helper-column { margin-top: 14px; }
.helper-card {
    background: #edf4ff;
    color: #233b65;
    border: 1px solid #d6e3fb;
    border-radius: 14px;
    padding: 16px 18px;
    box-shadow: none;
}
.helper-card.sticky { position: static; }
.helper-label { color: var(--accent); font-size: 10px; text-transform: uppercase; letter-spacing: .1em; font-weight: 850; }
.helper-card h3 { font-size: 15px; margin: 5px 0 5px; }
.helper-card p { color: #4b6082; line-height: 1.5; font-size: 13px; margin: 0; }
.helper-card .helper-link { color: var(--accent); background: transparent; padding: 8px 0 0; font-size: 12px; }

.materials-grid, .feature-groups, .addon-list { display: block; }
.materials-grid .question-card,
.feature-groups .question-card,
.addon-list .question-card { margin: 0; }
.materials-grid .question-card + .question-card,
.feature-groups .question-card + .question-card,
.addon-list .question-card + .question-card { border-top: 1px solid var(--border); }
.subtle { color: var(--muted); font-size: 12px; margin-top: 11px; }

.step-controls {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-top: 16px;
}
.primary-btn, .secondary-btn {
    min-height: 48px;
    border-radius: 11px;
    padding: 11px 17px;
    font-weight: 800;
    border: 1px solid var(--border);
}
.primary-btn { background: var(--accent); color: #fff; border-color: var(--accent); }
.secondary-btn { background: #fff; color: var(--text); }
.primary-btn:disabled, .secondary-btn:disabled { opacity: .35; cursor: default; }

.finish-card { background: #17243d; color: #fff; border-radius: 13px; padding: 17px; display: grid; gap: 5px; margin-top: 8px; }
.finish-card span { color: #aeb9ca; font-size: 12px; }
.summary-list { display: grid; gap: 8px; }
.summary-row { display: grid; grid-template-columns: 170px 1fr; gap: 12px; padding-bottom: 9px; border-bottom: 1px dashed var(--border); font-size: 13px; }
.summary-row:last-child { border-bottom: 0; }
.summary-row span { color: var(--muted); }
.summary-empty { color: var(--muted); }

/* --- Baza wiedzy jako osobna szuflada --- */
.drawer-overlay { position: fixed; inset: 0; background: rgba(9,16,28,.4); opacity: 0; visibility: hidden; transition: .18s ease; z-index: 40; }
.drawer-overlay.is-open { opacity: 1; visibility: visible; }
.knowledge-drawer {
    position: fixed; right: 0; top: 0; bottom: 0;
    width: min(520px, 100vw);
    background: #fff; z-index: 45;
    transform: translateX(100%); transition: transform .2s ease;
    box-shadow: -18px 0 45px rgba(23,32,51,.14);
    display: flex; flex-direction: column;
}
.knowledge-drawer.is-open { transform: none; }
.drawer-header { padding: 20px 22px 15px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: flex-start; }
.drawer-header h2 { margin: 5px 0 0; font-size: 22px; }
.close-drawer { border: 0; background: #f1f5f9; width: 38px; height: 38px; border-radius: 10px; font-size: 22px; }
.knowledge-search-wrap { padding: 13px 22px; border-bottom: 1px solid var(--border); }
.knowledge-search-wrap input { width: 100%; border: 1px solid var(--border); border-radius: 10px; padding: 12px 13px; outline: none; }
.knowledge-search-wrap input:focus { border-color: #9cb5ed; box-shadow: 0 0 0 3px #eef4ff; }
.knowledge-content { overflow-y: auto; padding: 18px 22px 34px; }
.knowledge-list { display: grid; gap: 9px; }
.knowledge-item { border: 1px solid var(--border); border-radius: 12px; padding: 14px; background: #fff; }
.knowledge-item h3 { margin: 0 0 5px; font-size: 15px; }
.knowledge-item p { margin: 0; color: var(--muted); line-height: 1.5; font-size: 13px; }
.knowledge-item button { border: 0; background: transparent; color: var(--accent); font-weight: 800; padding: 8px 0 0; font-size: 12px; }
.knowledge-detail h3 { margin: 0 0 16px; font-size: 22px; }
.knowledge-block { margin-bottom: 18px; }
.knowledge-block span { display: block; color: var(--accent); font-size: 10px; text-transform: uppercase; letter-spacing: .09em; font-weight: 850; margin-bottom: 5px; }
.knowledge-block p { margin: 0; color: #4d596c; line-height: 1.6; font-size: 14px; }
.client-script { background: var(--accent-soft); border-radius: 11px; padding: 14px; color: #244572; }
.back-knowledge { border: 0; background: #f1f5f9; border-radius: 9px; padding: 8px 10px; margin-bottom: 14px; font-weight: 750; }
.no-results { color: var(--muted); text-align: center; padding: 30px 0; }

/* --- Tablet / mobile --- */
@media (max-width: 960px) {
    .sidebar {
        grid-template-columns: auto minmax(0, 1fr);
        gap: 12px 16px;
        padding: 12px 16px 10px;
    }
    .steps-nav { grid-column: 1 / -1; order: 3; }
    .sidebar-actions { margin-left: auto; }
    .step-label { font-size: 10px; }
    .topbar { padding: 24px 18px 12px; }
    .workspace { padding: 6px 18px 42px; }
}

@media (max-width: 640px) {
    body { background: #f6f7f9; padding-bottom: 78px; }
    .sidebar {
        padding: 10px 12px 9px;
        gap: 9px 12px;
        position: sticky;
        top: 0;
        z-index: 25;
        box-shadow: 0 2px 12px rgba(23,32,51,.045);
    }
    .brand-mark { width: 34px; height: 34px; border-radius: 9px; }
    .brand strong { font-size: 13px; }
    .brand span { display: none; }
    .sidebar-actions .text-btn { display: none; }
    .ghost-btn { padding: 8px 9px; font-size: 11px; }
    .steps-nav { gap: 5px; margin: 0 -2px; }
    .step-link { padding: 5px; border-radius: 9px; gap: 0; }
    .step-number { width: 31px; height: 31px; flex-basis: 31px; border-radius: 9px; font-size: 12px; }
    .step-label { display: none; }

    .topbar { padding: 18px 14px 10px; align-items: flex-start; gap: 12px; }
    .topbar .eyebrow { font-size: 9px; }
    .topbar h1 { font-size: 20px; line-height: 1.2; }
    .progress-wrap { width: 82px; flex: 0 0 82px; padding-top: 4px; }
    .progress-track { margin-top: 6px; }

    .workspace { padding: 4px 10px 18px; }
    .step-panel { border-radius: 16px; padding: 20px 16px 18px; box-shadow: 0 5px 20px rgba(23,32,51,.045); }
    .section-heading { padding-bottom: 17px; }
    .section-heading h2 { font-size: 23px; }
    .section-heading p { font-size: 13px; line-height: 1.5; }
    .question-card, .summary-card { padding: 20px 0; }
    .question-card h3 { font-size: 16px; margin-bottom: 12px; }
    .question-card p { font-size: 13px; }

    .choice-grid.two-cols { grid-template-columns: 1fr; }
    .choice-row, .choice-row.three { display: grid; grid-template-columns: 1fr; }
    .choice, .choice.small { width: 100%; min-height: 50px; padding: 12px 13px; font-size: 14px; }
    .check-grid { grid-template-columns: 1fr; }
    .mini-checklist label, .check-grid label { min-height: 28px; font-size: 14px; }

    .helper-column { margin-top: 10px; }
    .helper-card { padding: 14px 15px; border-radius: 12px; }
    .helper-card h3 { font-size: 14px; }
    .helper-card p { font-size: 12px; }
    .helper-link { min-height: 36px; }

    .knowledge-inline { gap: 6px; }
    .knowledge-link { padding: 8px 10px; }

    .step-controls {
        position: fixed;
        left: 0; right: 0; bottom: 0;
        z-index: 30;
        margin: 0;
        padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
        background: rgba(255,255,255,.96);
        backdrop-filter: blur(10px);
        border-top: 1px solid var(--border);
        box-shadow: 0 -5px 20px rgba(23,32,51,.06);
    }
    .primary-btn, .secondary-btn { flex: 1; min-height: 50px; padding: 11px 10px; font-size: 13px; }
    .summary-row { grid-template-columns: 1fr; gap: 3px; }

    .knowledge-drawer { width: 100%; }
    .drawer-header { padding: 16px 16px 12px; }
    .knowledge-search-wrap { padding: 11px 16px; }
    .knowledge-content { padding: 15px 16px 28px; }
}
