/**
 * Algo4Retail Trend Nawigator — frontend styles.
 *
 * Wszystkie klasy z prefiksem `algo4r-` — zero ryzyka kolizji z motywem.
 * Mobile-first: chart_responsive at <768px (sticky controls + reduced height).
 */

.algo4r-app {
    max-width: 1200px;
    margin: 1.5em auto;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: #333;
    box-sizing: border-box;
}

.algo4r-app * { box-sizing: border-box; }

/* ─── Header (dropdown + premium badge) ──────────────────────────── */
.algo4r-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid #e8e8e8;
    margin-bottom: 12px;
}

.algo4r-controls {
    display: flex;
    align-items: center;
    gap: 10px;
}

.algo4r-controls label {
    font-weight: 600;
    font-size: 14px;
    color: #555;
}

.algo4r-select {
    padding: 8px 32px 8px 12px;
    border: 1px solid #ccc;
    border-radius: 6px;
    background: white;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    min-width: 200px;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23666' d='M6 8L2 4h8z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
}

.algo4r-select:disabled {
    background-color: #f5f5f5;
    cursor: wait;
}

.algo4r-select:focus {
    outline: none;
    border-color: #00C853;
    box-shadow: 0 0 0 3px rgba(0, 200, 83, 0.15);
}

/* ─── Header actions (toggle + fullscreen + badge) ───────────────── */
/*
 * `flex: 1 1 100%` — wymusza basis=100% szerokości header'a, więc actions
 * ZAWSZE ląduje w osobnym wierszu (dropdown na linii 1, actions na linii 2).
 * `flex-wrap: nowrap` wewnątrz — blokuje wrap'owanie badge'a na 3. linię.
 * `justify-content` nie używamy — badge sam się odpycha przez margin-left:auto.
 */
.algo4r-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: nowrap;
    flex: 1 1 100%;
    margin-top: 8px;
}

/* ─── Chart type toggle (Świece / Linia) ─────────────────────────── */
/*
 * Segmented control — exclusive choice (radio-style):
 * jeden mode aktywny, drugi wyciemiony. NIE jest nakładką jednego na drugi.
 */
.algo4r-chart-type-toggle {
    display: inline-flex;
    border: 1px solid #ccc;
    border-radius: 999px;
    overflow: hidden;
    background: #f5f5f5;
}

.algo4r-chart-type-btn {
    padding: 6px 14px;
    background: transparent;
    border: none;
    color: #666;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: inherit;
}

.algo4r-chart-type-btn:hover:not(.algo4r-is-active) {
    background: rgba(0, 0, 0, 0.04);
    color: #333;
}

/*
 * Aktywny stan toggle'a — kolor goldco (warm gold/amber), żeby:
 *   1. Odróżniał się od zielonego "Wykup premium" (różne sektory funkcjonalności)
 *   2. Pasował do brand'u sklepu (logo GOLDCO też w tym kolorze)
 * Inactive button zostaje neutralnie szary.
 */
.algo4r-chart-type-btn.algo4r-is-active {
    background: linear-gradient(135deg, #C9A227 0%, #A87E2C 100%);
    color: white;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.15);
    text-shadow: 0 1px 1px rgba(0, 0, 0, 0.15);
}

/* ─── Fullscreen button (header) ─────────────────────────────────── */
.algo4r-fullscreen-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border: 1px solid #ccc;
    border-radius: 999px;
    background: white;
    color: #333;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: inherit;
}

