/* ==========================================================================
   Pomoc Huba (ADR-0022): menu „?”, instrukcja, „O aplikacji” i samouczek.

   Tylko tokeny z tokens.css i wspolne komponenty z app.css (ADR-0021), wiec
   pomoc wyglada tak samo w kazdej apce i w obu motywach. Kolor apki (`--app`)
   oznacza, gdzie jestem; cyan (`--accent`) - dzialanie.
   ========================================================================== */

/* --- Menu „?” w pasku gornym ------------------------------------------------ */

.help-menu .profile-menu__item.is-disabled {
    color: var(--text-faint);
    cursor: default;
}

.help-menu .profile-menu__item.is-disabled:hover {
    background: transparent;
    color: var(--text-faint);
}

.help-menu .profile-menu__item.is-disabled i {
    color: var(--text-faint);
}

.help-menu .profile-menu__item small {
    margin-left: auto;
    font-size: var(--fs-xs);
}

.help-menu[open] > summary {
    background: var(--surface-raised);
    color: var(--text);
}

/* --- Ekrany pomocy ------------------------------------------------------------ */

.help-page {
    max-width: 1180px;
}

.help-page--narrow {
    max-width: 860px;
}

.help-kicker {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 8px;
    color: var(--text-muted);
    font-size: var(--fs-sm);
}

.help-kicker .app-mark {
    width: 24px;
    height: 24px;
    font-size: 13px;
}

.help-head__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

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

.help-search > i {
    position: absolute;
    top: 50%;
    left: 12px;
    transform: translateY(-50%);
    color: var(--text-muted);
}

.help-search input {
    width: 100%;
    min-height: 42px;
    padding-left: 36px;
}

.help-results {
    margin-bottom: 20px;
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--surface-card);
}

.help-results h2 {
    margin: 0 0 8px;
    font-size: var(--fs-base);
    font-weight: 600;
}

.help-results ol {
    display: grid;
    gap: 2px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.help-results a {
    display: grid;
    gap: 2px;
    padding: 8px 10px;
    border-radius: var(--radius);
    color: var(--text);
    text-decoration: none;
}

.help-results a:hover {
    background: var(--surface-raised);
}

.help-results a span {
    color: var(--text-muted);
    font-size: var(--fs-sm);
}

.help-results mark,
.help-article mark {
    padding: 0 2px;
    border-radius: 3px;
    background: color-mix(in srgb, var(--tone-warn) 30%, transparent);
    color: var(--text);
}

.help-layout {
    display: grid;
    grid-template-columns: 250px minmax(0, 1fr);
    gap: 32px;
    align-items: start;
}

.help-toc {
    position: sticky;
    top: calc(var(--topbar-h) + 16px);
    max-height: calc(100vh - var(--topbar-h) - 32px);
    overflow-y: auto;
    padding: 14px 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--surface-card);
    font-size: var(--fs-sm);
    scrollbar-width: thin;
}

.help-toc > strong {
    display: block;
    margin: 0 0 8px 6px;
    color: var(--text-muted);
    font-size: var(--fs-xs);
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.help-toc ol {
    margin: 0;
    padding: 0;
    list-style: none;
}

.help-toc ol ol {
    margin: 2px 0 6px 12px;
    padding-left: 8px;
    border-left: 1px solid var(--line);
}

.help-toc a {
    display: block;
    padding: 4px 6px;
    border-radius: var(--radius-sm);
    color: var(--text);
    line-height: 1.3;
    text-decoration: none;
}

.help-toc ol ol a {
    color: var(--text-muted);
}

.help-toc a:hover {
    background: var(--surface-raised);
    color: var(--text);
}

.help-article {
    max-width: 820px;
    line-height: 1.6;
}

.help-intro {
    margin-bottom: 8px;
    color: var(--text-muted);
    font-size: 15px;
}

.help-section {
    padding: 8px 0 18px;
    border-top: 1px solid var(--line);
}

.help-article h2,
.help-article h3 {
    scroll-margin-top: calc(var(--topbar-h) + 16px);
    letter-spacing: -0.01em;
    line-height: 1.25;
}

.help-article h2 {
    margin: 18px 0 10px;
    font-size: 1.25rem;
    font-weight: 650;
}

.help-article h3 {
    margin: 20px 0 6px;
    font-size: 1.02rem;
    font-weight: 600;
}

.help-article h2:target,
.help-article h3:target {
    color: var(--app);
}

.help-article p,
.help-article ul,
.help-article ol {
    margin: 0 0 10px;
}

.help-article ul,
.help-article ol {
    padding-left: 22px;
}

.help-article li + li {
    margin-top: 3px;
}

.help-article strong {
    color: var(--text);
    font-weight: 600;
}

.help-article code,
.help-article kbd {
    padding: 1px 5px;
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--surface-raised);
    font-size: 0.9em;
}

