/* =====================================================================
   Contextual help: floating button + side drawer (ClientApp/Shell/Help.ts)
   Tokens only (see DESIGN_GUIDE 4c) - works in all 6 themes, RTL/LTR.
   Button: bottom inline-end corner, lifted above a visible sticky action
   bar through --erp-help-lift (set by Help.ts).
   ===================================================================== */

@media screen {

.erp-help-fab {
    --erp-help-size: 48px;
    position: fixed;
    inset-inline-end: 20px;
    bottom: calc(20px + var(--erp-help-lift, 0px) + env(safe-area-inset-bottom, 0px));
    z-index: 1034; /* under the mobile sidebar (1035/1040) and modals (1200) */
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: var(--erp-help-size);
    height: var(--erp-help-size);
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: var(--erp-primary);
    color: var(--erp-on-primary);
    box-shadow: var(--erp-shadow-lg);
    cursor: pointer;
    font: inherit;
    transition: bottom .2s ease, transform .15s ease, background-color .15s ease, box-shadow .15s ease;
    -webkit-tap-highlight-color: transparent;
}
.erp-help-fab > .fa { font-size: 24px; line-height: 1; }
.erp-help-fab:hover { background: var(--erp-primary-hover); transform: translateY(-2px); }
.erp-help-fab:active { transform: translateY(0); background: var(--erp-primary-active, var(--erp-primary-hover)); }
.erp-help-fab:focus { outline: none; }
.erp-help-fab:focus-visible { box-shadow: var(--erp-focus), var(--erp-shadow-lg); }

/* Tooltip label (shown on hover / keyboard focus, towards the inline-start side) */
.erp-help-fab__label {
    position: absolute;
    inset-inline-end: calc(100% + 10px);
    top: 50%;
    transform: translateY(-50%);
    padding: 5px 10px;
    border-radius: var(--erp-radius-sm);
    background: var(--erp-toast-bg, var(--erp-gray-900));
    color: var(--erp-toast-text, var(--erp-gray-0));
    font-size: 13px;
    font-weight: 600;
    line-height: 1.4;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity .15s ease, visibility .15s ease;
}
.erp-help-fab:hover .erp-help-fab__label,
.erp-help-fab:focus-visible .erp-help-fab__label { opacity: 1; visibility: visible; }

/* Hide the button while the drawer is open */
html.erp-help-open .erp-help-fab { visibility: hidden; }

/* ---------------------------------------------------------------- drawer */
.erp-help-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1250; /* above modals (1200) so help also works over a dialog */
    background: var(--erp-overlay, rgba(15, 23, 42, .45));
    opacity: 0;
    transition: opacity .25s ease;
}
.erp-help-backdrop.is-open { opacity: 1; }
.erp-help-backdrop[hidden], .erp-help[hidden] { display: none !important; }

.erp-help {
    position: fixed;
    top: 0;
    bottom: 0;
    inset-inline-end: 0;
    z-index: 1260;
    display: flex;
    flex-direction: column;
    width: min(440px, 100vw);
    max-width: 100vw;
    background: var(--erp-surface);
    color: var(--erp-text);
    border-inline-start: 1px solid var(--erp-border);
    box-shadow: var(--erp-shadow-lg);
    font-family: var(--erp-font, inherit);
    text-align: start;
    transform: translateX(100%);
    transition: transform .26s cubic-bezier(.2, .8, .2, 1);
    outline: none;
}
.erp-help[dir="rtl"] { transform: translateX(-100%); }
.erp-help.is-open { transform: translateX(0); }

.erp-help__header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 18px;
    border-block-end: 1px solid var(--erp-border);
    background: var(--erp-surface);
}
.erp-help__icon {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--erp-radius);
    background: var(--erp-primary-50);
    color: var(--erp-primary-text);
    font-size: 22px;
}
.erp-help__titles { flex: 1 1 auto; min-width: 0; }
.erp-help__eyebrow {
    font-size: 12px;
    font-weight: 600;
    color: var(--erp-text-muted);
    line-height: 1.3;
}
#erpHelpDrawer .erp-help__title { /* id: wins over legacy h2 rules (Nicepage / login styles) */
    margin: 2px 0 0;
    padding: 0;
    font-size: 18px !important;
    font-weight: 700;
    line-height: 1.35 !important;
    letter-spacing: 0;
    color: var(--erp-text);
    overflow-wrap: anywhere;
}
.erp-help__close {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 1px solid transparent;
    border-radius: var(--erp-radius-sm);
    background: transparent;
    color: var(--erp-text-muted);
    font-size: 18px;
    cursor: pointer;
}
.erp-help__close:hover { background: var(--erp-gray-100); color: var(--erp-text); }
.erp-help__close:focus { outline: none; }
.erp-help__close:focus-visible { box-shadow: var(--erp-focus); }

.erp-help__body {
    flex: 1 1 auto;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 16px 18px 24px;
    outline: none;
}
.erp-help__purpose {
    margin: 0 0 16px;
    font-size: 14.5px;
    line-height: 1.75;
    color: var(--erp-text);
}
.erp-help__notice {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    margin: 0 0 14px;
    padding: 10px 12px;
    border-radius: var(--erp-radius-sm);
    background: var(--erp-info-bg);
    color: var(--erp-info);
    font-size: 13.5px;
    line-height: 1.6;
}
.erp-help__notice .fa { margin-top: 3px; }

