/* In-app Help (/help, /help/{id}, header "?"). Theme tokens only; aurora tokens carry alpha, so tints use color-mix. */

/* Link text colour. Brutal and Aurora keep --primary (it reads on their dark surfaces). Frost's --primary orange is about
   2:1 on its light background, so links there use a darker orange of the same hue: 37 80% 30% gives about 5.4:1 on
   --background, 5.9:1 on white cards and 4.9:1 on --muted (WCAG AA for body text). Frost has no dark variant. */
html[data-theme-style="frost"] { --help-link: 37 80% 30%; }

/* Pins and their outlines: one fixed magenta in every theme (white digits about 4.9:1), a colour no app control uses, so
   a pin never reads as one of the app's own number circles or badges. */
:root { --help-pin: #d81b78; }

.help-role-line { font-size: 0.8125rem; color: hsl(var(--muted-foreground)); }

.help-search { width: min(100%, 36rem); }

.help-category { display: grid; gap: 0.625rem; }
.help-category-title {
    font-size: 0.75rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
    color: hsl(var(--muted-foreground)); margin: 0;
}

.help-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: 0.75rem; }
.help-card {
    display: grid; gap: 0.25rem; align-content: start; padding: 0.75rem 0.875rem;
    border: 1px solid hsl(var(--border)); border-radius: var(--radius);
    background: hsl(var(--card)); color: hsl(var(--card-foreground)); text-decoration: none;
    transition: border-color 0.15s ease;
}
.help-card:hover { border-color: hsl(var(--primary)); }
.help-card-title { font-weight: 600; font-size: 0.9375rem; }
.help-card-summary { font-size: 0.8125rem; color: hsl(var(--muted-foreground)); }

.help-role-pill {
    justify-self: start; margin-top: 0.25rem; padding: 0.0625rem 0.5rem; border-radius: 9999px;
    font-size: 0.6875rem; font-weight: 500; line-height: 1.4;
    border: 1px solid hsl(var(--border)); color: hsl(var(--muted-foreground));
}
.help-role-operator { border-color: hsl(var(--primary)); color: hsl(var(--primary)); }
.help-role-administrator,
.help-role-superadministrator { border-color: hsl(var(--admin)); color: hsl(var(--admin)); }

/* Search results (sketch B): path "Article › Section", snippet with marked words, role pill above User. */
.help-results { display: grid; gap: 0.625rem; max-width: 52rem; }
.help-results-count { font-size: 0.75rem; color: hsl(var(--muted-foreground)); }
.help-result-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5rem; }
.help-results-partial { margin: 0; font-size: 0.8125rem; color: hsl(var(--muted-foreground)); }
.help-suggestions { display: grid; gap: 0.5rem; max-width: 36rem; margin: 0 auto; }
.help-suggestions-title { font-size: 0.875rem; font-weight: 600; margin: 0; }
.help-suggestion-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.375rem; }
.help-suggestion-list a, .help-suggestions-all { color: hsl(var(--help-link, var(--primary))); text-decoration: none; font-size: 0.875rem; }
.help-suggestion-list a:hover, .help-suggestions-all:hover { text-decoration: underline; }
.help-result {
    display: grid; gap: 0.25rem; padding: 0.625rem 0.875rem; min-width: 0;
    border: 1px solid hsl(var(--border)); border-radius: var(--radius);
    background: hsl(var(--card)); color: hsl(var(--card-foreground)); text-decoration: none;
    transition: border-color 0.15s ease;
}
.help-result:hover, .help-result:focus-visible { border-color: hsl(var(--primary)); }
.help-result-path { font-weight: 600; font-size: 0.875rem; overflow-wrap: anywhere; }
.help-result-sep { margin: 0 0.375rem; color: hsl(var(--muted-foreground)); font-weight: 400; }
.help-result-snippet { font-size: 0.8125rem; line-height: 1.5; color: hsl(var(--muted-foreground)); overflow-wrap: anywhere; }
.help-result mark {
    background: color-mix(in srgb, hsl(var(--primary)) 30%, transparent); color: hsl(var(--foreground));
    border-radius: 3px; padding: 0 2px;
}

/* Article */
/* position: relative keeps every absolutely positioned descendant (the callouts' sr-only numbers, pins) inside the
   scrolling .app-main. Without it they are placed against .app-main-wrapper (overflow: hidden), stretch its scroll
   height, and a TOC anchor jump scrolls that wrapper: the header slides away and cannot be scrolled back. */
.help-home, .help-article { position: relative; }
.help-article { display: grid; gap: 1rem; max-width: 72rem; }
.help-article-header { display: grid; gap: 0.375rem; }
.help-article-title { font-size: 1.25rem; font-weight: 600; margin: 0; }
.help-article-summary { margin: 0; color: hsl(var(--muted-foreground)); }
.help-fallback-notice {
    margin: 0; padding: 0.5rem 0.75rem; font-size: 0.8125rem; border-radius: 0 var(--radius) var(--radius) 0;
    border-left: 3px solid hsl(var(--primary));
    background: color-mix(in srgb, hsl(var(--primary)) 10%, transparent);
}

.help-article-layout { display: grid; grid-template-columns: minmax(0, 1fr) 13rem; gap: 1.5rem; align-items: start; }
.help-article-body { display: grid; gap: 1.5rem; min-width: 0; }

