:root {
    --erp-help-navy: #0b1220;
    --erp-help-navy-soft: #16233a;
    --erp-help-blue: #0ea5e9;
    --erp-help-teal: #14b8a6;
    --erp-help-text: #0f172a;
    --erp-help-muted: #64748b;
    --erp-help-line: #e2e8f0;
    --erp-help-surface: #ffffff;
    --erp-help-surface-soft: #f8fafc;
    --erp-help-success: #16a34a;
    --erp-help-radius: 14px;
}

/* ---------- Floating help button ---------- */

.erp-help-fab {
    display: none !important;
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 19000;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 18px 12px 14px;
    border: 0;
    border-radius: 999px;
    cursor: pointer;
    color: #fff;
    font: 600 0.9rem/1 'Helvetica Neue', Helvetica, Arial, sans-serif;
    background: linear-gradient(135deg, #0ea5e9 0%, #2563eb 55%, #14b8a6 100%);
    box-shadow: 0 12px 30px rgba(14, 116, 233, 0.35), 0 2px 6px rgba(15, 23, 42, 0.18);
    transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.erp-help-fab:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 18px 38px rgba(14, 116, 233, 0.42), 0 3px 8px rgba(15, 23, 42, 0.2);
}

.erp-help-fab:active {
    transform: translateY(0) scale(0.99);
}

.erp-help-fab:focus-visible {
    outline: 3px solid rgba(14, 165, 233, 0.45);
    outline-offset: 3px;
}

.erp-help-fab-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.18);
    font-size: 1.15rem;
}

.erp-help-fab-pulse {
    position: absolute;
    inset: -3px;
    border-radius: 999px;
    border: 2px solid rgba(14, 165, 233, 0.35);
    animation: erp-help-pulse 2.8s ease-out infinite;
    pointer-events: none;
}

@keyframes erp-help-pulse {
    0% { opacity: 0.85; transform: scale(1); }
    70% { opacity: 0; transform: scale(1.12); }
    100% { opacity: 0; transform: scale(1.12); }
}

/* ---------- Backdrop & panel ---------- */

.erp-help-backdrop {
    position: fixed;
    inset: 0;
    z-index: 19990;
    background: rgba(8, 15, 30, 0.42);
    -webkit-backdrop-filter: blur(3px);
    backdrop-filter: blur(3px);
    animation: erp-help-fade 0.18s ease-out;
}

@keyframes erp-help-fade {
    from { opacity: 0; }
    to { opacity: 1; }
}

.erp-help-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 20000;
    display: flex;
    flex-direction: column;
    width: 462px;
    max-width: 100vw;
    height: 100%;
    color: var(--erp-help-text);
    background: var(--erp-help-surface);
    border-radius: 20px 0 0 20px;
    box-shadow: -24px 0 60px rgba(8, 15, 30, 0.24);
    animation: erp-help-slide 0.22s cubic-bezier(0.22, 0.61, 0.36, 1);
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