.erp-help__section { margin: 0 0 18px; }
.erp-help__h {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 10px;
    font-size: 14px;
    font-weight: 700;
    color: var(--erp-primary-text);
}
.erp-help__h .fa { width: 16px; text-align: center; }

.erp-help__steps {
    margin: 0;
    padding: 0;
    list-style: none;
    counter-reset: erp-help-step;
}
.erp-help__steps li {
    position: relative;
    margin: 0 0 8px;
    padding-inline-start: 34px;
    min-height: 24px;
    font-size: 14px;
    line-height: 1.7;
    counter-increment: erp-help-step;
}
.erp-help__steps li::before {
    content: counter(erp-help-step);
    position: absolute;
    inset-inline-start: 0;
    top: 1px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--erp-primary-50);
    color: var(--erp-primary-text);
    font-size: 12px;
    font-weight: 700;
}

.erp-help__dl { margin: 0; border: 1px solid var(--erp-border); border-radius: var(--erp-radius-sm); overflow: hidden; }
.erp-help__dl-row { padding: 9px 12px; border-block-end: 1px solid var(--erp-border); }
.erp-help__dl-row:last-child { border-block-end: 0; }
.erp-help__dl-row:nth-child(even) { background: var(--erp-gray-25, var(--erp-bg)); }
.erp-help__dl dt { margin: 0; font-size: 13.5px; font-weight: 700; color: var(--erp-text); line-height: 1.5; }
.erp-help__dl dd { margin: 2px 0 0; font-size: 13.5px; color: var(--erp-text-muted); line-height: 1.65; }

.erp-help__tips { margin: 0; padding: 0; list-style: none; }
.erp-help__tips li {
    position: relative;
    margin: 0 0 8px;
    padding: 8px 12px;
    padding-inline-start: 14px;
    border-inline-start: 3px solid var(--erp-warning-solid, var(--erp-warning));
    border-radius: var(--erp-radius-sm);
    background: var(--erp-warning-bg);
    color: var(--erp-text);
    font-size: 13.5px;
    line-height: 1.65;
}

.erp-help__related { display: flex; flex-wrap: wrap; gap: 8px; }
.erp-help__chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 32px;
    padding: 4px 12px;
    border: 1px solid var(--erp-primary-200);
    border-radius: 999px;
    background: var(--erp-primary-50);
    color: var(--erp-primary-text);
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    text-align: start;
}
.erp-help__chip:hover { background: var(--erp-primary-100); color: var(--erp-primary-text-hover, var(--erp-primary-text)); }
.erp-help__chip:focus { outline: none; }
.erp-help__chip:focus-visible { box-shadow: var(--erp-focus); }
.erp-help__chip-icon { font-size: 11px; opacity: .8; }
[dir="rtl"] .erp-help__chip-icon { transform: scaleX(-1); }
.erp-help__chip.is-disabled {
    cursor: default;
    border-color: var(--erp-border);
    background: transparent;
    color: var(--erp-text-muted);
}

.erp-help__footer {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    padding: 10px 18px;
    border-block-start: 1px solid var(--erp-border);
    font-size: 12px;
    color: var(--erp-text-muted);
}
.erp-help__footer kbd {
    display: inline-block;
    min-width: 22px;
    padding: 1px 6px;
    border: 1px solid var(--erp-border);
    border-block-end-width: 2px;
    border-radius: 4px;
    background: var(--erp-bg);
    color: var(--erp-text);
    font-family: inherit;
    font-size: 11px;
    font-weight: 700;
    text-align: center;
}

.erp-help__loading, .erp-help__empty {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 24px 4px;
    color: var(--erp-text-muted);
    font-size: 14px;
}
.erp-help__spinner {
    width: 18px;
    height: 18px;
    border: 2px solid var(--erp-gray-200);
    border-top-color: var(--erp-primary);
    border-radius: 50%;
    animation: erp-help-spin .8s linear infinite;
}
@keyframes erp-help-spin { to { transform: rotate(360deg); } }

/* Phones */
@media (max-width: 575.98px) {
    .erp-help-fab { --erp-help-size: 44px; inset-inline-end: 14px; bottom: calc(14px + var(--erp-help-lift, 0px) + env(safe-area-inset-bottom, 0px)); }
    .erp-help-fab > .fa { font-size: 22px; }
    .erp-help { width: 100vw; border-inline-start: 0; }
    .erp-help__header, .erp-help__body, .erp-help__footer { padding-inline: 16px; }
    /* Keep the last row of content (e.g. report footer Print PDF/Excel) clear of the help button */
    .Page_Partial, #htmlContainer { padding-block-end: 72px; }
    /* same specificity as the erp-theme shell rule that sets `padding: var(--erp-gutter)` on these
       containers (it has ids, so the plain rule above lost and the button still covered #PrintPdf) */
    #erpSidebar:not(.display_none) ~ #carousel_47a3 > #htmlContainer,
    #erpSidebar:not(.display_none) ~ #carousel_47a3 > .Page_Partial { padding-block-end: calc(var(--erp-gutter, 16px) + 72px); }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .erp-help-fab, .erp-help, .erp-help-backdrop { transition: none; }
    .erp-help-fab:hover { transform: none; }
    .erp-help__spinner { animation-duration: 2s; }
}

} /* @media screen */

@media print {
    .erp-help-fab, .erp-help, .erp-help-backdrop { display: none !important; }
}