.help-section { display: grid; gap: 0.75rem; scroll-margin-top: 4.5rem; }
.help-section-title { font-size: 1.0625rem; font-weight: 600; margin: 0; }
/* Prose is ragged-right and capped at a comfortable line length (about 70 characters) so the reader can scan it;
   demo frames and screenshots below it may use the full column. */
.help-p { margin: 0; line-height: 1.6; max-width: 70ch; }
.help-p code, .help-callout code { font-size: 0.85em; padding: 0 0.25rem; border-radius: 4px; background: hsl(var(--muted)); }
/* Lists in article prose: plain points and numbered steps (each item holds a HelpParagraph). */
.help-list, .help-steps { margin: 0; padding-left: 1.25rem; display: grid; gap: 0.375rem; }
.help-list { list-style: disc; }
.help-steps { list-style: decimal; }
.help-list > li::marker { color: hsl(var(--muted-foreground)); }
/* Step numbers in the pin colour: step N in the text is pin N on the picture. */
.help-steps > li::marker { color: var(--help-pin); font-weight: 700; }
.help-p a, .help-callout a { color: hsl(var(--help-link, var(--primary))); text-decoration: underline; }

.help-toc {
    position: sticky; top: 1rem; display: grid; gap: 0.375rem; font-size: 0.8125rem;
    border-left: 1px solid hsl(var(--border)); padding-left: 0.75rem;
}
.help-toc-title { color: hsl(var(--muted-foreground)); }
.help-toc ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.25rem; }
.help-toc a { color: hsl(var(--foreground)); text-decoration: none; }
.help-toc a:hover { color: hsl(var(--help-link, var(--primary))); }

/* Demo frame ("Example"): dashed service-blue frame with a label on the border (sketch C). */
.help-demo {
    position: relative; margin: 0.5rem 0 0; padding: 1rem 0.875rem 0.875rem; display: grid; gap: 0.75rem;
    border: 1px dashed hsl(var(--svc)); border-radius: var(--radius);
    background: color-mix(in srgb, hsl(var(--svc)) 6%, transparent);
}
/* The label sits on the top border but stays in flow: a long caption that wraps (phones) pushes the content down instead
   of covering the first line of the scene. */
.help-demo-label {
    position: relative; justify-self: start; max-width: 100%;
    margin: -1.45rem 0 0 -0.25rem; padding: 0 0.375rem;
    background: hsl(var(--background)); color: hsl(var(--svc));
    font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.06em; line-height: 1.6; text-transform: uppercase;
}
/* The content box scrolls sideways (a wide scene on a phone); only its children ignore the pointer, so a finger or the
   wheel still scrolls the box itself. */
.help-demo-content { position: relative; min-width: 0; overflow-x: auto; }
.help-demo[data-interactive="false"] .help-demo-content > * { pointer-events: none; }

.help-pin {
    display: inline-grid; place-items: center; flex: none; width: 1.125rem; height: 1.125rem; border-radius: 50%;
    /* Help's own marker colour, never the theme's primary: the app's step circles and count badges use primary, and a
       pin "2" next to a step "2" must not look like part of the app. Callout numbers share it, so they match. */
    background: var(--help-pin); color: #fff;
    font-size: 0.6875rem; font-weight: 700; line-height: 1; vertical-align: middle;
}
.help-callouts { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.375rem; font-size: 0.8125rem; }
.help-callout { display: grid; grid-template-columns: 1.375rem minmax(0, 1fr); gap: 0.375rem; align-items: start; }

/* Screenshot figure ("Screenshot") */
.help-shot {
    margin: 0; display: grid; gap: 0.5rem; padding: 0.75rem;
    border: 1px solid hsl(var(--border)); border-radius: var(--radius); background: hsl(var(--card));
}
.help-shot-label {
    font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;
    color: hsl(var(--muted-foreground));
}
.help-shot img { max-width: 100%; height: auto; border-radius: calc(var(--radius) - 2px); }
/* Numbered markers over a screenshot (HelpShotPin): the image fills the frame (full article width, like the demo
   frames), so the frame is exactly the image and % positions follow its scaling. */
.help-shot { grid-template-columns: minmax(0, 1fr); }
.help-shot > img { justify-self: start; }
/* The frame is exactly the picture at its real on-screen size (--shot-w, from the sidecar; srcset 2x), never wider than
   the column and never blown up, so % positions of pins and outlines follow it. */
.help-shot-frame { position: relative; justify-self: start; width: min(100%, var(--shot-w, 100%)); line-height: 0; }
.help-shot-frame img { display: block; width: 100%; }
/* Phones: a wide picture keeps a readable size and scrolls sideways (its pins with it) instead of shrinking to a strip. */
@media (max-width: 640px) {
    .help-shot { overflow-x: auto; }
    .help-shot-frame, .help-shot > img { min-width: min(var(--shot-w, 0px), 40rem); }
}
.help-shot-pin {
    position: absolute; transform: translate(-50%, -50%); width: 1.375rem; height: 1.375rem; font-size: 0.75rem;
    line-height: 1; box-shadow: 0 0 0 2px hsl(var(--background));
}
/* The edge facing the target sits on the anchor point (HelpShotLayout), so a pin never covers what it points at. */
.help-shot-pin--left { transform: translate(-100%, -50%); }
.help-shot-pin--right { transform: translate(0, -50%); }
.help-shot-pin--above { transform: translate(-50%, -100%); }
.help-shot-pin--below { transform: translate(-50%, 0); }
/* Just outside the outline's top-left corner (touching it), so it never hides the first letter of the target's label. */
.help-shot-pin--corner { transform: translate(-100%, -100%); }
.help-shot-caption { font-size: 0.8125rem; color: hsl(var(--muted-foreground)); }
.help-shot-missing {
    display: grid; gap: 0.25rem; place-content: center; min-height: 8rem; padding: 1rem; text-align: center;
    border: 1px dashed hsl(var(--border)); border-radius: calc(var(--radius) - 2px);
    color: hsl(var(--foreground)); font-size: 0.8125rem;
}
.help-shot-missing-note { color: hsl(var(--muted-foreground)); font-size: 0.75rem; }