.help-article blockquote {
    margin: 0 0 12px;
    padding: 8px 14px;
    border-left: 3px solid var(--app);
    border-radius: 0 var(--radius) var(--radius) 0;
    background: var(--surface-card);
    color: var(--text-muted);
}

.help-article blockquote p {
    margin: 0;
}

.help-article table {
    width: 100%;
    margin: 4px 0 14px;
    border-collapse: collapse;
    font-size: var(--fs-sm);
}

.help-article th,
.help-article td {
    padding: 7px 10px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}

.help-article th {
    color: var(--text-muted);
    font-weight: 600;
}

.help-article img {
    display: block;
    max-width: 100%;
    margin: 8px 0 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
}

.help-foot {
    margin-top: 18px;
    color: var(--text-faint);
    font-size: var(--fs-xs);
}

.help-facts {
    margin-bottom: 20px;
}

.help-release + .help-release {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--line);
}

.help-release h3 {
    margin: 0 0 8px;
    font-size: 1rem;
}

.help-release h3 small {
    margin-left: 6px;
    color: var(--text-muted);
    font-size: var(--fs-sm);
    font-weight: 400;
}

.help-release ul {
    margin: 0;
    padding-left: 20px;
    line-height: 1.55;
}

.help-tour-wait {
    margin: 0;
    color: var(--text-muted);
}

@media (max-width: 980px) {
    .help-layout {
        grid-template-columns: 1fr;
    }

    .help-toc {
        position: static;
        max-height: none;
    }
}

/* --- Samouczek: narrator w miejscu menu ------------------------------------ */

/* Elementy samouczka maja wlasne `display`, ktore wygraloby z atrybutem `hidden`. */
.tour-narrator[hidden],
.tour-slide[hidden],
.tour-narrator [hidden],
.tour-slide [hidden] {
    display: none !important;
}

@media (min-width: 981px) {
    body.help-tour-on,
    body.help-tour-on.sidebar-collapsed {
        --sidebar-w: 300px;
    }

    body.help-tour-on .app-sidebar {
        visibility: hidden;
    }
}

.tour-narrator {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: 1050;
    display: flex;
    flex-direction: column;
    gap: 14px;
    width: var(--sidebar-w);
    padding: 14px 16px 12px;
    overflow-y: auto;
    border-right: 1px solid var(--line);
    background: var(--surface-side);
    font-size: var(--fs-base);
    scrollbar-width: thin;
}

.tour-narrator__brand {
    display: grid;
    gap: 4px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--line);
}

.tour-narrator__brand small {
    color: var(--text-muted);
    font-size: var(--fs-xs);
}

/* Marka samouczka jak w pokazie z demo Trade: znak SMARTII i „SMARTIA <apka>”. */
.tour-brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 15px;
}

.tour-brand img {
    width: 28px;
    height: 28px;
    border-radius: var(--radius);
    object-fit: cover;
}

.tour-brand__name {
    font-weight: 700;
    letter-spacing: 0.01em;
}

