/* ===== Ustawienia (Components/Pages/Settings/Settings.razor) =====
   Układ 1:1 ze strony ustawień WMS24.Control (src/App.Web/wwwroot/css/settings.css):
   spis sekcji z licznikami, przełącznik widoku, wyszukiwarka ze skrótem „/", „Ostatnio",
   kafelki w trzech widokach. Kolory kafelków i ikony zostają LogDeskowe (tile-*, icon-bs-*). */
.stg {
    --stg-text: #1f2328;
    --stg-muted: #6b7280;
    --stg-border: #e5e7eb;
    --stg-card: #ffffff;
    --stg-soft: #f6f5f9;
    --stg-shadow: 0 8px 24px rgba(20, 16, 40, .05);
    --stg-accent: var(--main-color, #ff5a0a);
    --stg-accent-soft: rgba(var(--main-rgb), .15);
    color: var(--stg-text);
    --stg-bar-bg: rgba(250, 250, 251, .86);
    --stg-top: 16px;
}

html[data-theme="dark"] .stg {
    --stg-text: var(--ld-text, #ece9e2);
    --stg-muted: var(--ld-text-muted, #a6a29a);
    --stg-border: var(--ld-border, #3a3936);
    --stg-card: var(--ld-surface, #262624);
    --stg-soft: rgba(255, 255, 255, .04);
    --stg-shadow: 0 8px 25px rgba(0, 0, 0, .35);
}

.stg-layout {
    display: grid;
    grid-template-columns: 230px minmax(0, 1fr);
    gap: 24px;
    align-items: start;
}

/* ----- spis sekcji ----- */
.stg-toc {
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 4px;
    border: 1px solid var(--stg-border);
    border-radius: 12px;
    background: var(--stg-soft);
    font-size: 13.5px;
}

    .stg-toc a {
        display: flex;
        align-items: center;
        gap: 10px;
        min-height: 38px;
        padding: 6px 10px;
        border-radius: 9px;
        color: var(--stg-muted);
        line-height: 1.2;
        text-decoration: none !important;
        transition: background .15s, color .15s;
    }

        .stg-toc a:focus:not(:focus-visible) {
            outline: none;
        }

        .stg-toc a .stg-toc-ic {
            flex: none;
            opacity: .65;
        }

        .stg-toc a:hover {
            color: var(--stg-text);
        }

        .stg-toc a span.stg-toc-n {
            margin-left: auto;
            font-size: 11.5px;
            opacity: .8;
        }

        .stg-toc a.on {
            background: var(--stg-card);
            color: var(--stg-text);
            font-weight: 600;
            box-shadow: 0 1px 3px rgba(0, 0, 0, .2);
        }

            .stg-toc a.on .stg-toc-ic {
                opacity: 1;
            }

/* ----- przełącznik widoku i wyszukiwarka ----- */
.stg-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.stg-search {
    display: flex;
    flex: 1 1 auto;
    align-items: center;
    gap: 10px;
    height: 40px;
    margin: 0;
    padding: 0 12px;
    border: 1px solid var(--stg-border);
    border-radius: 12px;
    background: var(--stg-soft);
    transition: border-color .15s, box-shadow .15s, background .15s;
}

    .stg-search:focus-within {
        border-color: var(--stg-accent);
        background: var(--stg-card);
        box-shadow: 0 0 0 3px var(--stg-accent-soft);
    }

    .stg-search > .stg-search-ic {
        flex: none;
        opacity: .55;
    }

    .stg-search input {
        flex: 1;
        min-width: 0;
        border: 0;
        outline: 0;
        background: none;
        color: var(--stg-text);
        font: inherit;
        font-size: 14px;
    }

        .stg-search input::placeholder {
            color: var(--stg-muted);
        }

        .stg-search input::-webkit-search-cancel-button {
            -webkit-appearance: none;
        }

    .stg-search kbd {
        padding: 2px 6px;
        border: 1px solid var(--stg-border);
        border-radius: 5px;
        background: none;
        box-shadow: none;
        color: var(--stg-muted);
        font-family: inherit;
        font-size: 11px;
        font-weight: 600;
    }

.stg-views {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    box-sizing: border-box;
    height: 40px;
    gap: 3px;
    padding: 3px;
    border: 1px solid var(--stg-border);
    border-radius: 10px;
    background: var(--stg-soft);
}

    .stg-views button {
        display: grid;
        place-items: center;
        width: 32px;
        height: 32px;
        border: 0;
        border-radius: 8px;
        background: none;
        cursor: pointer;
        opacity: .6;
    }

        .stg-views button.on {
            background: var(--stg-card);
            box-shadow: 0 1px 3px rgba(0, 0, 0, .2);
            opacity: 1;
        }

/* ----- ostatnio ----- */
.stg-recent {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 22px;
}

.stg-recent-l {
    align-self: center;
    margin-right: 4px;
    color: var(--stg-muted);
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: .05em;
    text-transform: uppercase;
}

.stg-chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    height: 32px;
    padding: 0 12px 0 6px;
    border: 1px solid var(--stg-border);
    border-radius: 99px;
    background: var(--stg-card);
    color: var(--stg-text);
    font-size: 12.5px;
    cursor: pointer;
    text-decoration: none !important;
}

    .stg-chip:hover {
        border-color: var(--stg-accent);
        color: var(--stg-text);
    }

    .stg-chip .stg-chip-ic {
        display: grid;
        place-items: center;
        width: 22px;
        height: 22px;
        border-radius: 6px;
    }

        .stg-chip .stg-chip-ic span {
            width: .8rem;
            height: .8rem;
            top: 0;
        }

/* ----- sekcje i kafelki ----- */
.stg-section {
    margin-bottom: 28px;
    scroll-margin-top: 12px;
}

    .stg-section h2 {
        margin: 0 0 2px;
        color: var(--stg-text);
        font-size: 15px;
        font-weight: 700;
    }

.stg-section-desc {
    margin: 0 0 12px;
    color: var(--stg-muted);
    font-size: 12.5px;
}

.stg-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
    gap: 12px;
}

.stg-tile {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px;
    border: 1px solid var(--stg-border);
    border-radius: 16px;
    background: var(--stg-card);
    box-shadow: var(--stg-shadow);
    color: var(--stg-text);
    cursor: pointer;
    text-decoration: none !important;
    transition: border-color .15s, transform .15s;
}

    .stg-tile:hover {
        border-color: var(--stg-accent);
        color: var(--stg-text);
        transform: translateY(-1px);
    }

.stg-ic {
    display: grid;
    flex: none;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 12px;
}

    .stg-ic span {
        top: 0;
    }

.stg-tx {
    flex: 1;
    min-width: 0;
}

    .stg-tx h3 {
        margin: 0;
        color: var(--stg-text);
        font-size: 14px;
        font-weight: 600;
    }

    .stg-tx p {
        margin: 3px 0 0;
        color: var(--stg-muted);
        font-size: 12.5px;
        line-height: 1.35;
    }

    .stg-tx mark {
        padding: 0 1px;
        border-radius: 2px;
        background: var(--stg-accent-soft);
        color: inherit;
    }

.stg-kw {
    margin-top: 5px;
    color: var(--stg-muted);
    font-size: 11px;
}

    .stg-kw b {
        color: var(--stg-text);
        font-weight: 600;
    }

.stg-go {
    flex: none;
    opacity: .45;
}

.stg-empty {
    padding: 50px 20px;
    color: var(--stg-muted);
    text-align: center;
}

    .stg-empty .stg-empty-ic {
        display: block;
        width: 32px;
        height: 32px;
        margin: 0 auto 8px;
        opacity: .5;
    }

/* ----- widoki ----- */
.stg-compact .stg-tx p,
.stg-compact .stg-kw,
.stg-compact .stg-section-desc {
    display: none;
}

.stg-compact .stg-grid {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}

.stg-compact .stg-ic {
    width: 36px;
    height: 36px;
}

.stg-list .stg-grid {
    grid-template-columns: 1fr;
    gap: 6px;
}

.stg-list .stg-tile {
    padding: 10px 14px;
    border-radius: 12px;
    box-shadow: none;
}

.stg-list .stg-ic {
    width: 32px;
    height: 32px;
    border-radius: 9px;
}

    .stg-list .stg-ic span {
        width: 1.1rem;
        height: 1.1rem;
    }

.stg-list .stg-tx {
    display: grid;
    grid-template-columns: 260px 1fr;
    align-items: center;
    gap: 12px;
}

    .stg-list .stg-tx p {
        margin: 0;
    }

@media (max-width: 1000px) {
    .stg-layout {
        grid-template-columns: 1fr;
    }

    .stg-toc {
        display: none;
    }

    .stg-list .stg-tx {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .stg-grid {
        grid-template-columns: 1fr;
    }

    .stg-search kbd {
        display: none;
    }
}

/* ===== Lewy panel jak w ustawieniach FlowHuba (Pages/Settings/Settings.razor.css, .stg-side) =====
   Jedna karta po lewej: widok (na całą szerokość), filtr, „Ostatnio", liczba wyników, kreska, spis sekcji.
   Przyklejona przy przewijaniu; gdy wyższa niż okno — przewija się w środku. Po prawej same sekcje.
   Górna krawędź panelu i pierwszej sekcji = --stg-top od krawędzi obszaru treści (w linii z przyciskiem „+"
   w pasku bocznym). --stg-pad = górny odstęp obszaru przewijania (LogDeskSettingsPage.init); sticky liczy
   się od krawędzi przewijanego obszaru, nie od jego odstępu, stąd odejmowanie. Ciemny motyw: theme-dark.css. */
.stg-side {
    position: sticky;
    top: calc(var(--stg-top) - var(--stg-pad, 0px));
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 0;
    max-height: calc(100vh - var(--stg-top) * 2 - 64px);
    margin-top: calc(var(--stg-top) - var(--stg-pad, 0px));
    overflow-y: auto;
    padding: 10px;
    border: 1px solid var(--stg-border);
    border-radius: 14px;
    background: var(--stg-soft);
    scrollbar-width: thin;
}

.stg-main {
    min-width: 0;
    margin-top: calc(var(--stg-top) - var(--stg-pad, 0px));
}

    .stg-side .stg-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
        margin: 0;
    }

    .stg-side .stg-views {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        width: 100%;
    }

        .stg-side .stg-views button {
            width: 100%;
        }

    /* Filtr jak karta (białe pole na szarym panelu), tak jak we FlowHubie. */
    .stg-side .stg-search {
        flex: none;
        background: var(--stg-card);
    }

    /* „Ostatnio" jako pionowa lista w panelu (zamiast pigułek nad treścią) */
    .stg-side .stg-recent {
        display: flex;
        flex-direction: column;
        flex-wrap: nowrap;
        gap: 2px;
        margin: 2px 0 0;
    }

    .stg-side .stg-recent-l {
        align-self: flex-start;
        margin-right: 0;
        padding: 0 8px 4px;
        font-size: 11px;
        font-weight: 700;
        letter-spacing: .06em;
    }

    .stg-side .stg-chip {
        height: auto;
        min-height: 32px;
        padding: 5px 8px;
        gap: 10px;
        border: 0;
        border-radius: 9px;
        background: none;
        color: var(--stg-muted);
        font-size: 13.5px;
        line-height: 1.2;
    }

        .stg-side .stg-chip:hover {
            background: var(--stg-card);
            color: var(--stg-text);
        }

        .stg-side .stg-chip .stg-chip-ic {
            flex: none;
        }

.stg-count {
    padding: 0 6px 8px;
    border-bottom: 1px solid var(--stg-border);
    color: var(--stg-muted);
    font-size: 12px;
}

/* Spis sekcji bez własnej ramki — jest w karcie panelu. */
.stg-side .stg-toc {
    position: static;
    margin: 0;
    padding: 0;
    border: 0;
    background: none;
}

.stg-section {
    scroll-margin-top: var(--stg-top);
}

@media (max-width: 1000px) {
    .stg-side {
        position: static;
        max-height: none;
    }

    /* Spis sekcji znika (jak we FlowHubie), widok i filtr zostają nad kafelkami. */
    .stg-side .stg-toc {
        display: none;
    }

    .stg-count {
        padding-bottom: 0;
        border-bottom: 0;
    }

    .stg-main {
        margin-top: 0;
    }
}

/* Ikona wybranej sekcji w spisie w kolorze akcentu (jak w Controlu i FlowHubie). Ikony icon-bs-* to
   czarne obrazki SVG, nie font — kolor marki dostają filtrem. Selektor z html[data-theme], żeby wygrał
   z globalnym odwracaniem ikon w ciemnym motywie (theme-dark.css); palety nadpisują go po swojemu
   (theme-miami.css, ten sam selektor .stg-toc a.on .stg-toc-ic). */
.stg-toc a.on .stg-toc-ic,
html[data-theme] .stg-toc a.on .stg-toc-ic {
    filter: invert(45%) sepia(90%) saturate(2800%) hue-rotate(358deg) brightness(101%) contrast(104%) !important;
}

