* { box-sizing: border-box; }
html, body { height: 100%; }
body {
    margin: 0;
    font-family: var(--font-body);
    color: #0f172a;
    background: var(--bg);
}
:root {
    --bg: #f9f9f9;
    --panel: #ffffff;
    --muted: #64748b;
    --guide-blue-light: #b0c4dc;
    --guide-blue: #285874;
    --guide-blue-dark: #0c2848;
    --guide-red: #c5050c;
    --guide-red-dark: #9b0000;
    --guide-red-darker: #680018;
    --primary: #1f7aa5;
    --primary-700: #155a7c;
    --primary-soft: #eaf7fc;
    --primary-soft-strong: #d3edf8;
    --accent-soft: #fff1f2;
    --success: var(--guide-red);
    --result-accent: var(--guide-red);
    --result-accent-dark: var(--guide-red-dark);
    --result-soft: #fbfdff;
    --border: #e2e8f0;
    --shadow: 0 14px 34px rgba(12, 40, 72, 0.10);
    --font-heading: 'Work Sans', Arial, sans-serif;
    --font-body: Arial, 'Helvetica Neue', Helvetica, sans-serif;
}

h1, h2, h3, h4,
.question-text,
.breadcrumbs {
    font-family: var(--font-heading);
}



#app { display: grid; grid-template-columns: 300px 1fr; min-height: 100vh; }
.sidebar {
    background: var(--panel);
    border-right: 1px solid var(--border);
    padding: 20px;
    position: sticky;
    top: 0;
    align-self: start;
    height: 100vh;
    display: flex;
    flex-direction: column;
}
.brand { display: flex; gap: 12px; align-items: center; margin-bottom: 12px; }
.brand .logo {
    width: 32px; height: 32px; display: grid; place-items: center;
    background: var(--primary-soft); color: var(--primary-700); border-radius: 8px; font-weight: 700;
}
.brand h1 { font-family: var(--font-heading); font-size: 20px; margin: 0; }
.muted { color: var(--muted); font-size: 12px; }
.section-list { display: grid; gap: 6px; overflow: auto; padding-right: 4px; }
.section-pill {
    display: flex; align-items: center; justify-content: space-between;
    background: #f1f5f9; border: 1px solid var(--border); border-radius: 12px;
    padding: 10px 12px; cursor: pointer;
    transition: border-color .15s ease, background .15s ease, color .15s ease, box-shadow .15s ease;
}
.section-pill:hover {
    border-color: var(--guide-blue-light);
    background: var(--primary-soft);
}
.section-pill.active {
    border-color: var(--primary);
    background: var(--primary-soft-strong);
}
.section-pill .count { color: var(--muted); font-size: 12px; }
.section-pill.skipped {
    background: #f0f0f0;
    border-color: #d1d5db;
    opacity: 0.7;
}
.section-pill.skipped .count.skipped-count {
    color: #6b7280;
    font-style: italic;
}
.sidebar-footer { 
    margin-top: auto; 
    padding: 10px 12px;
}