.tour-narrator__chapters {
    display: grid;
    gap: 1px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.tour-narrator__chapters button {
    display: flex;
    align-items: center;
    gap: 9px;
    width: 100%;
    min-height: 30px;
    padding: 2px 8px;
    border: 0;
    border-radius: var(--radius-sm);
    background: transparent;
    color: var(--text-muted);
    font: inherit;
    font-size: var(--fs-sm);
    text-align: left;
    cursor: pointer;
}

.tour-narrator__chapters button:hover {
    background: var(--surface-raised);
    color: var(--text);
}

.tour-narrator__num {
    display: grid;
    flex: none;
    place-items: center;
    width: 20px;
    height: 20px;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
}

.tour-narrator__chapters .is-current {
    background: var(--nav-active);
    box-shadow: inset 0 0 0 1px var(--nav-active-ring);
    color: var(--text);
    font-weight: 600;
}

.tour-narrator__chapters .is-current .tour-narrator__num {
    border-color: var(--app);
    background: var(--app);
    color: var(--on-fill);
}

.tour-narrator__chapters .is-done .tour-narrator__num {
    border-color: color-mix(in srgb, var(--app) 50%, transparent);
    color: var(--app);
}

.tour-narrator__card {
    padding: 16px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-lg);
    background: var(--surface-card);
    animation: tour-in 0.25s ease-out;
}

.tour-narrator__kicker {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
    color: var(--app);
    font-size: var(--fs-xs);
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.tour-narrator__card h2 {
    margin: 0 0 8px;
    font-size: 1.15rem;
    font-weight: 650;
    line-height: 1.25;
}

.tour-narrator__card p {
    margin: 0;
    color: var(--text-muted);
    line-height: 1.55;
}

.tour-narrator__card p strong {
    color: var(--text);
}

.tour-narrator__card .tour-narrator__wait {
    margin-top: 10px;
    color: var(--text-faint);
    font-size: var(--fs-sm);
}

.tour-narrator__wait .bi {
    margin-right: 6px;
}

.tour-narrator__here {
    display: inline-flex;
    gap: 6px;
    margin-top: 10px;
    font-size: var(--fs-sm);
}

.tour-narrator__controls {
    display: flex;
    gap: 8px;
    margin-top: auto;
}

.tour-narrator__controls .btn {
    min-height: 42px;
}

.tour-narrator__controls [data-tour-next] {
    flex: 1;
    justify-content: center;
}

.tour-narrator__progress {
    height: 3px;
    overflow: hidden;
    border-radius: 999px;
    background: var(--line);
}

.tour-narrator__progress span {
    display: block;
    height: 100%;
    background: var(--app);
    transition: width 0.3s ease;
}

.tour-narrator__foot {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    color: var(--text-faint);
    font-size: var(--fs-xs);
}

.tour-narrator__foot button {
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--text-muted);
    font: inherit;
    cursor: pointer;
    text-decoration: underline;
}

.tour-narrator__foot button:hover {
    color: var(--text);
}

/* Podświetlenie elementu: ramka w cyanie i przyciemnienie reszty. Klikać można
   przez nie - samouczek nie zabiera aplikacji. Ramka leży na stronie i przewija się
   z treścią (`help.js` stawia ją w oknie tylko przy celu w przyklejonym pasku albo
   w telefonie); przejście tylko przy zmianie celu albo układu, bez niego (`is-riding`)
   przy pierwszym pokazaniu i przewijanej tabeli. Przyciemnienie sięga daleko: ramka
   jadąca do celu poza ekranem nie może odsłonić okna. */
.tour-spotlight {
    position: absolute;
    z-index: 1040;
    border-radius: var(--radius-lg);
    box-shadow: 0 0 0 3px var(--accent), 0 0 0 300vmax var(--scrim);
    pointer-events: none;
    transition: top 0.25s ease, left 0.25s ease, width 0.25s ease, height 0.25s ease;
}

.tour-spotlight.is-riding {
    transition: none;
}

/* Przewinięty do podświetlenia element staje pod paskiem górnym, a nie chowa się za nim. */
[data-tour] {
    scroll-margin-top: calc(var(--topbar-h) + 16px);
}

/* Ekran telefonu obok ekranu komputera: magazyn i kierowca na zywo. */
.tour-phone {
    position: fixed;
    right: 28px;
    bottom: 20px;
    z-index: 1050;
    width: 300px;
    height: min(640px, calc(100vh - 80px));
    padding: 30px 9px 9px;
    border: 1px solid var(--line-strong);
    border-radius: 40px;
    background: var(--surface-raised);
    box-shadow: var(--shadow-pop);
    animation: tour-in 0.3s ease-out;
}