/* Demo scenes (Help/HelpScene, Demo/HelpScenes) */
.help-scene { min-width: 0; }
/* The /lamps "Offline ze zdarzeniem" tile spans two columns at viewports ≤1600px (appshell.css); a scene has its own
   auto-fill columns, so it keeps one cell there and the scene looks the same at every viewport. */
.help-scene .fleet-state-tiles > [data-kpi="offlineevent"] { grid-column: auto; }
/* Static scenes (cached markup, no JS): tables show their rows at once. Their skeleton and the "until widths are
   measured" fade (LumDataTable's first-paint guards, cleared by JS in the app) would otherwise hold them hidden. */
.help-scene[data-help-static] .lum-table-skeleton { display: none; }
.help-scene[data-help-static] .lum-table-container .lum-table-scrollwrap,
.help-scene[data-help-static] .lum-table-container .lum-table-mobile,
.help-scene[data-help-static] .lum-table-container .lum-table-pagination { opacity: 1; animation: none; }
/* Without the JS column measure the service ticket's columns are equal and the Status text ("Zakończone · reason", the
   point of service-mode#return) would be cut: let it wrap in the cell instead. */
.help-scene[data-help-static] .svc-ticket-table .lum-table-cell:has(> .svc-ticket-state),
.help-scene[data-help-static] .svc-ticket-table .svc-ticket-state { white-space: normal; }
/* The report list (scene reports-list): without the JS column measure every auto column of a static table is at least
   150 px, so the six columns overflow the article column and "Akcje" (the eye, lock and bin the article pins) is cut.
   The widths the page measures, a little tighter cells and the article's smaller icon buttons keep the row whole. */
.help-scene[data-help-scene="reports-list"] .lum-table-container {
    --lum-cw-Created: minmax(8rem, 1fr); --lum-cw-Type: minmax(8.25rem, 1fr); --lum-cw-From: minmax(5.5rem, 1fr);
    --lum-cw-To: minmax(5.5rem, 1fr); --lum-cw-IsPublic: minmax(5.75rem, 1fr); --lum-cw-Actions: 7.5rem;
    --lum-autosize-min-w: 0px;
}
.help-scene[data-help-scene="reports-list"] .lum-table-grid .lum-table-cell { padding-inline: 0.5rem; }
/* The map layers of app settings (scenes app-settings-map-layers[-motion]): the table starts at the page's "md"
   breakpoint (Nazwa, Włączona, Akcje, as on a desktop); without the JS column measure the widths the page measures, and
   the row's icon buttons as a desktop window shows them (the container query folds them into "⋮" below 720 px, and the
   article column is narrower). */
.help-scene[data-help-scene^="app-settings-map-layers"] .lum-table-container {
    --lum-cw-Name: minmax(9rem, 2fr); --lum-cw-Enabled: minmax(6.5rem, 1fr); --lum-cw-Actions: 10rem;
    --lum-autosize-min-w: 0px;
}
.help-scene[data-help-scene^="app-settings-map-layers"] .lum-table-grid .lum-table-cell { padding-inline: 0.5rem; }
@media (min-width: 641px) {
    .help-scene[data-help-scene^="app-settings-map-layers"] .lum-row-actions-inline { display: flex; }
    .help-scene[data-help-scene^="app-settings-map-layers"] .lum-row-actions-collapsed { display: none; }
}
/* The report's "Oprawy" tab (scenes reports-lamps-tab and reports-lamps-tab-connections, a few columns left out by the
   scene): the same static-table problem, so the measured widths here too. reports-lamps-tab shows the row's three buttons as
   a desktop window does (the table's container query folds them into "⋮" below 720 px, and the article column is
   narrower); the connection variant keeps the "⋮", so the three connection columns get the room. */
.help-scene[data-help-scene="reports-lamps-tab"] .lum-table-container {
    --lum-cw-ControllerSerialNumber: minmax(6.5rem, 1fr); --lum-cw-Address: minmax(8rem, 1.5fr); --lum-cw-State: minmax(8.5rem, 1fr);
    --lum-cw-EventsCount: minmax(5.5rem, 1fr); --lum-cw-Actions: 8.5rem;
    --lum-autosize-min-w: 0px;
}
@media (min-width: 641px) {
    .help-scene[data-help-scene="reports-lamps-tab"] .lum-row-actions-inline { display: flex; }
    .help-scene[data-help-scene="reports-lamps-tab"] .lum-row-actions-collapsed { display: none; }
}
.help-scene[data-help-scene="reports-lamps-tab-connections"] .lum-table-container {
    --lum-cw-ControllerSerialNumber: minmax(6.5rem, 1fr); --lum-cw-FirstConnect: minmax(10.5rem, 1fr);
    --lum-cw-LastDisconnect: minmax(10.5rem, 1fr); --lum-cw-Connections: minmax(9rem, 1fr); --lum-cw-Actions: 3.5rem;
    --lum-autosize-min-w: 0px;
}
.help-scene:is([data-help-scene="reports-lamps-tab"], [data-help-scene="reports-lamps-tab-connections"]) .lum-table-grid .lum-table-cell { padding-inline: 0.5rem; }
/* The "Per lampa" table of /sim-usage (scenes sim-usage-page, -columns, -missing; status, S/N and address left out by the
   scenes): the same static-table problem, so widths that keep ID, CCID and the four SIM columns in the article column. */
