/* ═══════════════════════════════════════════════════════════════════
   Guidance UI – shared styles for PageHelpDrawer, HelpCenterShell,
   GuidedTourOverlay.  Extracted from inline <style> blocks to avoid
   duplicate render when GuidanceSurfaceHost mounts multiple layers.
   ═══════════════════════════════════════════════════════════════════ */

/* ── PageHelpDrawer ─────────────────────────────────────────────── */

.guide-drawer-backdrop {
    position: fixed;
    inset: 0;
    z-index: calc(var(--z-modal) + 10);
    background: rgba(15, 23, 42, 0.36);
}

.guide-drawer {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: min(480px, 100%);
    height: 100vh;
    height: 100dvh;
    background: var(--color-bg-surface);
    border-left: 1px solid var(--color-border);
    box-shadow: var(--sh-lg);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.guide-drawer__header,
.guide-drawer__footer {
    padding: var(--sp-5);
    border-bottom: 1px solid var(--color-border);
}

.guide-drawer__footer {
    border-top: 1px solid var(--color-border);
    border-bottom: none;
    margin-top: auto;
    display: flex;
    justify-content: space-between;
    gap: var(--sp-3);
    flex-wrap: wrap;
}

.guide-drawer__eyebrow {
    font-size: 11px;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--color-fg-muted);
    font-weight: var(--fw-semibold);
    margin-bottom: 6px;
}

.guide-drawer__title {
    font-size: var(--fs-xl);
    font-weight: var(--fw-bold);
    color: var(--color-fg);
    margin: 0;
}

.guide-drawer__subtitle {
    margin-top: var(--sp-2);
    font-size: var(--fs-sm);
    color: var(--color-fg-muted);
    line-height: var(--lh-relaxed);
}

.guide-drawer__body {
    flex: 1 1 auto;
    min-height: 0;
    padding: var(--sp-5);
    overflow-y: auto;
    overscroll-behavior: contain;
    display: flex;
    flex-direction: column;
    gap: var(--sp-5);
}

.guide-drawer__chips {
    display: flex;
    flex-wrap: wrap;
    gap: var(--sp-2);
}

.guide-drawer__chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: var(--r-full);
    border: 1px solid var(--color-border);
    background: var(--color-bg-app);
    color: var(--color-fg-muted);
    font-size: 11px;
}

.guide-drawer__section-title {
    font-size: var(--fs-sm);
    font-weight: var(--fw-semibold);
    color: var(--color-fg);
    margin-bottom: var(--sp-2);
}

.guide-drawer__box {
    padding: var(--sp-4);
    border: 1px solid var(--color-border);
    border-radius: var(--r-lg);
    background: var(--color-bg-app);
}

.guide-drawer__markdown,
.guide-drawer__suggested-actions {
    color: var(--color-fg);
    font-size: var(--fs-sm);
    line-height: var(--lh-relaxed);
}

.guide-drawer__markdown p,
.guide-drawer__suggested-actions p {
    margin: 0 0 var(--sp-2);
}

.guide-drawer__markdown p:last-child,
.guide-drawer__suggested-actions p:last-child {
    margin-bottom: 0;
}

.guide-drawer__markdown h1,
.guide-drawer__markdown h2,
.guide-drawer__markdown h3,
.guide-drawer__markdown h4 {
    margin: 0 0 var(--sp-2);
    color: var(--color-fg);
    line-height: 1.4;
    font-weight: var(--fw-semibold);
}

.guide-drawer__markdown h1 {
    font-size: var(--fs-lg);
}

.guide-drawer__markdown h2,
.guide-drawer__markdown h3,
.guide-drawer__markdown h4,
.guide-drawer__suggested-actions strong {
    font-size: var(--fs-md);
}

.guide-drawer__suggested-actions strong {
    display: inline-block;
    font-weight: var(--fw-semibold);
    color: var(--color-fg);
}

.guide-drawer__markdown ol,
.guide-drawer__markdown ul,
.guide-drawer__suggested-actions ol {
    margin: 0;
    padding-left: 1.25rem;
    list-style-type: disc;
}

.guide-drawer__markdown li,
.guide-drawer__suggested-actions li {
    margin: 0;
    padding-left: 0;
}

.guide-drawer__markdown li + li,
.guide-drawer__suggested-actions li + li {
    margin-top: 6px;
}

.guide-drawer__steps {
    margin: 0;
    padding-left: 18px;
    color: var(--color-fg);
    font-size: var(--fs-sm);
}

.guide-drawer__steps li + li {
    margin-top: 8px;
}

.guide-drawer__playbook-list,
.guide-drawer__field-help-list {
    display: flex;
    flex-direction: column;
    gap: var(--sp-3);
}

