/*
 * Application tour - guided walkthrough of the current UI.
 * Self-contained: no bootstrap-tour / popover dependency.
 * Palette follows the Hamly ERP brand (deep green + gold).
 */
:root {
    --tour-green: #0b2415;
    --tour-green-2: #14452c;
    --tour-green-3: #2e7d5b;
    --tour-gold: #c9a84c;
    --tour-gold-2: #f0d983;
    --tour-ink: #16231b;
    --tour-muted: #6b7d73;
    --tour-paper: #ffffff;
}

.app-tour-overlay {
    position: fixed;
    inset: 0;
    z-index: 10600;
    background: transparent;
}

.app-tour-mask {
    position: fixed;
    background: rgba(6, 18, 11, .68);
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    z-index: 10600;
    transition: all .2s cubic-bezier(.4, 0, .2, 1);
}

/* --- Spotlight ---------------------------------------------------------- */
.app-tour-spotlight {
    position: fixed;
    z-index: 10601;
    border-radius: 10px;
    box-shadow:
        0 0 0 2px var(--tour-gold),
        0 0 0 6px rgba(201, 168, 76, .26),
        0 0 24px 6px rgba(201, 168, 76, .20);
    pointer-events: none;
    transition: all .22s cubic-bezier(.4, 0, .2, 1);
    animation: app-tour-pulse 2.4s ease-in-out infinite;
}

@keyframes app-tour-pulse {
    0%, 100% { box-shadow: 0 0 0 2px var(--tour-gold), 0 0 0 6px rgba(201, 168, 76, .26), 0 0 24px 6px rgba(201, 168, 76, .18); }
    50%      { box-shadow: 0 0 0 2px var(--tour-gold), 0 0 0 10px rgba(201, 168, 76, .10), 0 0 32px 10px rgba(201, 168, 76, .24); }
}

/* --- Card --------------------------------------------------------------- */
.app-tour-popup {
    position: fixed;
    z-index: 10602;
    width: 372px;
    max-width: calc(100vw - 24px);
    background: var(--tour-paper);
    border-radius: 16px;
    box-shadow:
        0 28px 64px rgba(6, 18, 11, .40),
        0 2px 8px rgba(6, 18, 11, .16);
    font-family: inherit;
    color: var(--tour-ink);
    transition: top .22s cubic-bezier(.4, 0, .2, 1), left .22s cubic-bezier(.4, 0, .2, 1);
    animation: app-tour-in .28s cubic-bezier(.2, .8, .3, 1);
}

@keyframes app-tour-in {
    from { opacity: 0; transform: translateY(6px) scale(.97); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.app-tour-popup.is-centered {
    width: 460px;
}

/* Header ----------------------------------------------------------------- */
.app-tour-hd {
    position: relative;
    background: linear-gradient(135deg, var(--tour-green-2) 0%, var(--tour-green) 100%);
    border-radius: 16px 16px 0 0;
    padding: 13px 16px 12px;
}

.app-tour-hd-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.app-tour-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    background: rgba(201, 168, 76, .18);
    border: 1px solid rgba(201, 168, 76, .42);
    color: var(--tour-gold-2);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .1em;
    text-transform: uppercase;
    white-space: nowrap;
    line-height: 1.6;
}

.app-tour-count {
    margin-left: auto;
    font-size: 11.5px;
    font-weight: 700;
    color: rgba(255, 255, 255, .68);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.app-tour-close {
    border: 0;
    background: rgba(255, 255, 255, .10);
    color: rgba(255, 255, 255, .82);
    width: 24px;
    height: 24px;
    border-radius: 7px;
    font-size: 15px;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    transition: background-color .15s, color .15s;
}

.app-tour-close:hover {
    background: rgba(255, 255, 255, .22);
    color: #fff;
}

.app-tour-progress {
    height: 3px;
    border-radius: 3px;
    background: rgba(255, 255, 255, .16);
    margin-top: 11px;
    overflow: hidden;
}

.app-tour-progress span {
    display: block;
    height: 100%;
    border-radius: 3px;
    background: linear-gradient(90deg, var(--tour-green-3), var(--tour-gold));
    transition: width .3s cubic-bezier(.4, 0, .2, 1);
}

/* Body ------------------------------------------------------------------- */
.app-tour-body {
    padding: 15px 16px 14px;
}

.app-tour-title {
    font-size: 17px;
    font-weight: 800;
    margin: 0 0 7px;
    line-height: 1.32;
    color: var(--tour-green);
}

.app-tour-text {
    font-size: 13px;
    line-height: 1.62;
    margin: 0;
    color: #53655a;
}

/* "Where to find it" route hint ------------------------------------------ */
.app-tour-route {
    display: none;
    margin-top: 13px;
    padding: 9px 12px;
    border-radius: 9px;
    background: #f4f7f4;
    border-left: 3px solid var(--tour-gold);
}

.app-tour-route.is-shown {
    display: block;
}

.app-tour-route-label {
    display: block;
    font-size: 9.5px;
    font-weight: 800;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--tour-muted);
    margin-bottom: 3px;
}

.app-tour-route-path {
    display: block;
    font-size: 12.5px;
    font-weight: 700;
    color: var(--tour-green-2);
    line-height: 1.45;
    word-break: break-word;
}

/* Footer ----------------------------------------------------------------- */
.app-tour-ft {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 11px 16px 13px;
    border-top: 1px solid #eef1ee;
}

.app-tour-ft-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

.app-tour-btn {
    border: 0;
    border-radius: 9px;
    padding: 8px 17px;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    line-height: 1.4;
    transition: all .16s ease-in-out;
}

.app-tour-btn-primary {
    background: linear-gradient(135deg, var(--tour-green-3), var(--tour-green-2));
    color: #fff;
    box-shadow: 0 3px 10px rgba(20, 69, 44, .28);
}

.app-tour-btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(20, 69, 44, .34);
}