.help-scene:is([data-help-scene="sim-usage-page"], [data-help-scene="sim-usage-columns"], [data-help-scene="sim-usage-missing"]) .lum-table-container {
    --lum-cw-CustomId: minmax(4.5rem, 1fr); --lum-cw-Ccid: minmax(10.75rem, 1.4fr); --lum-cw-SimUsedData: minmax(5.5rem, 1fr);
    --lum-cw-DataAllowance: minmax(5.5rem, 1fr); --lum-cw-UsedPercent: minmax(6rem, 1fr); --lum-cw-Timestamp: minmax(8.75rem, 1fr);
    --lum-autosize-min-w: 0px;
}
.help-scene:is([data-help-scene="sim-usage-page"], [data-help-scene="sim-usage-columns"], [data-help-scene="sim-usage-missing"]) .lum-table-grid .lum-table-cell { padding-inline: 0.5rem; }
.help-scene[data-help-scene="sim-usage-history"] .lum-table-container {
    --lum-cw-Timestamp: minmax(8rem, 1fr); --lum-cw-ControllerSN: minmax(5.5rem, 1fr); --lum-cw-CustomId: minmax(5rem, 1fr);
    --lum-cw-Iccid: minmax(11rem, 1.4fr); --lum-cw-UsedData: minmax(5.75rem, 1fr); --lum-cw-DataAllowance: minmax(5.75rem, 1fr);
    --lum-cw-UsedPercent: minmax(5.5rem, 1fr); --lum-autosize-min-w: 0px;
}
.help-scene[data-help-scene="sim-usage-history"] .lum-table-grid .lum-table-cell { padding-inline: 0.5rem; }
.help-scene[data-help-scene="reports-list"] .lum-table-grid .lum-btn-icon { width: 2rem; height: 2rem; }
/* The members table of a motion configuration (MotionMembersTable Compact): its six columns fit the article column, so the
   pinned "Zgłoszone" and "Stan" are on screen without scrolling the table sideways. */
.help-scene[data-help-scene="motion-members"] .lum-table-container {
    --lum-cw-CustomId: minmax(5.5rem, 0.8fr); --lum-cw-Role: minmax(6.5rem, 0.9fr); --lum-cw-Sensor: minmax(8rem, 1fr);
    --lum-cw-DesiredSummary: minmax(7.5rem, 1fr); --lum-cw-ReportedSummary: minmax(7.5rem, 1fr); --lum-cw-SyncState: minmax(6rem, 0.9fr);
    --lum-autosize-min-w: 0px;
}
.help-scene[data-help-scene="motion-members"] .lum-table-grid .lum-table-cell { padding-inline: 0.5rem; }
/* The firmware library (FirmwareLibrary): its columns fit the article column, so the download and bin buttons of a row
   (pinned in admin-tools#firmware-delete) are on screen without scrolling the table sideways. */
.help-scene[data-help-scene="firmware-library"] .lum-table-container {
    --lum-cw-FileName: minmax(10rem, 1.4fr); --lum-cw-FileSize: minmax(5rem, 0.6fr); --lum-cw-UploadUser: minmax(7rem, 1fr);
    --lum-cw-UploadDate: minmax(8rem, 1fr); --lum-autosize-min-w: 0px;
}
/* Tasks tables in the article column: the pinned status pill (Łańcuchy), "Pokaż MQTT" (Zadania z błędami) and the copy button
   of the decoded frame (Komunikacja MQTT; only its raw "Payload" column stays to the right, as in the app) are on screen
   without scrolling the table sideways. */
.help-scene[data-help-scene="tasks-chains-table"] .lum-table-container {
    --lum-cw-Created: minmax(7.5rem, 1fr); --lum-cw-Name: minmax(6.5rem, 1fr); --lum-cw-CreatedBy: minmax(6rem, 1fr);
    --lum-cw-Count: minmax(4.5rem, 0.6fr); --lum-cw-Status: minmax(6.5rem, 0.9fr); --lum-cw-Tasks: minmax(9rem, 1.2fr); --lum-autosize-min-w: 0px;
}
.help-scene[data-help-scene="tasks-failed-table"] .lum-table-container {
    --lum-cw-CustomId: minmax(5.5rem, 1fr); --lum-cw-ControllerSerialNumber: minmax(6.5rem, 1fr); --lum-cw-Created: minmax(6.5rem, 1fr);
    --lum-cw-CreatedBy: minmax(6rem, 1fr); --lum-cw-TaskTypes: minmax(7.5rem, 1.2fr); --lum-cw-Mqtt: minmax(8rem, 0.8fr); --lum-autosize-min-w: 0px;
}
.help-scene[data-help-scene="tasks-mqtt"] .lum-table-container {
    --lum-cw-Timestamp: minmax(6.5rem, 0.8fr); --lum-cw-Direction: minmax(7.5rem, 0.8fr); --lum-cw-FrameType: minmax(9rem, 1fr);
    --lum-cw-FrameDecoded: minmax(12rem, 2fr); --lum-cw-Payload: minmax(14rem, 2fr); --lum-autosize-min-w: 0px;
}
.help-scene:is([data-help-scene="tasks-chains-table"], [data-help-scene="tasks-failed-table"], [data-help-scene="tasks-mqtt"]) .lum-table-grid .lum-table-cell { padding-inline: 0.5rem; }
.help-scene-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
.help-scene-unavailable { margin: 0; font-size: 0.8125rem; color: hsl(var(--muted-foreground)); font-style: italic; }
/* An open report (scene reports-detail): the whole report, without a scroll box of its own; its six tiles three to a row
   in the article column (the page's six across would cut the labels); on a phone the page's own one-column tiles and
   tighter tab buttons, so "Zdarzenia" fits beside the pins' margin. */