.algo4r-fullscreen-btn:hover {
    background: #f5f5f5;
    border-color: #999;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

.algo4r-fs-icon {
    font-size: 16px;
    line-height: 1;
}

/* ─── Premium badge ──────────────────────────────────────────────── */
/*
 * `margin-left: auto` w flex container'ze (.algo4r-actions) — odpycha badge
 * do prawej krawędzi, oddzielając wizualnie od grupy "Świecowy/Liniowy + Fullscreen"
 * (które zostają po lewej). Toggle + fullscreen = sektor wizualizacji, premium = sektor zakupu.
 */
.algo4r-premium-badge {
    display: inline-flex;
    align-items: center;
    margin-left: auto;
}

.algo4r-badge {
    display: inline-block;
    padding: 6px 14px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.15s ease;
}

.algo4r-badge-premium {
    background: linear-gradient(135deg, #FFC107 0%, #FF8F00 100%);
    color: white;
    box-shadow: 0 1px 3px rgba(255, 143, 0, 0.3);
}

.algo4r-badge-cta {
    background: linear-gradient(135deg, #FFC107 0%, #FF8F00 100%);
    color: white;
    box-shadow: 0 1px 3px rgba(255, 143, 0, 0.3);
    cursor: pointer;
}

.algo4r-badge-cta:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(255, 143, 0, 0.45);
}

/* ─── Chart wrapper + loader ─────────────────────────────────────── */
/*
 * Pozycjonowanie absolutne `.algo4r-chart` z TWARDYMI insets — chart canvas
 * ma jawne wymiary niezależne od inline-style i theme'a.
 *
 * `bottom: 40px` — bufor pod time-axis labels (LWC renderuje 28px band time-axis
 *                  + sam label ma ~12-14px wysokości). Z 24px było za mało.
 * `left/right: 10px` — bufor pod pierwszą/ostatnią labelkę (centrowane na x=0/x=max).
 */
.algo4r-chart-wrapper {
    position: relative;
    background: #fafafa;
    border: 1px solid #e8e8e8;
    border-radius: 8px;
    overflow: hidden;
    min-height: 560px;
}

.algo4r-chart {
    position: absolute;
    top: 4px;
    left: 10px;
    right: 10px;
    bottom: 40px;
}

/* ─── Regime bgcolor overlay layer ─────────────────────────────────
 * Layer NA TYCH SAMYCH insets co .algo4r-chart, ale z dodatkowym
 * dynamic right inset = priceScale.width() (ustawianym z JS).
 * pointer-events: none — żeby crosshair LWC działał normalnie.
 * z-index: 0 — POD LWC canvas (LWC ma background transparent dzięki
 * createChart opts).
 */
.algo4r-regime-bg-layer {
    position: absolute;
    top: 4px;
    left: 10px;
    right: 10px;
    bottom: 40px;
    overflow: hidden;
    pointer-events: none;
    z-index: 0;
}

.algo4r-regime-segment {
    position: absolute;
    top: 0;
    bottom: 0;
    pointer-events: none;
}

.algo4r-regime-bg-green       { background: rgba(0, 200, 83, 0.08); }
.algo4r-regime-bg-lime        { background: rgba(205, 220, 57, 0.10); }
.algo4r-regime-bg-red         { background: rgba(244, 67, 54, 0.07); }
.algo4r-regime-bg-red_caution { background: rgba(244, 67, 54, 0.12); }
.algo4r-regime-bg-maroon      { background: rgba(128, 0, 0, 0.08); }
.algo4r-regime-bg-purple      { background: rgba(156, 39, 176, 0.10); }

/* ─── Euphoria-phase szare tło ────────────────────────────────────
 * Subtelna szara warstwa NAD regime-bg-green (faza euforii nadal jest
 * green main trend, ale dodajemy ostrzeżenie wizualne). Pine line 1996:
 * `bgcolor(vb_euphoria_wait4corr and vi_retail_regime >= 2 ? gray 90 : na)`
 * z=1: nad green (z=0), pod canvas (LWC ma transparent bg).
 */
.algo4r-euphoria-bg-layer {
    position: absolute;
    top: 4px;
    left: 10px;
    right: 10px;
    bottom: 40px;
    overflow: hidden;
    pointer-events: none;
    z-index: 1;
}

.algo4r-euphoria-segment {
    position: absolute;
    top: 0;
    bottom: 0;
    background: rgba(120, 120, 120, 0.10);
    pointer-events: none;
}

/* ─── Retail labels (MO4) ──────────────────────────────────────────
 * 6 typów rising-edge labels z Pine (linie 2055-2172).
 * Layer NAD LWC canvas (z-index 5) i POD premium overlay (z-index 10).
 * JS pozycjonuje każdy label przez transform translate(-50%, -100%|0%)
 * w zależności od anchor (above_high|below_high).
 * pointer-events: none na layerze — crosshair LWC dalej działa.
 * Kolory i font-weight matchują Pine label.new(color/textcolor/text_formatting).
 */
.algo4r-labels-layer {
    position: absolute;
    top: 4px;
    left: 10px;
    right: 10px;
    bottom: 40px;
    overflow: hidden;
    pointer-events: none;
    z-index: 5;
}

/* ─── Warstwa sygnałów (własny SVG overlay strzałek BUY/ADD/CLOSE) ──────
 * Wzorzec jak .algo4r-labels-layer. z-index 5 = nad canvas LWC, pod premium (10).
 */
.algo4r-signals-layer {
    position: absolute;
    top: 4px;
    left: 10px;
    right: 10px;
    bottom: 40px;
    overflow: hidden;
    pointer-events: none;
    z-index: 5;
}

.algo4r-signal-marker {
    position: absolute;
    display: flex;
    flex-direction: column;       /* strzałka u góry, podpis pod spodem (BUY/ADD) */
    align-items: center;
    pointer-events: none;
}

/* CLOSE: strzałka nad świecą, podpis NAD strzałką → odwrócona kolejność */
.algo4r-signal-close { flex-direction: column-reverse; color: #D32F2F; }
.algo4r-signal-buy,
.algo4r-signal-add   { color: #64DD17; }

.algo4r-signal-svg { display: block; }
.algo4r-signal-buy   .algo4r-signal-svg,
.algo4r-signal-close .algo4r-signal-svg { width: 32px; height: 42px; }
.algo4r-signal-add   .algo4r-signal-svg { width: 20px; height: 26px; }

.algo4r-signal-caption {
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
    margin-top: 1px;
    /* biała poświata = czytelność podpisu na świecach */
    text-shadow: 0 1px 2px rgba(255,255,255,0.9), 0 0 2px rgba(255,255,255,0.9);
}
.algo4r-signal-buy   .algo4r-signal-caption,
.algo4r-signal-add   .algo4r-signal-caption { color: #2e7d32; }
.algo4r-signal-close .algo4r-signal-caption { color: #c62828; margin-top: 0; margin-bottom: 1px; }

@media (max-width: 767px) {
    .algo4r-signal-buy   .algo4r-signal-svg,
    .algo4r-signal-close .algo4r-signal-svg { width: 29px; height: 38px; }
    .algo4r-signal-add   .algo4r-signal-svg { width: 18px; height: 23px; }
    .algo4r-signal-caption { font-size: 10px; }
}

.algo4r-label {
    position: absolute;
    white-space: pre-line;
    font-size: 11px;
    line-height: 1.25;
    padding: 5px 8px;
    border-radius: 4px;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.18);
    max-width: 170px;
    pointer-events: none;
    background: var(--algo4r-label-bg);
}

/* Strzałkowy dziubek (jak w TradingView) — celuje w cenę, wycentrowany na szerokości.
   -above: etykieta NAD ceną → dziubek na dole, w dół.
   -below: etykieta POD ceną → dziubek na górze, w górę.
   Kolor dziubka = tło etykiety (var --algo4r-label-bg). */
.algo4r-label::after {
    content: '';
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 0;
    border-left: 7px solid transparent;
    border-right: 7px solid transparent;
}
.algo4r-label-above::after {
    top: 100%;
    border-top: 7px solid var(--algo4r-label-bg);
}
.algo4r-label-below::after {
    bottom: 100%;
    border-bottom: 7px solid var(--algo4r-label-bg);
}

/* Pine clr: green 25 (75% opacity), textcolor white, BOLD */
.algo4r-label-bull_start {
    --algo4r-label-bg: rgba(0, 200, 83, 0.85);
    color: #ffffff;
    font-weight: 700;
}

/* Pine clr: green 25, textcolor red — UWAGA "Sygnał Końca" */
.algo4r-label-bull_end {
    --algo4r-label-bg: rgba(0, 200, 83, 0.85);
    color: #b71c1c;
    font-weight: 700;
}

/* Pine clr: red 25, textcolor white (regular) */
.algo4r-label-bear {
    --algo4r-label-bg: rgba(244, 67, 54, 0.85);
    color: #ffffff;
    font-weight: 500;
}

/* Pine clr: yellow 25, textcolor green, BOLD */
.algo4r-label-early_bull {
    --algo4r-label-bg: rgba(255, 235, 59, 0.95);
    color: #1b5e20;
    font-weight: 700;
}

/* Wyciszone szaro-przezroczyste tło harmonizujące z pasem segmentu euforii */
.algo4r-label-euphoria_start {
    --algo4r-label-bg: rgba(120, 120, 120, 0.15);
    color: #b71c1c;
    font-weight: 300;
}

.algo4r-label-euphoria_end {
    --algo4r-label-bg: rgba(120, 120, 120, 0.15);
    color: #1b5e20;
    font-weight: 400;
}

/* Mobile: hide labels (DOM overlay byłby zbyt gęsty) — JS też ma guard */
@media (max-width: 767px) {
    .algo4r-labels-layer { display: none; }
}

/* ─── Premium-block overlay ─────────────────────────────────────────
 * Dla niezalogowanych / nie-premium user'ów: zasłania obszar wykresu
 * po cutoff'cie (czyli ostatnie 12 mc). JS ustawia left=xCutoff w runtime.
 * Domyślnie hidden — JS pokazuje gdy !is_premium AND cutoff_ts widoczne.
 *
 * pointer-events: auto — żeby CTA był klikalny + crosshair LWC w tym
 * obszarze był zablokowany (zamierzone — freemium nie powinien tu interagować).
 */
.algo4r-premium-overlay {
    position: absolute;
    top: 4px;
    bottom: 40px;
    /* right ustawiany przez JS = 10 + priceScale.width() */
    background: linear-gradient(
        to right,
        rgba(250, 250, 250, 0) 0%,
        rgba(250, 250, 250, 0.65) 15%,
        rgba(250, 250, 250, 0.88) 100%
    );
    z-index: 10;
    pointer-events: auto;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.algo4r-premium-overlay-content {
    background: rgba(255, 255, 255, 0.97);
    padding: 18px 24px;
    border-radius: 10px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
    border: 1px solid #e0d4ad;
    text-align: center;
    max-width: 300px;
}

.algo4r-premium-overlay-icon {
    font-size: 36px;
    margin-bottom: 8px;
    line-height: 1;
}

.algo4r-premium-overlay-title {
    font-weight: 700;
    font-size: 18px;
    color: #A87E2C;
    margin-bottom: 8px;
}

.algo4r-premium-overlay-text {
    font-size: 13px;
    color: #555;
    margin-bottom: 14px;
    line-height: 1.4;
}

.algo4r-premium-overlay-cta {
    display: inline-block;
    padding: 10px 20px;
    background: linear-gradient(135deg, #C9A227 0%, #A87E2C 100%);
    color: white !important;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.algo4r-premium-overlay-cta:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(168, 126, 44, 0.3);
}

/*
 * Theme isolation — motyw `goldcoCC` ma globalne reguły `table td, table th`
 * (style.css:1387, font-size:100%, vertical-align:baseline, text-align:center, color:#757475).
 * LWC tworzy w środku własną <table> dla layoutu, którą motyw mimowolnie modyfikuje
 * — to powoduje subtelne offsety w rozmiarach komórek (potencjalna przyczyna ucinania).
 *
 * Wymuszamy reset wewnątrz LWC: padding/border 0, color inherit (LWC kontroluje
 * kolor labelek przez canvas, nie CSS), vertical-align top.
 */
.algo4r-chart .tv-lightweight-charts,
.algo4r-chart .tv-lightweight-charts table,
.algo4r-chart .tv-lightweight-charts tr,
.algo4r-chart .tv-lightweight-charts td,
.algo4r-chart .tv-lightweight-charts th {
    padding: 0 !important;
    margin: 0 !important;
    border: 0 !important;
    border-spacing: 0 !important;
    vertical-align: top !important;
    line-height: normal !important;
    color: inherit !important;
    text-align: left !important;
    background: transparent !important;
}

/* ─── Exit fullscreen button (overlay top-right) ─────────────────── */
.algo4r-fullscreen-exit {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 1000;
    display: none; /* widoczny tylko w fullscreen */
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    background: rgba(33, 33, 33, 0.85);
    color: white;
    border: none;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s;
}

.algo4r-fullscreen-exit:hover {
    background: rgba(0, 0, 0, 0.95);
}

/* ─── Fullscreen overlay state ───────────────────────────────────── */
/*
 * `.algo4r-app.algo4r-is-fullscreen` — kontener wskakuje na fixed,
 * pokrywa cały viewport. body dostaje `overflow:hidden` żeby nie scrolować
 * tła. Wykres rezerwuje cały dostępny space (controls header pozostaje na górze).
 */
.algo4r-app.algo4r-is-fullscreen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 9999;
    margin: 0;
    max-width: none;
    background: white;
    padding: 16px 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}

.algo4r-app.algo4r-is-fullscreen .algo4r-chart-wrapper {
    flex: 1 1 auto;
    height: auto !important; /* override inline style="height:600px" */
    min-height: 400px;
}

.algo4r-app.algo4r-is-fullscreen .algo4r-fullscreen-exit {
    display: inline-flex;
}

.algo4r-app.algo4r-is-fullscreen .algo4r-fullscreen-btn {
    display: none; /* ukryj normalny FS button — exit jest w overlay */
}

/* Instrukcja tylko poza trybem pełnoekranowym — w FS jej rozwijany box
 * wystawał pod wykresem. Pełny ekran = sam wykres + sygnały. */
.algo4r-app.algo4r-is-fullscreen .algo4r-guide-details {
    display: none;
}

body.algo4r-fs-active {
    overflow: hidden;
}

.algo4r-loader {
    position: absolute;
    inset: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    background: rgba(255, 255, 255, 0.85);
    z-index: 10;
    font-size: 14px;
    color: #666;
}

.algo4r-loader::before {
    content: '';
    width: 20px;
    height: 20px;
    margin-right: 10px;
    border: 2px solid #ddd;
    border-top-color: #00C853;
    border-radius: 50%;
    animation: algo4r-spin 0.8s linear infinite;
}

@keyframes algo4r-spin {
    to { transform: rotate(360deg); }
}

/* ─── Legend ──────────────────────────────────────────────────────── */
.algo4r-legend {
    display: flex;
    gap: 16px 20px;
    flex-wrap: wrap;
    align-items: center;
    padding: 12px 14px;
    margin-top: 12px;
    background: #fafafa;
    border-radius: 6px;
    font-size: 13px;
    color: #666;
}

.algo4r-legend-title {
    color: #222;
    font-size: 13px;
    font-weight: 700;
    width: 100%;
    margin-bottom: 2px;
}

.algo4r-legend-item {
    display: inline-flex;
    align-items: center;
}

/* Link do zwijanej instrukcji — pełna szerokość pod sygnałami, akcent goldco */
.algo4r-legend-help {
    width: 100%;
    margin-top: 4px;
    padding-top: 10px;
    border-top: 1px solid #ececec;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    color: #A87E2C;
    text-decoration: none;
}

.algo4r-legend-help:hover {
    color: #8a6622;
    text-decoration: underline;
}

/* ─── Zwijana instrukcja (<details id="algo4r-instrukcja">) ──────────── */
.algo4r-guide-details {
    margin-top: 14px;
    border: 1px solid #e8e8e8;
    border-radius: 8px;
    background: #fff;
    overflow: hidden;
}

.algo4r-guide-summary {
    list-style: none;
    cursor: pointer;
    padding: 14px 18px;
    font-size: 15px;
    font-weight: 700;
    color: #222;
    background: #fafafa;
    display: flex;
    align-items: center;
    gap: 8px;
    user-select: none;
}

.algo4r-guide-summary::-webkit-details-marker { display: none; }

/* Strzałka rozwijania (obraca się gdy [open]) */
.algo4r-guide-summary::after {
    content: "▾";
    margin-left: auto;
    color: #A87E2C;
    transition: transform 0.15s ease;
}

.algo4r-guide-details[open] .algo4r-guide-summary::after {
    transform: rotate(180deg);
}

.algo4r-guide-summary:hover { background: #f3f3f3; }

.algo4r-guide {
    padding: 8px 22px 22px;
    color: #333;
    line-height: 1.7;
}

.algo4r-guide h2 { font-size: 22px; margin: 18px 0 10px; }
.algo4r-guide h3 { font-size: 17px; margin: 18px 0 6px; }
.algo4r-guide p, .algo4r-guide li { font-size: 16px; }
.algo4r-guide ul { padding-left: 22px; }
.algo4r-guide li { margin-bottom: 6px; }

.algo4r-guide .border-line {
    height: 1px;
    background: #ececec;
    margin: 18px 0;
}

.algo4r-marker {
    display: inline-flex;
    align-items: center;
    margin-right: 4px;
    vertical-align: middle;
}

.algo4r-marker-svg {
    width: 14px;
    height: 14px;
    display: inline-block;
}

.algo4r-marker-buy         { color: #64DD17; }
.algo4r-marker-add         { color: #64DD17; }
.algo4r-marker-close       { color: #D32F2F; }
.algo4r-marker-opportunity { color: #7CB342; }

/* Rozmiary ikon legendy proporcjonalne do markerów na wykresie:
   BUY/CLOSE size 4.5 → duże (18px); ADD size 2.4 → mniejsze (12px); Okazja 1.5 → kropka (10px). */
.algo4r-marker-buy   .algo4r-marker-svg,
.algo4r-marker-close .algo4r-marker-svg       { width: 18px; height: 18px; }
.algo4r-marker-add   .algo4r-marker-svg       { width: 12px; height: 12px; }
.algo4r-marker-opportunity .algo4r-marker-svg { width: 10px; height: 10px; }

/* ─── Stats panel ─────────────────────────────────────────────────── */
.algo4r-stats {
    margin: 0 0 12px;
    padding: 16px;
    background: white;
    border: 1px solid #e8e8e8;
    border-radius: 8px;
}

.algo4r-stats-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 16px 24px;
    font-size: 14px;
    color: #555;
}

.algo4r-stats-grid > div:first-child {
    width: 100%;
    font-size: 16px;
    color: #222;
    padding-bottom: 4px;
    border-bottom: 1px solid #f0f0f0;
}

.algo4r-stat-buy         { color: #555; font-weight: 600; }
.algo4r-stat-add         { color: #607D8B; font-weight: 600; }
.algo4r-stat-close       { color: #D32F2F; font-weight: 600; }
.algo4r-stat-opportunity { color: #7CB342; font-weight: 600; }

/* ─── Premium notice / lockout ────────────────────────────────────── */
.algo4r-premium-notice {
    margin-top: 12px;
    padding: 10px 14px;
    background: #FFF8E1;
    border-left: 3px solid #FFC107;
    border-radius: 4px;
    font-size: 13px;
    color: #5d4037;
}

.algo4r-premium-notice.algo4r-notice-soft {
    background: #f5f5f5;
    border-left-color: #bdbdbd;
    color: #666;
}

.algo4r-premium-notice a {
    color: #00B248;
    font-weight: 600;
    text-decoration: none;
    margin-left: 6px;
}

.algo4r-premium-notice a:hover {
    text-decoration: underline;
}

/* ─── Error state ─────────────────────────────────────────────────── */
.algo4r-error {
    padding: 12px 16px;
    background: #FFEBEE;
    border-left: 3px solid #D32F2F;
    border-radius: 4px;
    color: #B71C1C;
    font-size: 14px;
}

/* ─── Responsive ──────────────────────────────────────────────────── */
@media (max-width: 768px) {
    .algo4r-app {
        margin: 1em 8px;
    }

    .algo4r-header {
        flex-direction: column;
        align-items: stretch;
    }

    .algo4r-controls {
        width: 100%;
    }

    .algo4r-select {
        flex: 1;
        min-width: 0;
    }

    .algo4r-premium-badge {
        align-self: flex-end;
    }

    .algo4r-chart-wrapper {
        height: 440px !important; /* override inline style z PHP */
        min-height: 440px;
    }

    .algo4r-legend {
        gap: 8px 12px;
        font-size: 12px;
    }

    /* Na mobile zachowujemy etykietę "Tryb Pełny Ekran" mimo ciasnoty —
     * klienci starszej daty potrzebują tekstu obok ikony. */
    .algo4r-fullscreen-btn {
        font-size: 12px;
        padding: 6px 10px;
    }

    .algo4r-actions {
        justify-content: space-between;
        width: 100%;
    }

    /* Naturalna wysokość togglei i przycisku premium — bez pionowego spłaszczenia */
    .algo4r-chart-type-btn,
    .algo4r-badge-premium {
        padding-top: 8px;
        padding-bottom: 8px;
        min-height: 36px;
        line-height: 1.2;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
}