.guide-drawer__playbook-card,
.guide-drawer__field-help-card {
    padding: var(--sp-4);
    border: 1px solid var(--color-border);
    border-radius: var(--r-lg);
    background: var(--color-bg-app);
}

.guide-drawer__playbook-title,
.guide-drawer__field-help-title {
    margin: 0;
    font-size: var(--fs-md);
    font-weight: var(--fw-semibold);
    color: var(--color-fg);
}

.guide-drawer__playbook-summary,
.guide-drawer__field-help-summary {
    margin-top: var(--sp-2);
    font-size: var(--fs-sm);
    color: var(--color-fg-muted);
    line-height: var(--lh-relaxed);
}

.guide-drawer__playbook-grid {
    margin-top: var(--sp-3);
    display: grid;
    gap: var(--sp-3);
}

.guide-drawer__playbook-block-title {
    margin: 0 0 var(--sp-2);
    font-size: var(--fs-xs);
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--color-fg-muted);
}

.guide-drawer__playbook-list-items {
    margin: 0;
    padding-left: 18px;
    color: var(--color-fg);
    font-size: var(--fs-sm);
    line-height: var(--lh-relaxed);
    list-style-type: disc;
}

.guide-drawer__playbook-list-items li + li {
    margin-top: 6px;
}

.guide-drawer__links {
    display: flex;
    flex-wrap: wrap;
    gap: var(--sp-2);
}

.guide-drawer__link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: var(--r-md);
    background: rgba(99, 102, 241, 0.08);
    border: 1px solid rgba(99, 102, 241, 0.14);
    color: var(--p-indigo-700, #4338ca);
    font-size: var(--fs-xs);
    text-decoration: none;
    cursor: pointer;
}

.guide-drawer__empty,
.guide-drawer__loading {
    font-size: var(--fs-sm);
    color: var(--color-fg-muted);
}

.guide-drawer__header-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--sp-3);
}

.guide-drawer__close {
    min-width: 44px;
    min-height: 44px;
    flex: 0 0 auto;
}

@media (max-width: 768px) {
    .guide-drawer {
        width: 100%;
        height: 100dvh;
        border-top: 1px solid var(--color-border);
        border-left: none;
        border-radius: 0;
    }

    .guide-drawer__header,
    .guide-drawer__footer,
    .guide-drawer__body {
        padding: var(--sp-4);
    }

    .guide-drawer__footer .btn {
        min-height: 44px;
        flex: 1 1 148px;
    }
}

@media (max-width: 420px) {
    .guide-drawer {
        height: 100dvh;
    }

    .guide-drawer__footer {
        flex-direction: column-reverse;
    }

    .guide-drawer__footer .btn {
        width: 100%;
    }
}

/* ── HelpCenterShell ────────────────────────────────────────────── */

.guide-center-backdrop {
    position: fixed;
    inset: 0;
    z-index: calc(var(--z-modal) + 15);
    background: rgba(15, 23, 42, 0.48);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: calc(var(--topbar-h) + var(--sp-4)) var(--sp-6) var(--sp-6);
}

.guide-center {
    width: min(1080px, 100%);
    max-height: calc(100vh - var(--topbar-h) - var(--sp-8));
    background: var(--color-bg-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--r-2xl, 24px);
    box-shadow: var(--sh-lg);
    display: grid;
    grid-template-columns: minmax(280px, 320px) minmax(0, 1fr);
    overflow: hidden;
}

.guide-center__sidebar {
    border-right: 1px solid var(--color-border);
    background: linear-gradient(180deg, rgba(248, 250, 252, .98), rgba(238, 242, 255, .72));
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.guide-center__header {
    padding: var(--sp-5);
    border-bottom: 1px solid var(--color-border);
}

.guide-center__eyebrow {
    font-size: 11px;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--color-fg-muted);
    font-weight: var(--fw-semibold);
    margin-bottom: 6px;
}

.guide-center__title {
    margin: 0;
    font-size: var(--fs-xl);
    font-weight: var(--fw-bold);
    color: var(--color-fg);
}

.guide-center__subtitle {
    margin-top: var(--sp-2);
    font-size: var(--fs-sm);
    color: var(--color-fg-muted);
    line-height: var(--lh-relaxed);
}

.guide-center__sidebar-body {
    padding: var(--sp-5);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: var(--sp-4);
}

.guide-center__card {
    padding: var(--sp-4);
    border-radius: var(--r-lg);
    border: 1px solid var(--color-border);
    background: rgba(255, 255, 255, .88);
}

.guide-center__meta {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--sp-2);
}