.help-demo-content:has(> .help-scene[data-help-scene="reports-detail"]) { max-height: none; }
@media (min-width: 641px) {
    .help-scene[data-help-scene="reports-detail"] .report-kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
    .help-scene[data-help-scene="reports-detail"] .view-mode-toggle .lum-btn { padding-inline: 0.5rem; }
}
/* The wizard's first step on a phone (commands-lamp-selection): the warning and the first cards are the point; the rest of
   the cards fade out instead of a scroll box inside the frame. */
@media (max-width: 640px) {
    .help-demo-content:has(> .help-scene[data-help-scene="commands-lamp-selection"]) {
        max-height: 34rem; overflow-y: hidden;
        -webkit-mask-image: linear-gradient(to bottom, #000 85%, transparent); mask-image: linear-gradient(to bottom, #000 85%, transparent);
    }
}
/* Send-to-service dialog body shown inline (SendToServiceDialog BodyOnly): the modal title and footer, without the modal. */
.help-scene .svc-send-body {
    display: grid; gap: 0.75rem; padding: 1.25rem 1.5rem;
    border: 1px solid hsl(var(--border)); border-radius: var(--radius); background: hsl(var(--card));
    box-shadow: 0 25px 50px -12px rgb(0 0 0 / 0.25);
}
/* The dialog's own panel colour in aurora (LumModal.razor.css .lum-modal-content), without its blur (aurora backdrop policy). */
html[data-theme-style="aurora"] .help-scene .svc-send-body { background: hsl(270 50% 14% / 0.88); border-color: hsl(var(--glass-border)); }
/* "Treść" is a rich-text editor started by JS; in the static scene its text sits in the editor's own field frame. */
.help-scene[data-help-scene="service-send-dialog"] .lum-richtext > .ql-editor {
    border: 1px solid hsl(var(--border)); border-radius: calc(var(--radius) - 2px); background: hsl(var(--background)); padding: 0.5rem 0.75rem;
}
.help-scene .svc-send-body-title { font-weight: 600; font-size: 0.9375rem; color: hsl(var(--foreground)); }
.help-scene .svc-send-body-footer { display: flex; justify-content: flex-end; gap: 0.5rem; flex-wrap: wrap; }

/* Header "?" popover (sketch D) */
.help-context { display: grid; gap: 0.375rem; min-width: 14rem; max-width: 22rem; padding: 0.25rem; font-size: 0.8125rem; }
.help-context-title { font-weight: 600; }
.help-context-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.25rem; }
.help-context-list a { color: hsl(var(--foreground)); text-decoration: none; }
.help-context-list a:hover { color: hsl(var(--help-link, var(--primary))); }
.help-context-open { color: hsl(var(--help-link, var(--primary))); text-decoration: none; font-weight: 500; }

@media (max-width: 900px) {
    .help-article-layout { grid-template-columns: minmax(0, 1fr); }
    .help-toc { order: -1; position: static; border-left: 0; padding-left: 0; }
}

/* Pins on demo scenes (HelpDemoFrame Pins, placed by help-page.js inside the scrolling content box). */
.help-scene-pin {
    position: absolute; z-index: 1; width: 1.375rem; height: 1.375rem; font-size: 0.75rem; line-height: 1;
    box-shadow: 0 0 0 2px hsl(var(--background));
}
.help-scene-pin.help-shot-pin--left { transform: translate(-100%, -50%); }
.help-scene-pin.help-shot-pin--right { transform: translate(0, -50%); }
.help-scene-pin.help-shot-pin--above { transform: translate(-50%, -100%); }
.help-scene-pin.help-shot-pin--below { transform: translate(-50%, 0); }
/* Outside the target's top-left corner (the target itself is outlined), so it never hides the target's label. */
.help-scene-pin.help-shot-pin--corner { transform: translate(-100%, -100%); }
/* Inside the target's top-right corner (tiles and cards in a grid): within the outline, so it never reads as the neighbour's. */
.help-shot-pin--inside, .help-scene-pin.help-shot-pin--inside { transform: translate(-100%, 0); }
/* The pin layer covers the content box; only the pins themselves are drawn. */
.help-scene-pins { position: absolute; inset: 0; pointer-events: none; }
/* Room for pins at the edges of the scene; the top leaves a corner or above pin of the first element (22 px + 4 px gap)
   clear of the frame's "Example" label and of the content box's clipping edge. */