@keyframes erp-help-slide {
    from { transform: translateX(28px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.erp-help-header {
    position: relative;
    flex: 0 0 auto;
    padding: 24px 24px 22px;
    color: #e2e8f0;
    background:
        radial-gradient(120% 140% at 100% 0%, rgba(20, 184, 166, 0.28) 0%, transparent 55%),
        radial-gradient(120% 140% at 0% 0%, rgba(14, 165, 233, 0.30) 0%, transparent 55%),
        linear-gradient(135deg, #0b1220 0%, #101d33 100%);
    border-radius: 20px 0 0 0;
}

.erp-help-header::after {
    content: "";
    position: absolute;
    left: 24px;
    right: 24px;
    bottom: 0;
    height: 1px;
    background: rgba(148, 163, 184, 0.18);
}

.erp-help-brand {
    display: flex;
    align-items: center;
    gap: 14px;
    padding-right: 84px;
}

.erp-help-brand-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    border-radius: 13px;
    font-size: 1.35rem;
    color: #fff;
    background: linear-gradient(135deg, #0ea5e9, #14b8a6);
    box-shadow: 0 10px 24px rgba(14, 165, 233, 0.35);
}

.erp-help-title {
    margin: 0;
    font-size: 1.22rem;
    line-height: 1.25;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.erp-help-subtitle {
    margin: 4px 0 0;
    font-size: 0.8rem;
    line-height: 1.4;
    color: #94a3b8;
}

.erp-help-actions {
    position: absolute;
    top: 18px;
    right: 18px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.erp-help-lang {
    display: inline-flex;
    padding: 3px;
    border-radius: 999px;
    background: rgba(148, 163, 184, 0.16);
    border: 1px solid rgba(148, 163, 184, 0.22);
}

.erp-help-lang button {
    border: 0;
    background: transparent;
    color: #cbd5e1;
    font: 700 0.68rem/1 'Helvetica Neue', Helvetica, Arial, sans-serif;
    letter-spacing: 0.04em;
    padding: 6px 9px;
    border-radius: 999px;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
}

.erp-help-lang button.is-active {
    color: #0b1220;
    background: #e2e8f0;
}

.erp-help-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: 1px solid rgba(148, 163, 184, 0.24);
    border-radius: 50%;
    background: rgba(148, 163, 184, 0.12);
    color: #e2e8f0;
    cursor: pointer;
    transition: background 0.15s ease;
}

.erp-help-close:hover {
    background: rgba(148, 163, 184, 0.26);
}

.erp-help-close:focus-visible,
.erp-help-lang button:focus-visible,
.erp-help-start:focus-visible,
.erp-help-current-btn:focus-visible,
.erp-help-reset:focus-visible {
    outline: 2px solid var(--erp-help-blue);
    outline-offset: 2px;
}

/* ---------- Body ---------- */

.erp-help-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 18px 22px 22px;
    background: linear-gradient(180deg, #f8fafc 0%, #ffffff 180px);
}

.erp-help-body::-webkit-scrollbar {
    width: 10px;
}

.erp-help-body::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 999px;
    border: 3px solid transparent;
    background-clip: content-box;
}

.erp-help-progress {
    padding: 16px 16px 14px;
    margin-bottom: 14px;
    border: 1px solid var(--erp-help-line);
    border-radius: var(--erp-help-radius);
    background: #fff;
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.05);
}

.erp-help-progress-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.erp-help-progress-label {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.erp-help-progress-kicker {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--erp-help-muted);
}

.erp-help-progress-count {
    font-size: 1.02rem;
    font-weight: 700;
    color: var(--erp-help-text);
}

.erp-help-progress-count span {
    color: var(--erp-help-muted);
    font-weight: 600;
    font-size: 0.82rem;
}

.erp-help-reset {
    border: 0;
    background: transparent;
    color: var(--erp-help-muted);
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 6px;
    transition: color 0.15s ease, background 0.15s ease;
}

.erp-help-reset:hover {
    color: #b91c1c;
    background: #fef2f2;
}

.erp-help-progress-bar {
    height: 8px;
    border-radius: 999px;
    background: #e8edf4;
    overflow: hidden;
}

.erp-help-progress-fill {
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #0ea5e9, #14b8a6);
    transition: width 0.4s cubic-bezier(0.22, 0.61, 0.36, 1);
}

.erp-help-current {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 14px 16px;
    margin-bottom: 16px;
    border: 1px solid #cfece7;
    border-radius: var(--erp-help-radius);
    background: linear-gradient(135deg, #ecfdf9 0%, #f0f9ff 100%);
}

.erp-help-current-title {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 0.86rem;
    font-weight: 700;
    color: #0f172a;
}

.erp-help-current-title small {
    font-size: 0.74rem;
    font-weight: 500;
    color: #0f766e;
}

.erp-help-current-btn {
    flex: 0 0 auto;
    border: 0;
    border-radius: 9px;
    padding: 8px 12px;
    color: #fff;
    font: 600 0.76rem/1 'Helvetica Neue', Helvetica, Arial, sans-serif;
    background: linear-gradient(135deg, #0ea5e9, #0d9488);
    box-shadow: 0 6px 14px rgba(13, 148, 136, 0.25);
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.erp-help-current-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 18px rgba(13, 148, 136, 0.32);
}

.erp-help-current.is-empty {
    border-color: var(--erp-help-line);
    background: var(--erp-help-surface-soft);
}

.erp-help-current.is-empty .erp-help-current-title small {
    color: var(--erp-help-muted);
}

.erp-help-search {
    position: relative;
    margin-bottom: 18px;
}

.erp-help-search i {
    position: absolute;
    left: 13px;
    top: 50%;
    transform: translateY(-50%);
    color: #94a3b8;
    font-size: 0.9rem;
    pointer-events: none;
}

.erp-help-search input {
    width: 100%;
    box-sizing: border-box;
    padding: 11px 12px 11px 38px;
    border: 1px solid var(--erp-help-line);
    border-radius: 10px;
    background: #fff;
    color: var(--erp-help-text);
    font: 0.86rem/1.3 'Helvetica Neue', Helvetica, Arial, sans-serif;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.erp-help-search input::placeholder {
    color: #94a3b8;
}

.erp-help-search input:focus {
    outline: none;
    border-color: #7dd3fc;
    box-shadow: 0 0 0 4px rgba(14, 165, 233, 0.12);
}

.erp-help-group {
    margin-bottom: 18px;
}

.erp-help-group-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 9px;
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: var(--erp-help-muted);
}

.erp-help-group-title::after {
    content: "";
    flex: 1 1 auto;
    height: 1px;
    background: var(--erp-help-line);
}

.erp-help-tour {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 13px 13px 13px 12px;
    margin-bottom: 9px;
    border: 1px solid var(--erp-help-line);
    border-radius: 12px;
    background: #fff;
    transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.erp-help-tour:hover {
    border-color: #bae6fd;
    box-shadow: 0 8px 20px rgba(14, 165, 233, 0.10);
    transform: translateY(-1px);
}

.erp-help-tour.is-done {
    border-color: #cdebd3;
    background: linear-gradient(180deg, #ffffff 0%, #f7fdf8 100%);
}

.erp-help-tour-icon {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 10px;
    color: #0369a1;
    background: #e0f2fe;
    font-size: 1rem;
}

.erp-help-tour.is-done .erp-help-tour-icon {
    color: #15803d;
    background: #dcfce7;
}

.erp-help-tour-main {
    flex: 1 1 auto;
    min-width: 0;
}

.erp-help-tour-title {
    display: flex;
    align-items: center;
    gap: 7px;
    margin: 0;
    font-size: 0.88rem;
    font-weight: 700;
    line-height: 1.3;
    color: var(--erp-help-text);
}

.erp-help-done-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    color: #fff;
    background: var(--erp-help-success);
    font-size: 0.58rem;
}

.erp-help-tour-desc {
    margin: 3px 0 6px;
    font-size: 0.76rem;
    line-height: 1.45;
    color: var(--erp-help-muted);
}

.erp-help-tour-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.68rem;
    color: #94a3b8;
}

.erp-help-route {
    padding: 2px 7px;
    border-radius: 999px;
    background: #f1f5f9;
    color: #64748b;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.64rem;
}

.erp-help-start {
    flex: 0 0 auto;
    align-self: center;
    border: 1px solid #bae6fd;
    border-radius: 9px;
    padding: 7px 11px;
    color: #0369a1;
    background: #f0f9ff;
    font: 700 0.72rem/1 'Helvetica Neue', Helvetica, Arial, sans-serif;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.erp-help-start:hover {
    color: #fff;
    border-color: #0284c7;
    background: #0284c7;
}

.erp-help-tour.is-done .erp-help-start {
    color: #15803d;
    border-color: #bbf7d0;
    background: #f0fdf4;
}

.erp-help-tour.is-done .erp-help-start:hover {
    color: #fff;
    border-color: #16a34a;
    background: #16a34a;
}

.erp-help-empty {
    padding: 18px 14px;
    text-align: center;
    font-size: 0.82rem;
    line-height: 1.5;
    color: var(--erp-help-muted);
    border: 1px dashed var(--erp-help-line);
    border-radius: 12px;
    background: #fff;
}

.erp-help-footer {
    flex: 0 0 auto;
    padding: 12px 22px 16px;
    border-top: 1px solid var(--erp-help-line);
    background: #fff;
    font-size: 0.7rem;
    line-height: 1.45;
    color: #94a3b8;
    border-radius: 0 0 0 20px;
}

.erp-help-footer strong {
    color: #64748b;
}

/* ---------- Tour popover theme ---------- */

.erp-tour-popover.driver-popover {
    min-width: 290px;
    max-width: 380px;
    padding: 18px 18px 15px;
    border-radius: 14px;
    color: #e2e8f0;
    background: #0b1220;
    border: 1px solid rgba(148, 163, 184, 0.16);
    box-shadow: 0 24px 60px rgba(2, 8, 23, 0.45), 0 2px 8px rgba(2, 8, 23, 0.3);
}

.erp-tour-popover .driver-popover-title {
    font-size: 1.02rem;
    font-weight: 700;
    line-height: 1.35;
    color: #f8fafc;
    padding-right: 24px;
}

.erp-tour-popover .driver-popover-description {
    margin-top: 8px;
    font-size: 0.82rem;
    line-height: 1.6;
    color: #b6c2d4;
}

.erp-tour-popover .driver-popover-description b,
.erp-tour-popover .driver-popover-description strong {
    color: #e0f2fe;
}

.erp-tour-popover .driver-popover-close-btn {
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    border-radius: 8px;
    color: #7c8ba1;
    font-size: 16px;
    line-height: 26px;
    transition: color 0.15s ease, background 0.15s ease;
}

.erp-tour-popover .driver-popover-close-btn:hover,
.erp-tour-popover .driver-popover-close-btn:focus {
    color: #f8fafc;
    background: rgba(148, 163, 184, 0.16);
}

.erp-tour-popover .driver-popover-footer {
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px solid rgba(148, 163, 184, 0.14);
}

.erp-tour-popover .driver-popover-progress-text {
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: #7c8ba1;
}

.erp-tour-popover .driver-popover-footer button {
    padding: 7px 12px;
    border-radius: 8px;
    border: 1px solid rgba(148, 163, 184, 0.26);
    color: #cbd5e1;
    background: rgba(148, 163, 184, 0.10);
    font: 700 0.74rem/1.2 'Helvetica Neue', Helvetica, Arial, sans-serif;
    text-shadow: none;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.erp-tour-popover .driver-popover-footer button:hover,
.erp-tour-popover .driver-popover-footer button:focus {
    color: #0b1220;
    background: #e2e8f0;
    border-color: #e2e8f0;
}

.erp-tour-popover .driver-popover-footer .driver-popover-next-btn,
.erp-tour-popover .driver-popover-footer .driver-popover-done-btn {
    color: #fff;
    border-color: transparent;
    background: linear-gradient(135deg, #0ea5e9, #0d9488);
    box-shadow: 0 6px 14px rgba(14, 165, 233, 0.3);
}

.erp-tour-popover .driver-popover-footer .driver-popover-next-btn:hover,
.erp-tour-popover .driver-popover-footer .driver-popover-done-btn:hover {
    color: #fff;
    background: linear-gradient(135deg, #0284c7, #0f766e);
}

.erp-tour-popover .driver-popover-arrow {
    border-color: #0b1220;
}

.erp-tour-popover .driver-popover-arrow-side-left {
    border-right-color: transparent;
    border-bottom-color: transparent;
    border-top-color: transparent;
}

.erp-tour-popover .driver-popover-arrow-side-right {
    border-left-color: transparent;
    border-bottom-color: transparent;
    border-top-color: transparent;
}

.erp-tour-popover .driver-popover-arrow-side-top {
    border-right-color: transparent;
    border-bottom-color: transparent;
    border-left-color: transparent;
}

.erp-tour-popover .driver-popover-arrow-side-bottom {
    border-left-color: transparent;
    border-top-color: transparent;
    border-right-color: transparent;
}

.erp-tour-popover .driver-popover-arrow-side-center {
    display: none;
}

/* ---------- Toast ---------- */

.erp-tour-toast {
    position: fixed;
    left: 50%;
    bottom: 30px;
    z-index: 1000000001;
    transform: translate(-50%, 16px);
    opacity: 0;
    padding: 11px 18px;
    border-radius: 10px;
    color: #e2e8f0;
    background: #0b1220;
    border: 1px solid rgba(148, 163, 184, 0.2);
    box-shadow: 0 16px 40px rgba(2, 8, 23, 0.35);
    font: 600 0.8rem/1.3 'Helvetica Neue', Helvetica, Arial, sans-serif;
    transition: opacity 0.22s ease, transform 0.22s ease;
    pointer-events: none;
}

.erp-tour-toast.visible {
    opacity: 1;
    transform: translate(-50%, 0);
}

.erp-tour-toast.success {
    border-color: rgba(34, 197, 94, 0.4);
}

.erp-tour-toast.success::before {
    content: "\2713";
    margin-right: 8px;
    color: #4ade80;
}

.erp-tour-toast.error {
    border-color: rgba(248, 113, 113, 0.4);
}

/* ---------- Responsive ---------- */

@media (max-width: 560px) {
    .erp-help-panel {
        width: 100%;
        border-radius: 0;
    }

    .erp-help-header {
        border-radius: 0;
    }

    .erp-help-footer {
        border-radius: 0;
    }

    .erp-help-fab {
        right: 14px;
        bottom: 14px;
        padding: 11px;
        gap: 0;
    }

    .erp-help-fab-label {
        display: none;
    }

    .erp-help-fab-icon {
        width: 36px;
        height: 36px;
    }
}

/* ---------- Top bar help button ---------- */

.help-topbar-button {
    align-self: center;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    margin-left: 10px;
    padding: 8px 12px;
    border: 1px solid rgba(14, 165, 233, 0.28);
    border-radius: 9px;
    background: rgba(14, 165, 233, 0.08);
    color: #0369a1;
    font: 600 0.8rem/1 'Helvetica Neue', Helvetica, Arial, sans-serif;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.help-topbar-button:hover {
    color: #fff;
    border-color: #0284c7;
    background: #0284c7;
}

.help-topbar-button:focus-visible {
    outline: 2px solid var(--erp-help-blue);
    outline-offset: 2px;
}

@media (max-width: 900px) {
    .help-topbar-button {
        padding: 8px 10px;
    }

    .help-topbar-button span {
        display: none;
    }
}

.erp-help-progress--loading {
    border-color: #dbeafe;
    background: linear-gradient(135deg, #f8fbff 0%, #ffffff 100%);
}

.erp-help-loading-spinner {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: #eff6ff;
    color: #2563eb;
    font-size: 0.95rem;
    flex: none;
}

.erp-help-progress-fill--indeterminate {
    width: 40% !important;
    animation: erp-help-indeterminate 1.15s ease-in-out infinite;
}

.erp-help-loading-hint {
    margin-top: -6px;
    margin-bottom: 14px;
    font-size: 0.78rem;
    color: var(--erp-help-muted);
}

@keyframes erp-help-indeterminate {
    0% { transform: translateX(-15%); }
    50% { transform: translateX(150%); }
    100% { transform: translateX(-15%); }
}

.erp-tour-loading {
    position: fixed;
    right: 24px;
    bottom: 96px;
    z-index: 2147483000;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 12px;
    background: #0f172a;
    color: #f8fafc;
    font-size: 0.82rem;
    font-weight: 600;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.35);
}

.erp-tour-loading-spinner {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.25);
    border-top-color: #38bdf8;
    animation: erp-tour-spin 0.8s linear infinite;
}

@keyframes erp-tour-spin {
    to { transform: rotate(360deg); }
}