.tour-phone::before {
    content: "";
    position: absolute;
    top: 10px;
    left: 50%;
    width: 84px;
    height: 12px;
    border-radius: 999px;
    background: var(--surface-bg);
    transform: translateX(-50%);
}

.tour-phone iframe {
    display: block;
    width: 100%;
    height: 100%;
    border: 0;
    border-radius: 30px;
    background: var(--surface-bg);
}

@keyframes tour-in {
    from {
        opacity: 0;
        transform: translateY(6px);
    }

    to {
        opacity: 1;
        transform: none;
    }
}

@media (max-width: 980px) {
    .tour-narrator {
        top: auto;
        right: 0;
        width: auto;
        max-height: 55vh;
        border-top: 1px solid var(--line-strong);
        border-right: 0;
        box-shadow: var(--shadow-pop);
    }

    .tour-narrator__chapters,
    .tour-narrator__foot span,
    .tour-phone {
        display: none;
    }
}

/* --- Samouczek: plansze na caly ekran -------------------------------------- */

body.help-tour-slide {
    overflow: hidden;
}

.tour-slide {
    position: fixed;
    inset: 0;
    z-index: 1100;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    background:
        radial-gradient(circle at 12% 0%, color-mix(in srgb, var(--accent) 14%, transparent), transparent 42%),
        radial-gradient(circle at 92% 100%, color-mix(in srgb, var(--app) 16%, transparent), transparent 46%),
        var(--surface-bg);
    color: var(--text);
}

.tour-slide__top,
.tour-slide__bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 18px 32px;
}

.tour-slide__chapter {
    color: var(--text-muted);
    font-size: var(--fs-sm);
}

.tour-slide__body {
    display: grid;
    place-items: center;
    padding: 8px 32px;
    overflow-y: auto;
}

.tour-slide__inner {
    width: 100%;
    max-width: 1120px;
    animation: tour-in 0.35s ease-out;
}

.tour-slide__dots {
    display: flex;
    gap: 8px;
}

.tour-slide__dots button {
    width: 28px;
    height: 6px;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: var(--line-strong);
    cursor: pointer;
}

.tour-slide__dots .is-done {
    background: color-mix(in srgb, var(--app) 45%, transparent);
}

.tour-slide__dots .is-current {
    background: var(--app);
}

.tour-slide__nav {
    display: flex;
    gap: 8px;
}

/* Skladniki plansz dla tresci apek (`templates/<apka>/help/*.html`). */
.tour-slide h1 {
    margin: 0 0 16px;
    font-size: clamp(2rem, 4.2vw, 3.3rem);
    font-weight: 700;
    letter-spacing: -0.025em;
    line-height: 1.08;
}

.tour-slide h2 {
    margin: 0 0 12px;
    font-size: clamp(1.6rem, 3vw, 2.5rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.12;
}

.tour-slide h3 {
    margin: 0 0 8px;
    font-size: 1.08rem;
    font-weight: 650;
}

.tour-grad {
    background: linear-gradient(90deg, var(--accent), var(--app));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.tour-lead {
    max-width: 62ch;
    margin: 0 0 26px;
    color: var(--text-muted);
    font-size: 1.12rem;
    line-height: 1.55;
}

.tour-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 18px;
    padding: 5px 12px;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    color: var(--text-muted);
    font-size: var(--fs-sm);
}

.tour-cover {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(280px, 0.75fr);
    gap: 48px;
    align-items: center;
}

.tour-chain {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 6px;
    margin-bottom: 30px;
}

.tour-chain__node {
    display: grid;
    justify-items: center;
    gap: 8px;
    width: 92px;
    color: var(--text-muted);
    font-size: var(--fs-sm);
    text-align: center;
}

.tour-chain__node + .tour-chain__node {
    position: relative;
}

.tour-chain__node + .tour-chain__node::before {
    content: "";
    position: absolute;
    top: 26px;
    left: -24px;
    width: 30px;
    height: 1px;
    background: var(--line-strong);
}

.tour-chain__icon {
    display: grid;
    place-items: center;
    width: 52px;
    height: 52px;
    border: 1px solid color-mix(in srgb, var(--app) 35%, transparent);
    border-radius: 16px;
    background: color-mix(in srgb, var(--app) 14%, transparent);
    color: var(--app);
    font-size: 22px;
}

.tour-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
}