.help-demo[data-help-pins] .help-demo-content { padding: 1.75rem 1.75rem 0.75rem; }

/* TOC: the section being read (help-page.js). */
.help-toc li { position: relative; }
.help-toc a[aria-current="location"] { color: hsl(var(--help-link, var(--primary))); font-weight: 600; }
/* A bar on the TOC's line next to the section being read, so it differs from the hover colour. */
.help-toc a[aria-current="location"]::before {
    content: ""; position: absolute; left: calc(-0.75rem - 1px); top: 0; bottom: 0; width: 3px; border-radius: 2px;
    background: hsl(var(--primary));
}
@media (max-width: 900px) { .help-toc a[aria-current="location"]::before { display: none; } }
.help-toc li.help-toc-group { list-style: none; }

/* "W skrócie" (HelpSummary) */
.help-summary {
    display: grid; gap: 0.375rem; padding: 0.75rem 1rem; max-width: 72ch;
    border-radius: var(--radius); border-left: 3px solid hsl(var(--primary));
    background: color-mix(in srgb, hsl(var(--primary)) 8%, transparent);
}
.help-summary-title { font-size: 0.75rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: hsl(var(--muted-foreground)); }
.help-summary-list { margin: 0; padding-left: 1.125rem; list-style: disc; display: grid; gap: 0.25rem; }

/* "Co oznacza…" legend (HelpLegend): the real element next to its meaning. */
.help-legend-wrap { overflow-x: auto; }
.help-legend { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.help-legend th {
    text-align: left; font-size: 0.75rem; font-weight: 600; color: hsl(var(--muted-foreground));
    padding: 0.375rem 0.75rem; border-bottom: 1px solid hsl(var(--border));
}
.help-legend td { padding: 0.5rem 0.75rem; border-bottom: 1px solid hsl(var(--border)); vertical-align: middle; }
.help-legend-visual { width: 1%; white-space: nowrap; pointer-events: none; }
/* A wide element (an event card) wraps inside a capped column, so the meaning keeps room to read as sentences. */
.help-legend-visual > .help-scene { max-width: 22rem; white-space: normal; }
.help-legend-meaning .help-p { max-width: none; }
/* A badge in the element column ("Droga zamknięta") stays one pill, as in the app's table, never broken over two lines. */
.help-legend-visual .lum-badge { white-space: nowrap; }

/* Collapsed section for a higher role (HelpSection in an article for everyone). */
.help-admin { display: grid; gap: 0.75rem; }
.help-admin > summary {
    display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; cursor: pointer; list-style: none;
    padding: 0.5rem 0.75rem; border: 1px solid hsl(var(--border)); border-radius: var(--radius);
}
.help-admin > summary::-webkit-details-marker { display: none; }
.help-admin > summary::before {
    content: ""; width: 0.5rem; height: 0.5rem; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
    transform: rotate(-45deg); transition: transform 0.15s ease; flex: none;
}
.help-admin[open] > summary::before { transform: rotate(45deg); }
.help-admin > summary .help-role-pill { margin-top: 0; }
.help-admin-body { display: grid; gap: 0.75rem; padding: 0 0.25rem; }
.help-toc-group { margin-top: 0.5rem; font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: hsl(var(--muted-foreground)); }

/* Article footer: previous / next article and "see also". */
.help-article-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; margin-top: 1rem; }
.help-article-nav a {
    display: grid; gap: 0.125rem; padding: 0.625rem 0.875rem; text-decoration: none;
    border: 1px solid hsl(var(--border)); border-radius: var(--radius); background: hsl(var(--card)); color: hsl(var(--card-foreground));
}
.help-article-nav a:hover { border-color: hsl(var(--primary)); }
.help-article-nav .help-nav-next { grid-column: 2; text-align: right; }
.help-nav-dir { font-size: 0.75rem; color: hsl(var(--muted-foreground)); }
.help-nav-title { font-weight: 600; font-size: 0.875rem; }

/* Home: "Zacznij tutaj" and common questions. */
.help-start { display: grid; gap: 0.5rem; }
.help-start-steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 0.75rem; counter-reset: help-start; }
.help-start-steps > li { counter-increment: help-start; }
.help-start-steps .help-card { position: relative; padding-left: 2.75rem; height: 100%; }
.help-start-steps .help-card::before {
    content: counter(help-start); position: absolute; left: 0.875rem; top: 0.75rem;
    display: grid; place-items: center; width: 1.375rem; height: 1.375rem; border-radius: 50%;
    background: hsl(var(--primary)); color: hsl(var(--primary-foreground)); font-size: 0.75rem; font-weight: 700;
}
.help-start-hint { margin: 0; font-size: 0.8125rem; color: hsl(var(--muted-foreground)); }
.help-faq-top { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(18rem, 1fr)); gap: 0.375rem 1.5rem; }
.help-faq-top a { color: hsl(var(--help-link, var(--primary))); text-decoration: none; font-size: 0.875rem; }
.help-faq-top a:hover { text-decoration: underline; }

/* Dialogs shown inline in a scene (LumModal Inline) are shown whole: no scroll box inside the frame, so no field, step or
   pinned button is cut off (the dialog's own caps: 100dvh on the dialog, 90dvh on a phone's content). Only the two reading
   dialogs (map and motion-sensor guides, several screens of text) keep a capped body that scrolls; in a frame that is not
   interactive that body still takes the wheel / finger (scrolling), its controls do not. */