.app-tour-btn-ghost {
    background: #f1f3f1;
    color: #44564b;
}

.app-tour-btn-ghost:hover {
    background: #e5e9e5;
}

.app-tour-btn-danger {
    background: linear-gradient(135deg, #b4472f, #8f3422);
    color: #fff;
    box-shadow: 0 3px 10px rgba(143, 52, 34, .26);
}

.app-tour-btn-danger:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(143, 52, 34, .32);
}

.app-tour-btn-link {
    background: transparent;
    color: var(--tour-muted);
    padding: 8px 2px;
    font-weight: 600;
    font-size: 12.5px;
}

.app-tour-btn-link:hover {
    color: #b4472f;
    text-decoration: underline;
}

.app-tour-btn:disabled {
    opacity: .38;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Arrow ------------------------------------------------------------------ */
.app-tour-arrow {
    position: absolute;
    width: 14px;
    height: 14px;
    background: var(--tour-paper);
    transform: rotate(45deg);
}

/* Pointing up means the card sits below the target, against the dark header. */
.app-tour-arrow.is-top {
    background: var(--tour-green-2);
}

/* --- End-tour confirmation --------------------------------------------- */
.app-tour-confirm {
    display: none;
    padding: 24px 22px 20px;
    text-align: center;
}

/* --- "where to find it again" panel, shown when closing with the X ------- */
.app-tour-exit {
    display: none;
    padding: 24px 22px 20px;
    text-align: center;
}

.app-tour-popup.is-exiting .app-tour-hd,
.app-tour-popup.is-exiting .app-tour-body,
.app-tour-popup.is-exiting .app-tour-ft {
    display: none;
}

.app-tour-popup.is-exiting .app-tour-exit {
    display: block;
}

.app-tour-exit-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 13px;
    border-radius: 50%;
    background: rgba(46, 125, 91, .12);
    color: var(--tour-green-3);
    font-size: 24px;
    font-weight: 800;
    line-height: 48px;
}

.app-tour-exit .app-tour-text {
    max-width: 340px;
    margin: 0 auto;
}

.app-tour-popup.is-confirming .app-tour-hd,
.app-tour-popup.is-confirming .app-tour-body,
.app-tour-popup.is-confirming .app-tour-ft,
.app-tour-popup.is-confirming .app-tour-arrow {
    display: none;
}

.app-tour-popup.is-confirming .app-tour-confirm {
    display: block;
}

.app-tour-confirm-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 13px;
    border-radius: 50%;
    background: rgba(180, 71, 47, .12);
    color: #b4472f;
    font-size: 25px;
    font-weight: 800;
    line-height: 48px;
}

.app-tour-confirm .app-tour-text {
    max-width: 340px;
    margin: 0 auto;
}

.app-tour-confirm-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 18px;
}

@media (max-width: 575px) {
    .app-tour-popup,
    .app-tour-popup.is-centered {
        width: calc(100vw - 24px);
    }
}

@media (prefers-reduced-motion: reduce) {
    .app-tour-spotlight,
    .app-tour-popup {
        animation: none;
    }
}