.tour-actions .btn {
    min-height: 46px;
    padding-inline: 20px;
    font-size: 15px;
}

.tour-foot {
    margin: 18px 0 0;
    color: var(--text-faint);
    font-size: var(--fs-sm);
}

.tour-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 22px;
}

.tour-card {
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: color-mix(in srgb, var(--surface-card) 88%, transparent);
}

.tour-card--accent {
    border-color: color-mix(in srgb, var(--app) 45%, transparent);
}

.tour-card__icon {
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    margin-bottom: 12px;
    border-radius: 12px;
    background: color-mix(in srgb, var(--app) 14%, transparent);
    color: var(--app);
    font-size: 19px;
}

.tour-card__no {
    display: block;
    margin-bottom: 6px;
    font-size: 2rem;
    font-weight: 700;
    line-height: 1;
}

.tour-card__tag {
    display: inline-block;
    margin-bottom: 8px;
    color: var(--text-muted);
    font-size: var(--fs-xs);
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.tour-card p,
.tour-card li {
    color: var(--text-muted);
    font-size: var(--fs-sm);
    line-height: 1.5;
}

.tour-card p {
    margin: 0;
}

.tour-card ul {
    margin: 0;
    padding-left: 18px;
}

.tour-bar {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 18px;
    padding: 14px 18px;
    border: 1px solid color-mix(in srgb, var(--app) 40%, transparent);
    border-radius: var(--radius-lg);
    background: color-mix(in srgb, var(--app) 8%, transparent);
}

.tour-bar .tour-card__icon {
    flex: none;
    margin: 0;
}

.tour-note {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    color: var(--text-muted);
}

.tour-tiles {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 12px;
    margin-bottom: 26px;
}

.tour-tile {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--surface-card);
    color: var(--text);
    text-decoration: none;
}

.tour-tile:hover {
    border-color: var(--line-strong);
    background: var(--surface-raised);
    color: var(--text);
}

.tour-tile .tour-card__icon {
    flex: none;
    margin: 0;
}

.tour-tile span {
    display: grid;
    gap: 2px;
}

.tour-tile small {
    color: var(--text-muted);
}

/* Telefon na okladce: makieta z prawdziwymi danymi organizacji. */
.tour-mock {
    position: relative;
    justify-self: center;
}

.tour-mock__phone {
    display: grid;
    gap: 10px;
    width: 270px;
    padding: 36px 14px 46px;
    border: 1px solid var(--line-strong);
    border-radius: 38px;
    background: var(--surface-card);
    box-shadow: var(--shadow-pop);
}

.tour-mock__title {
    color: var(--text-muted);
    font-size: var(--fs-xs);
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.tour-mock__card {
    display: grid;
    gap: 3px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--surface-raised);
    font-size: var(--fs-sm);
}

.tour-mock__card b {
    display: flex;
    justify-content: space-between;
    gap: 8px;
}

.tour-mock__card small {
    color: var(--text-muted);
}

.tour-mock__btn {
    padding: 11px;
    border-radius: var(--radius-lg);
    background: var(--accent);
    color: var(--accent-ink);
    font-weight: 700;
    letter-spacing: 0.06em;
    text-align: center;
}

.tour-mock__float {
    position: absolute;
    left: -84px;
    bottom: -30px;
    display: grid;
    gap: 2px;
    padding: 12px 16px;
    border: 1px solid color-mix(in srgb, var(--tone-ok) 40%, transparent);
    border-radius: var(--radius-lg);
    background: var(--surface-card);
    box-shadow: var(--shadow-pop);
    font-size: var(--fs-sm);
}

.tour-mock__float strong {
    color: var(--tone-ok);
    font-size: 1.35rem;
}

.tour-mock__float small {
    color: var(--text-muted);
}

@media (max-width: 980px) {
    .tour-slide__top,
    .tour-slide__bottom,
    .tour-slide__body {
        padding-inline: 16px;
    }

    .tour-cover {
        grid-template-columns: 1fr;
    }

    .tour-mock {
        display: none;
    }
}