.help-scene .lum-modal-inline .lum-modal-content, .help-scene .lum-modal-inline .lum-modal-body { max-height: none; }
.help-scene:is([data-help-scene="map-help-dialog"], [data-help-scene="motion-guide-dialog"]) .lum-modal-inline .lum-modal-body { max-height: 26rem; overflow-y: auto; }
.help-demo[data-interactive="false"] .help-scene .lum-modal-inline .lum-modal-body { pointer-events: auto; }
.help-demo[data-interactive="false"] .help-scene .lum-modal-inline .lum-modal-body * { pointer-events: none; }
/* The schedule editor (Lmp.Web3 ScheduleEditorModal) in a scene: the app's own stacked layout for narrow screens
   (appshell.css, max-width 1024px), so the chart gets the frame's full width, and no fixed dialog height. */
html .help-scene .lum-modal.lum-modal-inline.schedule-editor-dialog { width: auto; max-width: 100% !important; margin: 0 auto; }
.help-scene .lum-modal.schedule-editor-dialog .lum-modal-content { height: auto !important; max-height: none !important; width: auto; }
.help-scene .lum-modal.schedule-editor-dialog .lum-modal-body { display: block; max-height: none !important; overflow-y: visible !important; }
.help-scene .schedule-identity-mobile { display: block; }
.help-scene .schedule-identity-desktop { display: none; }
.help-scene .schedule-editor-grid { display: flex; flex-direction: column; gap: 1.25rem; align-items: stretch; }
/* A phone's frame is narrower than the app's full-screen editor: the tab strip scrolls instead of widening the panel. */
.help-scene .schedule-editor-left > .flex > div { min-width: 0; max-width: 100%; }
.help-scene .schedule-editor-tab-toolbar { min-height: 0; }
.help-scene .schedule-editor-right { border-left: none; border-top: 1px solid hsl(var(--border)); padding-left: 0; padding-top: 1rem; }
/* An open popover (LumPopover Inline) scrolls the same way. */
.help-demo[data-interactive="false"] .help-scene .lum-popover-inline { pointer-events: auto; }
.help-demo[data-interactive="false"] .help-scene .lum-popover-inline * { pointer-events: none; }
/* A wide table of a Static scene scrolls sideways the same way (its own scroll box, not the frame's). */
.help-demo[data-interactive="false"] .help-scene .lum-table-scrollwrap { pointer-events: auto; }
.help-demo[data-interactive="false"] .help-scene .lum-table-scrollwrap * { pointer-events: none; }
.help-faq-skeleton { display: inline-block; width: 70%; height: 0.875rem; border-radius: 4px; }

/* The page tiles in the article column (narrower than the pages: Lamps, Status, Odczyty, Energia, Natężenie ruchu): as
   many tiles per row as fit, never squeezed or running past the column (five Energy tiles would). */
.help-scene .page-stat-grid,
.help-scene .page-stat-grid.fleet-state-tiles { grid-template-columns: repeat(auto-fill, minmax(min(12.5rem, 100%), 1fr)); }
/* The Energy totals carry long values ("25 390,48 kWh"): two to a row, so label and value fit side by side. */
@media (min-width: 641px) {
    .help-scene[data-help-scene="energy-stat-tiles"] .page-stat-grid { grid-template-columns: repeat(auto-fill, minmax(min(17rem, 100%), 1fr)); }
}
/* Phones: two columns, as the pages themselves (appshell.css .page-stat-grid at max-width 640px); a long label wraps. */
@media (max-width: 640px) {
    .help-scene .page-stat-grid,
    .help-scene .page-stat-grid.fleet-state-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .help-scene .page-stat-grid .page-stat-label { white-space: normal; }
}
/* A tile pinned inside its top-right corner (HelpPinSide.Inside): the value, right-aligned in the tile, keeps clear of the pin. */
.help-demo[data-help-pins] .help-scene .page-stat-card { padding-right: 2.25rem; }
/* Advanced filter in the narrow article column of a phone: the group's buttons wrap from the left instead of running
   out of the card (the page itself is wider). */
@media (max-width: 640px) {
    .help-scene .lum-filter-group-actions { flex-wrap: wrap; justify-content: flex-start; }
    /* Toast and reconnect scenes (help-basics) fit the phone column instead of running past its right edge; the
       reconnect dialog's own width comes from an id selector (ReconnectModal.razor.css), hence !important. */
    .help-toast-demo .lum-toast { min-width: 0; }
    .help-scene .components-reconnect-preview { width: auto !important; max-width: 100%; padding: 1.25rem; }
}
/* Status tab scene: the whole tab, not a scroll box with its last row cut. */
.help-demo-content:has(> .help-scene[data-help-scene="lamp-card-status"]) { max-height: none; }

/* Leaflet maps need JS (Info tab mini map, manual-position editor): a static scene shows a quiet hatched placeholder of the
   map's own size instead of an empty box. */
.help-scene[data-help-static] .lamp-drawer-map:empty,
.help-scene[data-help-static] .gps-edit-map:empty {
    background: repeating-linear-gradient(45deg, transparent 0 10px, color-mix(in srgb, hsl(var(--border)) 70%, transparent) 10px 11px);
}

/* The rich-text editor (Quill, started by JS) of a form in a static scene (note-dialog-add): an empty box of the editor's own
   size and frame instead of nothing. */