.guide-center__meta-item {
    font-size: var(--fs-xs);
    color: var(--color-fg-muted);
}

.guide-center__anchor-list {
    display: flex;
    flex-direction: column;
    gap: var(--sp-2);
}

.guide-center__anchor-link {
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 100%;
    text-align: left;
    padding: var(--sp-3);
    border-radius: var(--r-md);
    border: 1px solid var(--color-border);
    background: var(--color-bg-surface);
    color: var(--color-fg);
    text-decoration: none;
    cursor: pointer;
}

.guide-center__anchor-link--active {
    border-color: rgba(99, 102, 241, .28);
    background: rgba(99, 102, 241, .08);
    color: var(--p-indigo-700, #4338ca);
}

.guide-center__anchor-desc {
    font-size: var(--fs-xs);
    color: var(--color-fg-muted);
}

.guide-center__content {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.guide-center__content-head {
    padding: var(--sp-5);
    border-bottom: 1px solid var(--color-border);
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--sp-3);
    flex-wrap: wrap;
}

.guide-center__content-body {
    padding: var(--sp-5);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: var(--sp-5);
}

.guide-center__section-title {
    font-size: var(--fs-sm);
    font-weight: var(--fw-semibold);
    color: var(--color-fg);
    margin-bottom: var(--sp-2);
}

.guide-center__steps {
    margin: 0;
    padding-left: 18px;
    color: var(--color-fg);
    font-size: var(--fs-sm);
}

.guide-center__steps li + li {
    margin-top: 8px;
}

.guide-center__empty {
    font-size: var(--fs-sm);
    color: var(--color-fg-muted);
}

@media (max-width: 920px) {
    .guide-center-backdrop {
        padding: calc(var(--topbar-h) + var(--sp-3)) var(--sp-3) var(--sp-3);
    }

    .guide-center {
        grid-template-columns: 1fr;
        max-height: calc(100vh - var(--topbar-h) - var(--sp-6));
    }

    .guide-center__sidebar {
        border-right: none;
        border-bottom: 1px solid var(--color-border);
        max-height: 34dvh;
    }
}

@media (max-width: 640px) {
    .guide-center-backdrop {
        align-items: flex-end;
        padding: 0;
    }

    .guide-center {
        width: 100%;
        height: min(92dvh, 820px);
        max-height: 92dvh;
        border-right: none;
        border-bottom: none;
        border-left: none;
        border-radius: var(--r-2xl, 24px) var(--r-2xl, 24px) 0 0;
    }

    .guide-center__header,
    .guide-center__sidebar-body,
    .guide-center__content-head,
    .guide-center__content-body {
        padding: var(--sp-4);
    }

    .guide-center__content-head .btn {
        min-height: 44px;
        flex: 1 1 148px;
    }
}

/* ── GuidedTourOverlay ──────────────────────────────────────────── */

.guide-tour-backdrop {
    position: fixed;
    inset: 0;
    z-index: calc(var(--z-modal) + 20);
    background: rgba(15, 23, 42, 0.56);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: calc(var(--topbar-h) + var(--sp-4)) var(--sp-5) var(--sp-5);
}

.guide-tour {
    width: min(840px, 100%);
    max-height: calc(100vh - var(--topbar-h) - var(--sp-8));
    border-radius: var(--r-2xl, 24px);
    border: 1px solid rgba(148, 163, 184, .22);
    background: linear-gradient(180deg, rgba(255,255,255,.98), rgba(248,250,252,.96));
    box-shadow: var(--sh-lg);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.guide-tour__head,
.guide-tour__foot {
    padding: var(--sp-5);
    border-bottom: 1px solid var(--color-border);
}

.guide-tour__foot {
    border-bottom: none;
    border-top: 1px solid var(--color-border);
    display: flex;
    justify-content: space-between;
    gap: var(--sp-3);
    flex-wrap: wrap;
}

.guide-tour__eyebrow {
    font-size: 11px;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--color-fg-muted);
    font-weight: var(--fw-semibold);
    margin-bottom: 6px;
}

.guide-tour__title {
    margin: 0;
    font-size: clamp(1.1rem, 2vw, 1.35rem);
    font-weight: var(--fw-bold);
    color: var(--color-fg);
}

.guide-tour__subtitle {
    margin-top: var(--sp-2);
    color: var(--color-fg-muted);
    font-size: var(--fs-sm);
    line-height: var(--lh-relaxed);
}

.guide-tour__progress {
    margin-top: var(--sp-4);
}

.guide-tour__progress-label {
    display: flex;
    justify-content: space-between;
    gap: var(--sp-3);
    font-size: var(--fs-xs);
    color: var(--color-fg-muted);
}

.guide-tour__progress-bar {
    height: 8px;
    border-radius: var(--r-full);
    background: rgba(148, 163, 184, .2);
    overflow: hidden;
    margin-top: 8px;
}

.guide-tour__progress-bar span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, rgb(79 70 229), rgb(16 185 129));
}