.content { display: grid; grid-template-rows: auto 1fr auto; }
.topbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 5px 24px; border-bottom: 1px solid var(--border); background: var(--panel);
    margin-bottom: 0%;
}
.logo-group { display: flex; align-items: center; gap: 16px; }
.logo-group .wsb-logo { height: 48px; width: auto; }
.logo-group .sbdc-logo { height: 40px; width: auto; }
.progress-wrap.hidden { display: none; }
.breadcrumbs { font-weight: 600; }
.progress-wrap { width: 320px; }
.progress { width: 100%; height: 8px; background: #e2e8f0; border-radius: 999px; overflow: hidden; }
.progress-bar { height: 100%; background: var(--primary); transition: width .25s ease; }
.progress-label { font-size: 12px; color: var(--muted); margin-bottom: 6px; }

.question-area { padding: 24px; }
.question-card {
    background: var(--panel); border: 1px solid var(--border); border-radius: 16px;
    padding: 20px; box-shadow: var(--shadow);
}
.question-meta { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 8px; }
.question-id { font-size: 12px; color: var(--muted); letter-spacing: .04em; }
.type-badge { font-size: 12px; background: #ecfeff; color: #0e7490; padding: 2px 8px; border-radius: 999px; border: 1px solid #a5f3fc; }
.question-text { font-size: 18px; font-weight: 600; margin: 10px 0 16px; }
.note-intro {
    margin: 0 0 16px;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.5;
}
.note-label {
    display: block;
    font-weight: 600;
    margin-bottom: 10px;
}

.section-control-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 12px 14px;
    margin-bottom: 16px;
}

.section-control-bar p {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.45;
}

.section-control-bar .btn {
    white-space: nowrap;
}

.section-kicker {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0;
    margin-bottom: 8px;
}

.section-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.area-note-input {
    width: 100%;
    min-height: 180px;
    resize: vertical;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: 14px;
    font: inherit;
    color: #0f172a;
    background: #f8fafc;
}
.area-note-input:focus {
    outline: 3px solid rgba(176, 196, 220, 0.42);
    border-color: var(--primary);
    background: #ffffff;
}

.tile-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.tile {
    display: grid; gap: 6px; padding: 14px; border: 1px solid var(--border); border-radius: 16px; background: #f8fafc;
    cursor: pointer; text-align: left; transition: transform .05s ease, border-color .15s ease, background .15s ease, box-shadow .15s ease;
}
.tile:hover {
    transform: translateY(-1px);
    border-color: var(--guide-blue-light);
    background: var(--primary-soft);
}
.tile.selected {
    border-color: var(--primary);
    background: var(--primary-soft-strong);
    box-shadow: 0 8px 18px rgba(40, 88, 116, 0.10);
}
.tile .value { font-weight: 700; font-size: 16px; }
.tile .label { font-size: 13px; color: var(--muted); }


.section-info {
    background: #f1f5f9;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 12px;
    margin: 16px 0;
    font-size: 14px;
    color: #475569;
}

.tip { margin-top: 10px; font-size: 12px; color: var(--muted); }

.bottombar {
    display: flex; justify-content: space-between; align-items: center;
    padding: 12px 24px; border-top: 1px solid var(--border); background: var(--panel);
}
.nav-buttons { display: flex; gap: 8px; }
.btn {
    appearance: none; border: 1px solid var(--border); background: #fff; border-radius: 12px;
    padding: 10px 14px; cursor: pointer; font-family: var(--font-heading); font-weight: 700;
}
.btn:hover { border-color: var(--guide-blue-light); }
.btn.primary {
    background: var(--primary);
    color: white;
    border-color: var(--primary-700);
    box-shadow: 0 8px 18px rgba(40, 88, 116, 0.16);
}
.btn.success { background: var(--success); color: white; border-color: var(--guide-red-dark); }
.btn.danger { background: #dc2626; color: white; border-color: #b91c1c; }
.btn.ghost { background: transparent; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.loading { color: var(--muted); }

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(15, 23, 42, 0.42);
    backdrop-filter: blur(4px);
}

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

.modal {
    width: min(100%, 420px);
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: 0 24px 70px rgba(15, 23, 42, 0.22);
    padding: 24px;
}

.modal h2 {
    margin: 0 0 10px;
    font-size: 20px;
}

.modal p {
    margin: 0;
    color: var(--muted);
    line-height: 1.5;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 24px;
}

@media (max-width: 920px) {
    #app { grid-template-columns: 1fr; }
    .sidebar { position: relative; height: auto; }
    .progress-wrap { width: 180px; }
    .section-control-bar {
        align-items: stretch;
        flex-direction: column;
    }
    .modal-actions {
        flex-direction: column-reverse;
    }
    .modal-actions .btn {
        width: 100%;
    }
}
/* ── Loading Screen ──────────────────────────────────────────────────────── */
#loadingScreen {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(248, 250, 252, 0.96);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

#loadingScreen.visible {
    opacity: 1;
    pointer-events: all;
}

.loading-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    text-align: center;
    padding: 48px;
}

.loading-spinner {
    position: relative;
    width: 64px;
    height: 64px;
}

.spinner-ring {
    position: absolute;
    inset: 0;
    border: 3px solid transparent;
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite;
}

.spinner-ring--delay1 {
    inset: 8px;
    border-top-color: var(--guide-blue-light);
    animation-delay: -0.3s;
}

.spinner-ring--delay2 {
    inset: 16px;
    border-top-color: var(--result-accent);
    animation-delay: -0.6s;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.loading-headline {
    font-family: var(--font-heading);
    font-size: 20px;
    font-weight: 700;
    color: #0f172a;
    margin: 0;
}

.loading-sub {
    font-size: 14px;
    color: var(--muted);
    margin: 0;
    min-height: 20px;
    transition: opacity 0.4s ease;
}

.results {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 24px;
    margin: 24px;
    box-shadow: var(--shadow);
}

.action-buttons {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    flex-wrap: wrap;
    border-color: #cbd5e1;
    border-radius: 16px; 
}

.action-buttons button {
    white-space: nowrap;
    padding: 12px 24px;
    border: 2px solid var(--primary);
    border-radius: 12px;
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: white;
    color: var(--primary);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
}

.action-buttons button:hover {
    background: var(--primary);
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 8px 18px rgba(40, 88, 116, 0.24);
}

.action-buttons button:disabled,
.action-buttons button:disabled:hover {
    background: #e5e7eb;
    border-color: #cbd5e1;
    box-shadow: none;
    color: #64748b;
    cursor: not-allowed;
    transform: none;
}

.action-buttons button:active {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(40, 88, 116, 0.25);
}

.action-buttons button#downloadPdfBtn {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.action-buttons button#downloadPdfBtn:hover {
    background: var(--primary-700);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(12, 40, 72, 0.28);
}