.help-scene[data-help-static] .lum-richtext:not(.lum-richtext-readonly) > div:empty {
    border: 1px solid hsl(var(--border)); border-radius: var(--radius); background: hsl(var(--background));
}

/* Map widgets (host scenes map-*, Lmp.Web3/Help/HostHelpScenes.cs): on /map they float over the map (absolute, centred on
   the map container, glass blur); in a scene they sit in the frame's flow, without the blur (aurora backdrop policy). */
.help-scene :is(.map-toolbar, .map-kpi, .map-search, .map-bulk-actions, .map-fixtures-drawer, .map-light-legend) {
    position: relative; inset: auto; transform: none; max-width: 100%; z-index: auto;
}
.help-scene :is(.map-toolbar, .map-kpi, .map-search .map-search-input-wrapper, .map-search .map-search-dropdown,
    .map-bulk-actions, .map-style-list, .map-style-toggle, .map-fixtures-drawer) {
    -webkit-backdrop-filter: none; backdrop-filter: none;
}
.help-scene .map-toolbar { display: inline-block; }
/* Wrapped toolbar and bottom bar: room above every row for the pins (side Above), so a pin sits over its own button,
   never in the gap where it would read as the neighbour's or cover the count badge of the button above. */
.help-scene .map-toolbar-scroll { flex-wrap: wrap; overflow: visible; gap: 1.875rem 1.25rem; padding-top: 1.5rem; }
.help-scene .map-bulk-actions { row-gap: 1.875rem; padding-top: 1.5rem; }
/* The energy prices toolbar wraps on a phone: room above its second row for the pins (side Above). */
.help-scene[data-help-scene="energy-prices-view"] .page-toolbar-right { row-gap: 1.875rem; }
/* The chain buttons ("Ponów nieudane", "Anuluj łańcuch") wrap on a phone: room above the second row for its pin. */
.help-scene .flex-wrap:has(> [data-testid="chain-retry"]) { row-gap: 1.875rem; }
.help-scene .map-kpi { display: inline-block; min-width: 14rem; }
/* "Status światła": the groups wrap in the article's column (on the map the legend leaves room for the panel). */
.help-scene .map-light-legend { display: inline-flex; right: auto; bottom: auto; }
/* Pinned groups (light-state#map): a little room between them, so the side pins of neighbouring rows do not touch. */
.help-demo[data-help-pins] .help-scene .map-light-legend [data-legend-group] + [data-legend-group] { margin-top: 0.25rem; }
.help-scene .map-search { width: min(280px, 100%); }
.help-scene .map-bulk-actions { display: inline-flex; flex-wrap: wrap; }
.help-scene .map-fixtures-drawer { height: 26rem; pointer-events: auto; border-bottom: 1px solid hsl(var(--border)); border-radius: 12px; }
.help-scene .lum-popover-backdrop { display: none; }
.help-map-layers { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 1.5rem; }
.help-map-swatch { display: inline-block; vertical-align: middle; }
.help-map-swatch--faded { width: 9px; height: 9px; opacity: 0.55; }

/* Scene help-article-anatomy: "W skrócie" next to the article's TOC, the previous / next footer below (the article
   page's own layout, compressed into a demo frame). Scene help-context: room for the open popover under the "?". */
.help-anatomy-demo { display: grid; grid-template-columns: minmax(0, 1fr) 13rem; gap: 1rem 1.5rem; align-items: start; }
.help-anatomy-demo .help-toc { position: static; }
.help-anatomy-nav { grid-column: 1 / -1; }
.help-context-demo { display: flex; justify-content: flex-end; min-height: 12rem; }
/* Scenes help-toast and table-export-menu: room on the left for the numbered pins beside the toast and the button. */
.help-toast-demo, .help-export-demo { padding-left: 2.25rem; }
.help-toast-demo .lum-toast { max-width: 24rem; }
@media (max-width: 640px) {
    .help-anatomy-demo { grid-template-columns: minmax(0, 1fr); }
}

/* Pin targets outlined (scenes: help-page.js; screenshots: HelpScreenshot), drawn under the pins. */
.help-scene-box, .help-shot-box {
    position: absolute; border: 2px solid var(--help-pin); border-radius: 6px; pointer-events: none;
    box-shadow: 0 0 0 2px color-mix(in srgb, hsl(var(--background)) 60%, transparent);
}
.help-shot-box { box-sizing: border-box; }
.help-scene-pin, .help-shot-pin { z-index: 2; }

/* A tall scene without pins (a whole tab shown as a picture) scrolls inside its frame instead of running for screens. A
   frame with pins, or holding an inline dialog, is shown whole: a pin's target is never in a hidden part of a scroll box,
   and the reader never meets a second scrollbar inside the article. */
.help-demo-content { max-height: 38rem; overflow-y: auto; }
.help-demo[data-help-pins] .help-demo-content, .help-demo-content:has(> .help-scene .lum-modal-inline) { max-height: none; }

/* Legend on phones: each row stacks the element above its meaning, nothing scrolls sideways. */
@media (max-width: 640px) {
    .help-legend thead { display: none; }
    .help-legend, .help-legend tbody, .help-legend tr, .help-legend td { display: block; width: 100%; }
    .help-legend tr { padding: 0.5rem 0; border-bottom: 1px solid hsl(var(--border)); }
    .help-legend td { border: 0; padding: 0.25rem 0.5rem; }
    .help-legend-visual { white-space: normal; }
}