.guide-tour__body {
    padding: var(--sp-5);
    display: grid;
    grid-template-columns: minmax(0, 1fr) 280px;
    gap: var(--sp-4);
    overflow: auto;
    min-height: 0;
}

.guide-tour__step-card {
    padding: var(--sp-5);
    border-radius: var(--r-xl);
    border: 1px solid rgba(99, 102, 241, .14);
    background: rgba(238, 242, 255, .46);
    align-self: start;
}

.guide-tour__step-label {
    font-size: 11px;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--p-indigo-700, #4338ca);
    font-weight: var(--fw-semibold);
    margin-bottom: 8px;
}

.guide-tour__step-title {
    font-size: var(--fs-lg);
    font-weight: var(--fw-bold);
    color: var(--color-fg);
}

.guide-tour__step-summary {
    margin-top: var(--sp-2);
    color: var(--color-fg-muted);
    line-height: var(--lh-relaxed);
}

.guide-tour__step-meta {
    display: flex;
    flex-wrap: wrap;
    gap: var(--sp-2);
    margin-top: var(--sp-3);
}

.guide-tour__chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: var(--r-full);
    background: rgba(255,255,255,.9);
    border: 1px solid rgba(99,102,241,.12);
    font-size: var(--fs-xs);
    color: var(--color-fg-muted);
}

.guide-tour__side {
    display: flex;
    flex-direction: column;
    gap: var(--sp-3);
    min-height: 0;
}

.guide-tour__side-title {
    font-size: var(--fs-xs);
    font-weight: var(--fw-semibold);
    color: var(--color-fg-muted);
    letter-spacing: .08em;
    text-transform: uppercase;
}

.guide-tour__step-list {
    display: grid;
    gap: var(--sp-2);
    overflow-y: auto;
    padding-right: 2px;
}

.guide-tour__step-item {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: var(--sp-3);
    padding: var(--sp-3);
    border-radius: var(--r-md);
    border: 1px solid var(--color-border);
    background: rgba(255,255,255,.84);
}

.guide-tour__step-item--active {
    border-color: rgba(79, 70, 229, .3);
    background: rgba(238, 242, 255, .78);
}

.guide-tour__step-item--done {
    border-color: rgba(16, 185, 129, .2);
    background: rgba(236, 253, 245, .72);
}

.guide-tour__index {
    width: 24px;
    height: 24px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(99,102,241,.12);
    color: var(--p-indigo-700, #4338ca);
    font-size: 11px;
    font-weight: var(--fw-bold);
}

.guide-tour__step-item--done .guide-tour__index {
    background: rgba(16,185,129,.14);
    color: rgb(5 150 105);
}

.guide-tour__step-item-title {
    font-size: var(--fs-sm);
    font-weight: var(--fw-semibold);
    color: var(--color-fg);
    line-height: var(--lh-snug);
}

@media (max-width: 820px) {
    .guide-tour-backdrop {
        padding: calc(var(--topbar-h) + var(--sp-3)) var(--sp-3) var(--sp-3);
    }

    .guide-tour {
        max-height: calc(100vh - var(--topbar-h) - var(--sp-6));
    }

    .guide-tour__body {
        grid-template-columns: 1fr;
    }

    .guide-tour__step-list {
        max-height: 220px;
    }

    .guide-tour__foot {
        flex-direction: column;
    }

    .guide-tour__foot .row {
        width: 100%;
        justify-content: space-between;
    }

    .guide-tour__foot .btn {
        min-height: 44px;
    }
}

@media (max-width: 560px) {
    .guide-tour-backdrop {
        align-items: flex-end;
        padding: 0;
    }

    .guide-tour {
        width: 100%;
        height: min(90dvh, 760px);
        max-height: 90dvh;
        border-right: none;
        border-bottom: none;
        border-left: none;
        border-radius: var(--r-2xl, 24px) var(--r-2xl, 24px) 0 0;
    }

    .guide-tour__head,
    .guide-tour__body,
    .guide-tour__foot,
    .guide-tour__step-card {
        padding: var(--sp-4);
    }

    .guide-tour__progress-label {
        align-items: flex-start;
        flex-direction: column;
        gap: 4px;
    }

    .guide-tour__foot .row {
        flex-direction: column-reverse;
    }

    .guide-tour__foot .btn,
    .guide-tour__foot .row {
        width: 100%;
    }
}