.action-buttons button#downloadPdfBtn:disabled,
.action-buttons button#downloadPdfBtn:disabled:hover {
    background: #e5e7eb;
    border-color: #cbd5e1;
    box-shadow: none;
    color: #64748b;
    transform: none;
}

.action-buttons button#bookCall {
    background: var(--result-accent);
    border-color: var(--result-accent);
    color: white;
}

.action-buttons button#bookCall:hover {
    background: var(--result-accent-dark);
    border-color: var(--result-accent-dark);
    transform: translateY(-2px);
    box-shadow: 0 8px 18px rgba(197, 5, 12, 0.24);
}

.question-card .tile:disabled {
    opacity: 0.6;
    pointer-events: none;
}

.results.hidden {
    display: none;
}

.results h2 {
    font-family: var(--font-heading);
    margin-top: 0;
}

.result-block {
    margin-bottom: 20px;
}

.result-block h3 {
    font-family: var(--font-heading);
    margin-bottom: 8px;
}

.recommendations-intro {
    margin: 0 0 14px;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.5;
}

.recommendations-status-text {
    font-weight: 700;
}

.priority-block {
    display: grid;
    gap: 14px;
}

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

.priority-card {
    background: var(--result-soft);
    border: 1px solid #d7e4ef;
    border-top: 4px solid var(--primary);
    border-radius: 8px;
    padding: 16px;
    min-height: 220px;
    box-shadow: 0 10px 22px rgba(12, 40, 72, 0.07);
}

.priority-card--quick_win {
    border-top-color: var(--result-accent);
    background: var(--accent-soft);
}

.priority-label {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0;
    margin-bottom: 8px;
}

.priority-card h4 {
    font-family: var(--font-heading);
    margin: 0 0 10px;
    font-size: 18px;
}

.priority-card p {
    margin: 0 0 12px;
    color: #334155;
    line-height: 1.5;
}

.priority-section {
    margin-bottom: 14px;
}

.priority-section p {
    margin-bottom: 0;
}

.priority-card .priority-step {
    margin-bottom: 0;
}

.full-recommendations.hidden {
    display: none;
}

.recommendation {
    background: var(--result-soft);
    border-left: 4px solid var(--primary);
    padding: 10px 14px;
    margin-bottom: 10px;
    border-radius: 8px;
}

.recommendation-status {
    color: var(--muted);
}

.survey-prompt {
    position: fixed;
    right: 22px;
    bottom: 22px;
    z-index: 1000;
    width: min(360px, calc(100vw - 32px));
    background: var(--panel);
    border: 1px solid var(--guide-blue-light);
    border-top: 5px solid var(--guide-red);
    border-radius: 8px;
    box-shadow: 0 18px 42px rgba(12, 40, 72, 0.22);
    padding: 16px;
}

.survey-prompt__body {
    display: grid;
    gap: 4px;
    margin-bottom: 14px;
}

.survey-prompt__body strong {
    font-family: var(--font-heading);
    font-size: 18px;
    color: var(--guide-blue-dark);
}

.survey-prompt__body span {
    color: #334155;
    font-size: 14px;
    line-height: 1.45;
}

.survey-prompt__actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.survey-prompt__primary {
    border: 0;
    border-radius: 8px;
    background: var(--guide-red);
    color: #ffffff;
    cursor: pointer;
    font-weight: 800;
    min-height: 48px;
    padding: 0 22px;
    box-shadow: 0 10px 18px rgba(197, 5, 12, 0.26);
}

.survey-prompt__primary:hover,
.survey-prompt__primary:focus-visible {
    background: var(--guide-red-dark);
}

.survey-prompt__secondary {
    border: 0;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    font-size: 13px;
    padding: 8px 4px;
}

.survey-prompt__secondary:hover,
.survey-prompt__secondary:focus-visible {
    color: var(--guide-blue-dark);
    text-decoration: underline;
}

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

@media (max-width: 640px) {
    .survey-prompt {
        right: 16px;
        bottom: 16px;
    }

    .survey-prompt__actions {
        align-items: stretch;
        flex-direction: column;
        gap: 6px;
    }

    .survey-prompt__primary {
        width: 100%;
    }
}
