/* ═══════════════════════════════════════════════════════
   HELP dialog (js/help_panel.js): topics, the help assistant, and
   the Report a problem form (js/bug_report.js)
   ═══════════════════════════════════════════════════════ */

.bug-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1200;                       /* above the drawers and the preview; tours sit higher */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}
.bug-dialog {
    width: min(560px, 100%);
    max-height: calc(100dvh - 2rem);
    overflow-y: auto;
    padding: 1.2rem 1.25rem 1rem;
    border-radius: 16px;
    background: var(--bg-primary);
    color: var(--text-primary);
    box-shadow: var(--neo-float);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.bug-dialog h3 { margin: 0; font-size: 1.1rem; }
.bug-dialog p { margin: 0; font-size: 0.85rem; color: var(--text-secondary); }
.bug-dialog label { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.82rem; font-weight: 600; color: var(--text-secondary); }
.bug-dialog textarea, .bug-dialog input[type="text"] {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: var(--bg-deep);
    color: var(--text-primary);
    font: inherit;
    font-size: 0.9rem;
    font-weight: 400;
}
.bug-dialog textarea { min-height: 110px; resize: vertical; }
.bug-dialog .bug-check { flex-direction: row; align-items: center; gap: 0.45rem; }
.bug-dialog .bug-check input { accent-color: var(--brand-orange); }
.bug-diag {
    margin: 0;
    max-height: 170px;
    overflow: auto;
    padding: 0.55rem 0.7rem;
    border-radius: 10px;
    background: var(--bg-deep);
    color: var(--text-secondary);
    font: 0.72rem/1.4 Consolas, "Courier New", monospace;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}
.bug-diag.dimmed { opacity: 0.45; }
.bug-error { padding: 0.55rem 0.75rem; border-radius: 10px; background: #fee2e2; color: #991b1b; font-size: 0.85rem; }
.bug-actions { display: flex; justify-content: flex-end; gap: 0.5rem; }
.bug-actions button {
    min-height: 40px;
    padding: 0 1rem;
    border: none;
    border-radius: 10px;
    font-weight: 700;
    cursor: pointer;
    background: var(--bg-primary);
    color: var(--text-primary);
    box-shadow: var(--neo-btn);
}
.bug-actions .bug-send { background: var(--brand-orange); color: #111111; }
.bug-actions button:disabled { opacity: 0.6; cursor: progress; }
.bug-dialog :focus-visible { outline: 2px solid var(--brand-cyan); outline-offset: 2px; }

/* The page footer: Take the tour (Help and Report a problem are in the launcher). Its bottom padding
   keeps it clear of the Help launcher when the page is scrolled to the end. */
.site-footer { display: flex; justify-content: center; gap: 0.5rem; flex-wrap: wrap; margin-top: 2.5rem; padding: 1.25rem 0 calc(var(--fab-size) + var(--fab-gap)); border-top: 1px solid var(--border-color); }

/* The Help launcher, floating in the corner (as in erpbt). Below every drawer and modal (999+), so
   they cover it; above the tour invitation (900). While Help is open it rises above the backdrop
   (1200) and goes quiet: the panel is the thing to look at, and a second click closes it. */
.help-launcher {
    position: fixed;
    right: var(--fab-gap);
    bottom: calc(var(--fab-gap) + env(safe-area-inset-bottom, 0px));
    z-index: 950;
    display: flex;
    align-items: center;
    justify-content: center;
    width: var(--fab-size);
    height: var(--fab-size);
    padding: 0;
    border: none;
    border-radius: 50%;
    background: var(--brand-orange);
    color: #111111;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(0, 0, 0, 0.08);
    cursor: pointer;
    transition: filter 0.15s, background 0.15s, color 0.15s;
}
.help-launcher:hover { filter: brightness(1.07); }
.help-launcher:focus-visible { outline: 2px solid var(--brand-cyan); outline-offset: 3px; }
.help-launcher[aria-expanded="true"] { z-index: 1201; background: var(--bg-primary); color: var(--text-secondary); }

/* Help opens above the launcher, at the right, instead of in the middle of the page. */
.help-backdrop {
    align-items: flex-end;
    justify-content: flex-end;
    padding: 1rem var(--fab-gap) calc(var(--fab-gap) + var(--fab-size) + 0.75rem + env(safe-area-inset-bottom, 0px));
    background: rgba(0, 0, 0, 0.35);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
}
.help-backdrop .bug-dialog { width: min(440px, 100%); max-height: 100%; }

/* Help: header, tabs, topics, assistant */
.help-dialog { gap: 0.7rem; }
.help-head { display: flex; align-items: center; justify-content: space-between; }
.help-close {
    width: 36px;
    height: 36px;
    border: none;
    border-radius: 10px;
    background: var(--bg-primary);
    box-shadow: var(--neo-btn);
    color: var(--text-secondary);
    font-size: 1.3rem;
    cursor: pointer;
}
.help-tabs { display: flex; gap: 0.4rem; border-bottom: 1px solid var(--border-color); }
.help-tab {
    padding: 0.45rem 0.9rem;
    border: none;
    border-bottom: 2px solid transparent;
    background: none;
    color: var(--text-secondary);
    font-weight: 700;
    font-size: 0.86rem;
    cursor: pointer;
}
.help-tab[aria-selected="true"] { color: var(--text-primary); border-bottom-color: var(--brand-orange); }
.help-panel { display: flex; flex-direction: column; gap: 0.7rem; }
.help-panel[hidden] { display: none; }
.help-panel input[type="search"] {
    width: 100%;
    padding: 0.55rem 0.75rem;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    background: var(--bg-deep);
    color: var(--text-primary);
    font: inherit;
    font-size: 0.9rem;
    font-weight: 400;
}
.help-results { list-style: none; margin: 0; padding: 0; max-height: 240px; overflow-y: auto; display: flex; flex-direction: column; gap: 0.45rem; }
.help-results li { padding: 0.55rem 0.7rem; border-radius: 10px; background: var(--bg-deep); }
.help-results strong { display: block; font-size: 0.86rem; color: var(--text-primary); }
.help-results p { margin: 0.2rem 0 0; font-size: 0.82rem; }
.help-results .help-none { font-size: 0.84rem; color: var(--text-secondary); }
.chat { display: flex; flex-direction: column; gap: 0.6rem; border-top: 1px solid var(--border-color); padding-top: 0.7rem; }
.chat-note, .chat-off { font-size: 0.8rem; }
.chat-log { max-height: 260px; overflow-y: auto; display: flex; flex-direction: column; gap: 0.5rem; }
.chat-log:empty { display: none; }
.chat-msg { padding: 0.5rem 0.7rem; border-radius: 10px; background: var(--bg-deep); }
.chat-msg p { margin: 0.15rem 0 0; color: var(--text-primary); font-size: 0.86rem; white-space: pre-wrap; overflow-wrap: anywhere; }
.chat-user { align-self: flex-end; max-width: 85%; }
.chat-assistant { align-self: flex-start; max-width: 95%; }
.chat-who { font-size: 0.7rem; font-weight: 700; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.04em; }
.chat textarea { min-height: 56px; }
