        :root {
            --gold-border-soft: rgba(201, 176, 55, 0.14);
            --gold-border: rgba(201, 176, 55, 0.28);
            --gold-border-strong: rgba(201, 176, 55, 0.55);
            --gold-fill-10: rgba(201, 176, 55, 0.10);
            --muted-text: rgba(255, 255, 255, 0.45);
            --radius-lg: 15px;
            --shadow-card: 0 8px 32px rgba(0, 0, 0, 0.4), inset 0 0 0 1px rgba(255, 255, 255, 0.03);
            --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
        }

        body { overflow-x: clip; }

        body::after {
            content: '';
            position: fixed;
            inset: 0;
            background: repeating-linear-gradient(135deg, rgba(255,255,255,0.03) 0px, rgba(255,255,255,0.03) 2px, transparent 2px, transparent 6px);
            opacity: 0.6;
            pointer-events: none;
            z-index: -1;
            mix-blend-mode: lighten;
        }

        /* ================================================================
           SLIM PAGE HEADER
        ================================================================ */
        .sh-page-header {
            padding: 7.5rem 2rem 1.5rem;
        }
        .sh-page-title {
            font-size: clamp(1.6rem, 3vw, 2.2rem);
            font-weight: 900;
            letter-spacing: -0.02em;
            color: var(--light-text);
            margin: 0 0 0.3rem;
        }
        .sh-page-sub {
            font-size: 0.85rem;
            color: var(--gray-text);
            margin: 0;
        }

        .main-content {
            padding: 1.75rem 2rem 3rem;
            max-width: none;
            margin-left: 0;
            margin-right: 0;
        }

        /* ── Filter Card ── */
        .hist-filter-card {
            background: rgba(10, 14, 22, 0.7);
            border: 1px solid rgba(201, 176, 55, 0.15);
            border-radius: 16px;
            margin-bottom: 1.25rem;
            overflow-x: clip;
            position: relative;
        }

        .hist-filter-card[hidden] { display: none; }

        .hist-table-card > .hist-filter-card {
            margin: 0;
            border: 0;
            border-radius: 0;
            border-bottom: 1px solid rgba(201,176,55,0.1);
            background: rgba(10,14,22,0.82);
            animation: histFilterPanelIn 0.18s ease-out both;
        }

        .hist-table-card > .hist-filter-card::before { display: none; }

        @keyframes histFilterPanelIn {
            from { opacity: 0; transform: translateY(-4px); }
            to { opacity: 1; transform: translateY(0); }
        }

        .hist-filter-card::before {
            content: '';
            position: absolute;
            top: 0; left: 0; right: 0;
            height: 2px;
            background: linear-gradient(90deg, var(--primary-gold), var(--secondary-gold));
        }

        .hfc-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 0.8rem 1.25rem;
            border-bottom: 1px solid rgba(201, 176, 55, 0.08);
        }

        .hfc-title {
            display: flex;
            align-items: center;
            gap: 0.5rem;
            font-size: 0.72rem;
            font-weight: 700;
            letter-spacing: 0.09em;
            text-transform: uppercase;
            color: rgba(255,255,255,0.45);
        }

        .hfc-active-count {
            font-size: 0.6rem;
            font-weight: 700;
            padding: 0.12rem 0.45rem;
            border-radius: 20px;
            background: rgba(201,176,55,0.15);
            border: 1px solid rgba(201,176,55,0.3);
            color: var(--primary-gold);
            letter-spacing: 0.04em;
        }

        .hfc-clear-btn {
            display: inline-flex;
            align-items: center;
            gap: 0.3rem;
            font-size: 0.68rem;
            font-weight: 700;
            font-family: inherit;
            color: rgba(255,255,255,0.3);
            background: transparent;
            border: 1px solid rgba(255,255,255,0.1);
            border-radius: 8px;
            padding: 0.28rem 0.7rem;
            cursor: pointer;
            transition: all 0.18s;
        }

        .hfc-clear-btn:hover {
            color: #f87171;
            border-color: rgba(248,113,113,0.35);
            background: rgba(248,113,113,0.07);
        }

        .hfc-body {
            display: flex;
            align-items: flex-start;
            justify-content: center;
            flex-wrap: nowrap;
            padding: 1rem 1.25rem;
            gap: 0;
        }

        .hfc-group {
            display: flex;
            flex-direction: column;
            gap: 0.5rem;
            padding-right: 1.25rem;
        }

        .hfc-group-label {
            font-size: 0.6rem;
            font-weight: 700;
            letter-spacing: 0.1em;
            text-transform: uppercase;
            color: var(--primary-gold);
            opacity: 0.65;
        }

        .hfc-select {
            display: none;
            width: 100%;
            min-height: 32px;
            padding: 0.35rem 0.55rem;
            border: 1px solid rgba(255,255,255,0.12);
            border-radius: 8px;
            background: #0d1117;
            color: rgba(255,255,255,0.72);
            font-family: inherit;
            font-size: 0.68rem;
            font-weight: 600;
            line-height: 1.2;
            color-scheme: dark;
            outline: none;
        }

        .hfc-select:focus {
            border-color: rgba(201,176,55,0.48);
            box-shadow: 0 0 0 2px rgba(201,176,55,0.08);
        }

        .hfc-pills {
            display: flex;
            flex-wrap: wrap;
            gap: 0.32rem;
        }

        .hfc-divider {
            width: 1px;
            align-self: stretch;
            background: rgba(255,255,255,0.07);
            margin-right: 1.25rem;
            flex-shrink: 0;
        }

        /* Pills */
        .hfc-pill {
            display: inline-flex;
            align-items: center;
            gap: 0.28rem;
            font-size: 0.68rem;
            font-weight: 700;
            letter-spacing: 0.04em;
            padding: 0.28rem 0.7rem;
            border-radius: 50px;
            border: 1px solid rgba(255,255,255,0.1);
            background: transparent;
            color: rgba(255,255,255,0.38);
            cursor: pointer;
            transition: all 0.18s ease;
            white-space: nowrap;
            font-family: inherit;
        }

        .hfc-pill:hover {
            border-color: rgba(201,176,55,0.4);
            color: rgba(255,255,255,0.78);
            background: rgba(201,176,55,0.04);
        }

        .hfc-pill.active {
            background: rgba(201,176,55,0.13);
            border-color: rgba(201,176,55,0.45);
            color: var(--primary-gold);
        }

        /* Ticker color dots */
        .hfc-dot {
            width: 6px;
            height: 6px;
            border-radius: 50%;
            flex-shrink: 0;
        }

        .hfc-dot.spy  { background: #c9b037; }
        .hfc-dot.tsla { background: #ff6666; }
        .hfc-dot.meta { background: #5b9eff; }
        .hfc-dot.aapl { background: #b3b3b3; }
        .hfc-dot.nvda { background: #8fdb2f; }
        .hfc-dot.amzn { background: #ffaa33; }

        /* Ticker active — each uses its own color */
        .hfc-pill.t-spy.active  { background: rgba(201,176,55,0.12); border-color: rgba(201,176,55,0.45); color: #c9b037; }
        .hfc-pill.t-tsla.active { background: rgba(255,102,102,0.1); border-color: rgba(255,102,102,0.4); color: #ff6666; }
        .hfc-pill.t-meta.active { background: rgba(91,158,255,0.1);  border-color: rgba(91,158,255,0.4);  color: #5b9eff; }
        .hfc-pill.t-aapl.active { background: rgba(179,179,179,0.1); border-color: rgba(179,179,179,0.4); color: #b3b3b3; }
        .hfc-pill.t-nvda.active { background: rgba(143,219,47,0.1);  border-color: rgba(143,219,47,0.4);  color: #8fdb2f; }
        .hfc-pill.t-amzn.active { background: rgba(255,170,51,0.1);  border-color: rgba(255,170,51,0.4);  color: #ffaa33; }

        /* Direction */
        .hfc-pill.call.active { background: rgba(74,222,128,0.1); border-color: rgba(74,222,128,0.4); color: #4ade80; }
        .hfc-pill.put.active  { background: rgba(248,113,113,0.1); border-color: rgba(248,113,113,0.4); color: #f87171; }

        /* Date group */
        .hfc-date-group {
            flex: 0 0 292px;
            min-width: 292px;
            padding-right: 0;
        }

        .hfc-date-custom { display: block; }

        .hfc-date-row {
            display: flex;
            align-items: center;
            gap: 0.5rem;
        }

        .hfc-date-arrow {
            font-size: 0.75rem;
            color: rgba(255,255,255,0.22);
            flex-shrink: 0;
        }

        .hfc-date-input {
            font-size: 0.72rem;
            font-family: inherit;
            padding: 0.3rem 0.65rem;
            border-radius: 8px;
            border: 1px solid rgba(201,176,55,0.2);
            background: rgba(255,255,255,0.03);
            color: rgba(255,255,255,0.7);
            outline: none;
            transition: border-color 0.18s, box-shadow 0.18s;
            width: 130px;
        }

        .hfc-date-input:focus {
            border-color: rgba(201,176,55,0.5);
            box-shadow: 0 0 0 2px rgba(201,176,55,0.08);
        }

        .hfc-presets {
            display: flex;
            gap: 0.3rem;
            margin-top: 0.4rem;
        }

        .hfc-preset {
            font-size: 0.62rem;
            font-weight: 600;
            font-family: inherit;
            letter-spacing: 0.04em;
            padding: 0.18rem 0.5rem;
            border-radius: 6px;
            border: 1px solid rgba(255,255,255,0.08);
            background: transparent;
            color: rgba(255,255,255,0.28);
            cursor: pointer;
            transition: all 0.18s;
        }

        .hfc-preset:hover {
            border-color: rgba(201,176,55,0.35);
            color: var(--primary-gold);
            background: rgba(201,176,55,0.06);
        }

        /* ── Table wrapper ── */
        .hist-table-card {
            background: rgba(10, 14, 22, 0.7);
            border: 1px solid rgba(201, 176, 55, 0.12);
            border-radius: 14px;
            overflow-x: clip;
        }

        .hist-table-meta {
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 0.85rem 1.25rem 0.7rem;
            border-bottom: 1px solid rgba(201,176,55,0.08);
            gap: 0.5rem;
            flex-wrap: wrap;
        }

        .hist-table-meta-left {
            display: flex;
            align-items: center;
            gap: 0.5rem;
        }

        .hist-table-actions {
            display: flex;
            align-items: center;
            gap: 0.45rem;
        }

        .hist-table-title {
            font-size: 0.85rem;
            font-weight: 700;
            color: rgba(255,255,255,0.75);
        }

        .hist-count-badge {
            font-size: 0.63rem;
            font-weight: 700;
            padding: 0.1rem 0.45rem;
            border-radius: 20px;
            background: rgba(201,176,55,0.1);
            border: 1px solid rgba(201,176,55,0.2);
            color: var(--primary-gold);
        }

        .hist-table-scroll {
            overflow-x: auto;
        }

        table.hist-table {
            width: 100%;
            border-collapse: collapse;
            font-size: 0.78rem;
        }

        table.hist-table thead th {
            padding: 0.65rem 1rem;
            text-align: left;
            font-size: 0.63rem;
            font-weight: 700;
            letter-spacing: 0.07em;
            text-transform: uppercase;
            color: rgba(255,255,255,0.3);
            border-bottom: 1px solid rgba(201,176,55,0.08);
            white-space: nowrap;
            cursor: pointer;
            user-select: none;
            transition: color 0.15s;
        }

        table.hist-table thead th:hover {
            color: var(--primary-gold);
        }

        table.hist-table thead th .sort-icon {
            margin-left: 0.3rem;
            opacity: 0.4;
            font-size: 0.55rem;
        }

        table.hist-table thead th.sorted .sort-icon { opacity: 1; color: var(--primary-gold); }

        table.hist-table tbody tr {
            border-bottom: 1px solid rgba(255,255,255,0.04);
            transition: background 0.15s;
        }

        table.hist-table tbody tr:last-child { border-bottom: none; }

        table.hist-table tbody tr:hover {
            background: rgba(201,176,55,0.04);
        }

        table.hist-table tbody td {
            padding: 0.7rem 1rem;
            color: rgba(255,255,255,0.7);
            white-space: nowrap;
        }

        .hist-ticker-badge {
            display: inline-block;
            font-size: 0.68rem;
            font-weight: 800;
            letter-spacing: 0.05em;
            padding: 0.18rem 0.5rem;
            border-radius: 6px;
        }

        .hist-dir-badge {
            display: inline-flex;
            align-items: center;
            gap: 0.3rem;
            font-size: 0.65rem;
            font-weight: 700;
            letter-spacing: 0.05em;
            padding: 0.18rem 0.5rem;
            border-radius: 6px;
        }

        .hist-dir-badge.call {
            background: rgba(74,222,128,0.1);
            color: #4ade80;
            border: 1px solid rgba(74,222,128,0.22);
        }

        .hist-dir-badge.put {
            background: rgba(248,113,113,0.1);
            color: #f87171;
            border: 1px solid rgba(248,113,113,0.22);
        }

        /* Date cell */
        .hist-date-cell { white-space: nowrap; }
        .hist-date { display: block; font-size: 0.78rem; color: rgba(255,255,255,0.75); }
        .hist-time { display: block; font-size: 0.65rem; color: rgba(255,255,255,0.35); margin-top: 0.1rem; }

        /* Signal cell */
        .hist-signal-top { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
        .hist-signal-type {
            font-size: 0.6rem; font-weight: 600; letter-spacing: 0.04em;
            color: rgba(255,255,255,0.45); text-transform: uppercase;
        }
        .hist-stat-chips {
            margin-top: 0.3rem;
            font-size: 0.62rem;
            color: rgba(255,255,255,0.3);
            white-space: nowrap;
            overflow-x: clip;
            text-overflow: ellipsis;
        }

        .hist-status-badge {
            display: inline-block;
            font-size: 0.6rem;
            font-weight: 700;
            letter-spacing: 0.06em;
            padding: 0.18rem 0.45rem;
            border-radius: 5px;
            line-height: 1.5;
        }
        .hist-status-badge.open       { background: rgba(255,255,255,0.06); color: rgba(255,255,255,0.35); }
        .hist-status-badge.tp1        { background: rgba(245,158,11,0.15);  color: #f59e0b; border: 1px solid rgba(245,158,11,0.3); }
        .hist-status-badge.tp2        { background: rgba(132,204,22,0.15);  color: #84cc16; border: 1px solid rgba(132,204,22,0.3); }
        .hist-status-badge.closed-win { background: rgba(74,222,128,0.12);  color: #4ade80; border: 1px solid rgba(74,222,128,0.25); }
        .hist-status-badge.closed-loss{ background: rgba(239,68,68,0.12);   color: #ef4444; border: 1px solid rgba(239,68,68,0.25); }
        .hist-status-reason { font-weight: 500; font-size: 0.55rem; opacity: 0.8; letter-spacing: 0; }

        /* ── Empty / loading states ── */
        .hist-state {
            text-align: center;
            padding: 3.5rem 1rem;
            color: rgba(255,255,255,0.25);
            font-size: 0.85rem;
        }

        .hist-state i { font-size: 1.8rem; display: block; margin-bottom: 0.65rem; }

        .hist-local-file-warning {
            color: rgba(255,255,255,0.5);
            font-size: 0.78rem;
            line-height: 1.55;
            padding: 1.25rem 1.5rem;
        }

        .hist-local-file-warning strong {
            color: var(--secondary-gold);
            display: block;
            font-size: 0.82rem;
            margin-bottom: 0.25rem;
        }

        .hist-local-file-warning code {
            color: var(--primary-gold);
            font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
            font-size: 0.72rem;
        }

        /* ── Load more ── */
        .hist-load-more {
            display: flex;
            justify-content: center;
            padding: 1rem;
            border-top: 1px solid rgba(201,176,55,0.08);
        }

        .hist-load-btn {
            font-size: 0.75rem;
            font-weight: 700;
            padding: 0.5rem 1.5rem;
            border-radius: 50px;
            border: 1px solid rgba(201,176,55,0.3);
            background: rgba(201,176,55,0.07);
            color: var(--primary-gold);
            cursor: pointer;
            transition: all 0.18s;
        }

        .hist-load-btn:hover {
            background: rgba(201,176,55,0.14);
            border-color: rgba(201,176,55,0.5);
        }

        .hist-load-btn:disabled {
            opacity: 0.35;
            cursor: not-allowed;
        }

        /* ── Log Trade button ── */
        .hist-log-btn {
            font-size: 0.68rem;
            font-weight: 700;
            cursor: pointer;
            padding: 0.3rem 0.7rem;
            border-radius: 6px;
            background: rgba(201,176,55,0.12);
            border: 1px solid rgba(201,176,55,0.35);
            color: var(--primary-gold);
            white-space: nowrap;
            transition: background 0.15s;
        }
        .hist-log-btn:hover { background: rgba(201,176,55,0.25); }

        .hist-action-cell { display: flex; align-items: center; gap: 0.4rem; }

        .hist-detail-actions { display: none; }

        .hist-edit-btn {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            width: 28px;
            height: 28px;
            border-radius: 6px;
            background: rgba(255,255,255,0.04);
            border: 1px solid rgba(255,255,255,0.1);
            color: rgba(255,255,255,0.35);
            cursor: pointer;
            font-size: 0.65rem;
            transition: background 0.15s, color 0.15s, border-color 0.15s;
            flex-shrink: 0;
        }
        .hist-edit-btn:hover {
            background: rgba(201,176,55,0.12);
            border-color: rgba(201,176,55,0.4);
            color: var(--primary-gold);
        }

        /* ── Signal Edit Modal ── */
        .se-backdrop {
            display: none;
            position: fixed;
            inset: 0;
            background: rgba(0,0,0,0.7);
            backdrop-filter: blur(4px);
            -webkit-backdrop-filter: blur(4px);
            z-index: 1100;
        }
        .se-backdrop.open { display: block; }

        .se-panel {
            display: none;
            position: fixed;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            z-index: 1101;
            width: min(680px, 94vw);
            max-height: 88vh;
            overflow-y: auto;
            background: #0d1117;
            border: 1px solid rgba(255,255,255,0.1);
            border-top: 3px solid var(--primary-gold);
            border-radius: 16px;
            padding: 1.5rem;
        }
        .se-panel.open {
            display: block;
            animation: sePopIn 0.2s ease-out;
        }
        @keyframes sePopIn {
            from { opacity: 0; transform: translate(-50%, calc(-50% + 12px)); }
            to   { opacity: 1; transform: translate(-50%, -50%); }
        }

        .se-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            margin-bottom: 1.25rem;
        }
        .se-title {
            font-size: 0.8rem;
            font-weight: 700;
            color: rgba(255,255,255,0.55);
            text-transform: uppercase;
            letter-spacing: 0.07em;
            display: flex;
            align-items: center;
            gap: 0.5rem;
        }
        .se-title i { color: var(--primary-gold); }
        .se-close {
            background: transparent;
            border: none;
            cursor: pointer;
            color: rgba(255,255,255,0.35);
            font-size: 1.3rem;
            line-height: 1;
            padding: 0.25rem 0.4rem;
            border-radius: 6px;
            font-family: inherit;
            transition: color 0.15s, background 0.15s;
        }
        .se-close:hover { color: rgba(255,255,255,0.8); background: rgba(255,255,255,0.07); }

        .se-grid {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 0.85rem 1.1rem;
        }
        .se-field {
            display: flex;
            flex-direction: column;
            gap: 0.3rem;
        }
        .se-field.full { grid-column: 1 / -1; }
        .se-label {
            font-size: 0.58rem;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 0.07em;
            color: rgba(255,255,255,0.3);
        }
        .se-input, .se-select {
            background: rgba(255,255,255,0.04);
            border: 1px solid rgba(255,255,255,0.1);
            border-radius: 8px;
            color: rgba(255,255,255,0.8);
            font-size: 0.82rem;
            font-family: inherit;
            padding: 0.5rem 0.7rem;
            width: 100%;
            box-sizing: border-box;
            transition: border-color 0.15s;
        }
        .se-input:focus, .se-select:focus {
            outline: none;
            border-color: rgba(201,176,55,0.5);
        }
        .se-select option { background: #1a1f2e; }

        .se-divider {
            grid-column: 1 / -1;
            border: none;
            border-top: 1px solid rgba(255,255,255,0.06);
            margin: 0.25rem 0;
        }
        .se-section-label {
            grid-column: 1 / -1;
            font-size: 0.58rem;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 0.08em;
            color: rgba(255,255,255,0.2);
            margin-bottom: -0.2rem;
        }

        .se-footer {
            display: flex;
            align-items: center;
            justify-content: flex-end;
            gap: 0.65rem;
            margin-top: 1.25rem;
            padding-top: 1rem;
            border-top: 1px solid rgba(255,255,255,0.06);
        }
        .se-btn-cancel {
            background: transparent;
            border: 1px solid rgba(255,255,255,0.12);
            color: rgba(255,255,255,0.4);
            font-size: 0.78rem;
            font-weight: 600;
            font-family: inherit;
            padding: 0.5rem 1.1rem;
            border-radius: 8px;
            cursor: pointer;
            transition: background 0.15s, color 0.15s;
        }
        .se-btn-cancel:hover { background: rgba(255,255,255,0.06); color: rgba(255,255,255,0.7); }
        .se-btn-save {
            background: rgba(201,176,55,0.15);
            border: 1px solid rgba(201,176,55,0.45);
            color: var(--primary-gold);
            font-size: 0.78rem;
            font-weight: 700;
            font-family: inherit;
            padding: 0.5rem 1.4rem;
            border-radius: 8px;
            cursor: pointer;
            transition: background 0.15s;
        }
        .se-btn-save:hover { background: rgba(201,176,55,0.28); }
        .se-btn-save:disabled { opacity: 0.45; cursor: not-allowed; }
        .se-error {
            grid-column: 1 / -1;
            font-size: 0.72rem;
            color: #f87171;
            background: rgba(248,113,113,0.08);
            border: 1px solid rgba(248,113,113,0.2);
            border-radius: 6px;
            padding: 0.5rem 0.75rem;
            display: none;
        }
        .se-error.visible { display: block; }

        /* ── Responsive filters: collapse one group before the row can wrap ── */
        @media (max-width: 1320px) {
            #hist-ticker-group {
                flex: 0 0 150px;
                min-width: 150px;
            }

            #hist-ticker-group .hfc-pills { display: none; }
            #hist-ticker-group .hfc-select { display: block; }
        }

        @media (max-width: 1100px) {
            #hist-direction-group {
                flex: 0 0 138px;
                min-width: 138px;
            }

            #hist-direction-group .hfc-pills { display: none; }
            #hist-direction-group .hfc-select { display: block; }
        }

        @media (max-width: 940px) {
            #hist-status-group {
                flex: 0 0 126px;
                min-width: 126px;
            }

            #hist-status-group .hfc-pills { display: none; }
            #hist-status-group .hfc-select { display: block; }
        }

        @media (max-width: 768px) {
            .main-content { padding: 0 1rem 2rem; }
            .sh-page-header { padding: 5.5rem 1rem 1.25rem; }

            .hfc-header { padding: 0.72rem 1rem; }

            .hfc-body {
                display: grid;
                grid-template-columns: repeat(2, minmax(0, 1fr));
                gap: 0.75rem;
                padding: 0.8rem 1rem 1rem;
            }

            .hfc-divider { display: none; }

            .hfc-group,
            #hist-ticker-group,
            #hist-direction-group,
            #hist-status-group,
            .hfc-date-group {
                width: auto;
                min-width: 0;
                padding-right: 0;
                flex: none;
                gap: 0.38rem;
            }

            .hfc-group .hfc-pills { display: none; }
            .hfc-group .hfc-select { display: block; }
            .hfc-date-custom { display: none; }

            .hfc-date-group.is-custom {
                grid-column: 1 / -1;
            }

            .hfc-date-group.is-custom .hfc-date-custom {
                display: block;
                margin-top: 0.15rem;
            }

            .hfc-date-row {
                display: grid;
                grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
                gap: 0.4rem;
            }

            .hfc-date-input { width: 100%; min-width: 0; }

            table.hist-table thead th,
            table.hist-table tbody td { padding: 0.6rem 0.75rem; }

            .hist-table-scroll { overflow-x: clip; }

            table.hist-table {
                table-layout: fixed;
                min-width: 0;
                width: calc(100% - 1.5rem);
                margin-inline: 0.75rem;
            }

            table.hist-table thead th,
            table.hist-table tbody td {
                padding: 0.6rem 0.35rem;
                overflow-x: clip;
            }

            table.hist-table thead th:nth-child(1) { width: 29%; }
            table.hist-table thead th:nth-child(2) { width: 20%; }
            table.hist-table thead th:nth-child(3) { width: 27%; }
            table.hist-table thead th:nth-child(4) { width: 24%; }

            table.hist-table thead th:nth-child(n+5),
            table.hist-table tbody tr.hist-data-row td:nth-child(n+5) {
                display: none;
            }

            table.hist-table thead th .sort-icon { display: none; }
            .hist-signal-type { display: none; }
            .hist-date { font-size: 0.7rem; }
            .hist-time { font-size: 0.58rem; }
            .hist-ticker-badge,
            .hist-dir-badge { padding-inline: 0.38rem; }

            table.hist-table tbody tr.hist-expansion-row > td {
                padding: 0;
                white-space: normal;
            }

            .hist-detail-actions {
                display: flex;
                align-items: center;
                gap: 0.5rem;
                padding: 0.9rem 1rem 1rem;
                background: rgba(255,255,255,0.02);
                border-top: 1px solid rgba(255,255,255,0.06);
                border-bottom: 1px solid rgba(255,255,255,0.06);
            }

            .hist-detail-actions .sig-track-btn,
            .hist-detail-actions .hist-log-btn {
                display: inline-flex;
                flex: 1 1 0;
                min-width: 0;
                height: 36px;
                padding: 0 0.6rem;
                align-items: center;
                justify-content: center;
                gap: 0.35rem;
                border-radius: 7px;
                font-size: 0.68rem;
                line-height: 1;
            }

            .hist-detail-actions .hist-edit-btn {
                width: 36px;
                height: 36px;
            }
        }

        /* ── Signal Activity Polar Year Clock ── */
        .pa-panel {
            background: #080B0F;
            border: 1px solid rgba(201,176,55,0.14);
            border-radius: 15px;
            box-shadow: 0 8px 32px rgba(0,0,0,0.4), inset 0 0 0 1px rgba(255,255,255,0.03);
            overflow-x: clip;
            margin-bottom: 1.25rem;
            opacity: 0;
            transform: translateY(20px);
            transition: opacity 0.5s ease, transform 0.5s ease;
        }

        .pa-panel.sp-visible {
            opacity: 1;
            transform: translateY(0);
        }

        .pa-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            padding: 1.1rem 1.5rem;
            border-bottom: 1px solid rgba(201,176,55,0.14);
        }

        .pa-header-copy {
            position: relative;
            display: flex;
            align-items: center;
            gap: 0.45rem;
        }

        .pa-header-label {
            display: inline-flex;
            align-items: center;
            gap: 10px;
            font-size: 0.72rem;
            font-weight: 700;
            letter-spacing: 0.18em;
            text-transform: uppercase;
            color: rgba(160,160,160,0.9);
        }

        .pa-header-label i {
            color: var(--primary-gold, #b3a17d);
            font-size: 0.9rem;
        }

        .pa-info-btn {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            width: 22px;
            height: 22px;
            padding: 0;
            border: 0;
            background: transparent;
            color: rgba(255,255,255,0.28);
            font-size: 0.72rem;
            cursor: help;
        }

        .pa-info-btn:hover,
        .pa-info-btn:focus-visible { color: var(--primary-gold); }

        .pa-info-tooltip {
            position: absolute;
            z-index: 30;
            top: calc(100% + 7px);
            left: 0;
            width: min(270px, 75vw);
            padding: 0.7rem 0.8rem;
            border: 1px solid rgba(255,255,255,0.12);
            border-radius: 9px;
            background: #0d1117;
            box-shadow: 0 10px 24px rgba(0,0,0,0.42);
            color: rgba(255,255,255,0.66);
            font-size: 0.68rem;
            line-height: 1.5;
            letter-spacing: 0;
            text-transform: none;
            opacity: 0;
            visibility: hidden;
            transform: translateY(-3px);
            transition: opacity 0.14s ease, transform 0.14s ease, visibility 0.14s;
            pointer-events: none;
        }

        .pa-info-btn:hover + .pa-info-tooltip,
        .pa-info-btn:focus-visible + .pa-info-tooltip {
            opacity: 1;
            visibility: visible;
            transform: translateY(0);
        }

        /* Year toggle pills */
        .pa-year-toggle { display: flex; gap: 6px; }

        .pa-yr-btn {
            padding: 5px 14px;
            border-radius: 999px;
            font-size: 0.72rem;
            font-weight: 700;
            letter-spacing: 0.06em;
            font-family: inherit;
            cursor: pointer;
            transition: background 0.15s, border-color 0.15s, color 0.15s;
            background: transparent;
            border: 1px solid rgba(201,176,55,0.14);
            color: rgba(160,160,160,0.9);
        }

        .pa-yr-btn:hover {
            border-color: rgba(201,176,55,0.4);
            color: rgba(255,255,255,0.8);
        }

        .pa-yr-btn.active {
            background: rgba(201,176,55,0.10);
            border-color: rgba(201,176,55,0.55);
            color: var(--primary-gold, #b3a17d);
        }

        /* Wheel body */
        .pa-wheel-body {
            display: flex;
            justify-content: center;
            align-items: center;
            padding: 1rem 2rem 0.75rem;
        }

        .pa-wheel-container {
            width: 100%;
            max-width: 560px;
        }

        .pa-wheel-container svg {
            width: 100%;
            height: auto;
            display: block;
        }

        .pa-loading {
            text-align: center;
            padding: 4rem 1rem;
            color: rgba(255,255,255,0.25);
            font-size: 0.82rem;
        }

        .pa-cell { cursor: default; opacity: 0; transition: opacity 120ms ease-out; }
        .pa-cell.pa-visible { opacity: 1; }
        .pa-cell:hover { opacity: 0.7; }

        @media (max-width: 768px) {
            .pa-wheel-body { padding: 1.25rem 1rem 1rem; }
            .pa-header { padding: 0.9rem 1rem; }
        }

        .hist-polar-loading {
            font-size: 0.78rem;
            color: rgba(255,255,255,0.25);
            padding: 1.25rem 1.5rem;
        }

        .hist-polar-body {
            display: flex;
            justify-content: center;
            align-items: center;
            padding: 1.75rem 2rem 1.25rem;
            position: relative;
        }

        .hist-polar-svg {
            display: block;
            width: 100%;
            max-width: 620px;
            height: auto;
            overflow: visible;
            animation: histWheelSettle 650ms cubic-bezier(0.22, 1, 0.36, 1) both;
        }

        .hist-activity-cell {
            cursor: default;
            opacity: 0;
            transform-box: fill-box;
            transform-origin: center;
            transition: filter 0.18s ease, opacity 0.15s ease, transform 0.18s ease;
            animation: histActivityCellReveal 720ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
            animation-delay: var(--cell-delay, 0ms);
        }

        .hist-activity-cell:hover,
        .hist-activity-cell.is-hovered {
            filter: drop-shadow(0 0 9px rgba(226, 207, 181, 0.62)) brightness(1.18);
            opacity: 1;
            transform: scale(1.018);
        }

        .hist-hover-cell-pop {
            opacity: 0;
            pointer-events: none;
            transform-box: fill-box;
            transform-origin: center;
            stroke: rgba(255,255,255,0.72);
            stroke-width: 1.2;
            vector-effect: non-scaling-stroke;
            filter: drop-shadow(0 0 12px rgba(226,207,181,0.54));
        }

        .hist-hover-cell-pop.visible {
            opacity: 1;
            animation: histCellHoverPop 980ms ease-in-out infinite;
        }

        .hist-day-label-marker {
            opacity: 0;
            fill: rgba(5, 8, 16, 0.86);
            stroke: rgba(226, 207, 181, 0.34);
            stroke-width: 0.8;
            pointer-events: none;
            animation: histLabelLift 560ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
            animation-delay: var(--label-delay, 420ms);
        }

        .hist-polar-bg {
            opacity: 0;
            animation: histSoftFade 700ms ease forwards;
        }

        .hist-month-line {
            opacity: 0;
            animation: histSoftFade 520ms ease forwards;
            animation-delay: var(--tick-delay, 280ms);
        }

        .hist-month-label,
        .hist-day-label {
            opacity: 0;
            pointer-events: none;
            animation: histLabelLift 560ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
            animation-delay: var(--label-delay, 420ms);
        }

        .hist-activity-tooltip {
            position: absolute;
            left: 0;
            top: 0;
            z-index: 4;
            min-width: 148px;
            padding: 0.55rem 0.65rem;
            border: 1px solid rgba(226, 207, 181, 0.34);
            border-radius: 8px;
            background: rgba(5, 8, 16, 0.94);
            box-shadow: 0 10px 28px rgba(0,0,0,0.42), inset 0 0 0 1px rgba(255,255,255,0.04);
            color: rgba(255,255,255,0.72);
            font-size: 0.68rem;
            line-height: 1.4;
            pointer-events: none;
            opacity: 0;
            transform: translate3d(var(--tip-x, 0), var(--tip-y, 0), 0) translate(-50%, calc(-100% - 12px)) scale(0.96);
            transform-origin: bottom center;
            transition: opacity 0.16s ease, transform 0.16s ease;
        }

        .hist-activity-tooltip.visible {
            opacity: 1;
            transform: translate3d(var(--tip-x, 0), var(--tip-y, 0), 0) translate(-50%, calc(-100% - 16px)) scale(1);
        }

        .hist-activity-tooltip-title {
            display: block;
            color: var(--secondary-gold);
            font-size: 0.6rem;
            font-weight: 800;
            letter-spacing: 0.11em;
            text-transform: uppercase;
        }

        .hist-activity-tooltip-count {
            display: block;
            color: #fff;
            font-size: 1.05rem;
            font-weight: 900;
            letter-spacing: -0.01em;
            line-height: 1.15;
            margin-top: 0.14rem;
        }

        .hist-activity-tooltip-meta {
            display: block;
            color: rgba(255,255,255,0.42);
            font-size: 0.6rem;
            font-weight: 700;
            letter-spacing: 0.08em;
            text-transform: uppercase;
            margin-top: 0.16rem;
        }

        .hist-today-line {
            opacity: 0;
            stroke-dashoffset: 12;
            animation: histTodayReveal 760ms ease forwards 760ms,
                       histTodayDash 1.35s linear infinite 1.35s;
        }

        .hist-today-dot {
            opacity: 0;
            transform-box: fill-box;
            transform-origin: center;
            animation: histTodayDot 1.8s ease-in-out infinite 980ms;
        }

        .hist-center-number {
            opacity: 0;
            transform-box: fill-box;
            transform-origin: center;
            animation: histCenterPop 680ms cubic-bezier(0.22, 1, 0.36, 1) forwards 420ms;
        }

        .hist-center-label,
        .hist-center-total {
            opacity: 0;
            animation: histLabelLift 520ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
        }

        .hist-center-label { animation-delay: 620ms; }
        .hist-center-total { animation-delay: 720ms; }

        .hist-polar-legend {
            display: flex;
            align-items: center;
            justify-content: center;
            gap: 1rem;
            padding: 0 2rem 1.5rem;
            color: var(--muted-text);
            font-size: 0.62rem;
            font-weight: 700;
            letter-spacing: 0.18em;
            line-height: 1.6;
            text-align: center;
            text-transform: uppercase;
            flex-wrap: wrap;
        }

        .hist-polar-legend-line {
            width: 16px;
            height: 1px;
            background: var(--gold-border);
            flex: 0 0 auto;
        }

        .hist-polar-legend-scale {
            display: inline-flex;
            align-items: center;
            justify-content: center;
            gap: 0.5rem;
        }

        .hist-polar-legend-cells {
            display: inline-flex;
            align-items: center;
            gap: 0.3rem;
        }

        .hist-polar-legend-cell {
            width: 11px;
            height: 11px;
            border-radius: 2px;
            flex: 0 0 auto;
            opacity: 0;
            animation: histLegendCell 520ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
            animation-delay: var(--legend-delay, 840ms);
        }

        @keyframes histWheelSettle {
            from { opacity: 0; transform: scale(0.985); }
            to { opacity: 1; transform: scale(1); }
        }

        @keyframes histActivityCellReveal {
            from { opacity: 0; filter: brightness(1.8); }
            62% { opacity: 0.96; }
            to { opacity: 1; filter: brightness(1); }
        }

        @keyframes histCellHoverPop {
            0% {
                transform: scale(1.045);
                filter: drop-shadow(0 0 10px rgba(226,207,181,0.42)) brightness(1.08);
            }
            48% {
                transform: scale(1.14);
                filter: drop-shadow(0 0 18px rgba(226,207,181,0.82)) brightness(1.24);
            }
            100% {
                transform: scale(1.055);
                filter: drop-shadow(0 0 10px rgba(226,207,181,0.46)) brightness(1.1);
            }
        }

        @keyframes histSoftFade {
            from { opacity: 0; }
            to { opacity: 1; }
        }

        @keyframes histLabelLift {
            from { opacity: 0; transform: translateY(4px); }
            to { opacity: 1; transform: translateY(0); }
        }

        @keyframes histTodayReveal {
            from { opacity: 0; stroke-dashoffset: 12; }
            to { opacity: 1; stroke-dashoffset: 0; }
        }

        @keyframes histTodayDash {
            from { stroke-dashoffset: 0; }
            to { stroke-dashoffset: -12; }
        }

        @keyframes histTodayDot {
            0% { opacity: 0.82; transform: scale(1); }
            50% { opacity: 1; transform: scale(1.32); }
            100% { opacity: 0.82; transform: scale(1); }
        }

        @keyframes histCenterPop {
            from { opacity: 0; transform: scale(0.9); filter: blur(2px); }
            to { opacity: 1; transform: scale(1); filter: blur(0); }
        }

        @keyframes histLegendCell {
            from { opacity: 0; transform: translateY(3px) scale(0.86); }
            to { opacity: 1; transform: translateY(0) scale(1); }
        }

        @media (prefers-reduced-motion: reduce) {
            .hist-polar-svg,
            .hist-activity-cell,
            .hist-hover-cell-pop,
            .hist-polar-bg,
            .hist-month-line,
            .hist-month-label,
            .hist-day-label-marker,
            .hist-day-label,
            .hist-today-line,
            .hist-today-dot,
            .hist-center-number,
            .hist-center-label,
            .hist-center-total,
            .hist-polar-legend-cell {
                animation: none !important;
                opacity: 1;
                transform: none;
                filter: none;
            }
        }

        @media (max-width: 600px) {
            .hist-hm-header {
                align-items: flex-start;
                flex-direction: column;
                padding: 0.95rem 1rem;
            }

            .hist-hm-year-toggle { justify-content: flex-start; }

            .hist-polar-body { padding: 1rem 0.35rem 0.75rem; }

            .hist-polar-legend {
                gap: 0.55rem;
                padding: 0 1rem 1rem;
                font-size: 0.56rem;
                letter-spacing: 0.12em;
            }
        }

        /* ================================================================
           SIGNAL PERFORMANCE STATS PANEL
        ================================================================ */
        /* Combined overview: activity wheel (left) + performance (right) in one card */
        .hist-overview {
            display: grid;
            grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr);
            gap: 1.4rem;
            align-items: stretch;
            background: rgba(255,255,255,0.02);
            border: 1px solid rgba(201,176,55,0.1);
            border-radius: 16px;
            padding: 1.25rem 1.4rem;
            margin-bottom: 1.25rem;
        }
        .hist-overview > .pa-panel { order: -1; }
        .hist-overview > .hist-stats-card,
        .hist-overview > .pa-panel {
            background: transparent;
            border: 0;
            border-radius: 0;
            padding: 0;
            margin: 0;
            box-shadow: none;
        }
        .hist-overview > .hist-stats-card {
            border-left: 1px solid rgba(201,176,55,0.1);
            padding-left: 1.4rem;
        }
        .hist-overview .pa-header,
        .hist-overview .hist-stats-header {
            min-height: 34px;
            margin-bottom: 0.75rem;
        }
        .hist-overview .pa-header {
            padding: 0;
            border-bottom: 0;
        }
        .hist-overview .pa-header-label {
            font-size: 0.86rem;
            letter-spacing: 0.06em;
        }
        .hist-overview .hist-stats-title {
            font-size: 0.86rem;
            letter-spacing: 0.06em;
        }
        .hist-overview .hsh-kpis { margin-bottom: 1rem; }
        .hist-overview .pa-wheel-container { max-width: 370px; }
        @media (max-width: 900px) {
            .hist-overview { grid-template-columns: 1fr; padding: 1.1rem; }
            .hist-overview > .hist-stats-card {
                border-left: 0; padding-left: 0;
                border-top: 1px solid rgba(201,176,55,0.1); padding-top: 1.25rem;
            }
            .hist-overview .pa-wheel-container { max-width: 560px; }
        }

        .hist-stats-card {
            background: rgba(255,255,255,0.02);
            border: 1px solid rgba(201,176,55,0.1);
            border-radius: 14px;
            padding: 1.25rem 1.5rem;
            margin-bottom: 1.25rem;
        }

        .hist-stats-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            margin-bottom: 1.25rem;
            flex-wrap: wrap;
            gap: 0.65rem;
            position: relative;
        }

        .hist-stats-title {
            font-size: 0.82rem;
            font-weight: 700;
            color: rgba(255,255,255,0.6);
            text-transform: uppercase;
            letter-spacing: 0.07em;
            display: flex;
            align-items: center;
            gap: 0.4rem;
        }

        /* Headline KPIs */
        .hsh-kpis {
            display: grid;
            grid-template-columns: repeat(3, 1fr);
            gap: 1px;
            background: rgba(201,176,55,0.08);
            border: 1px solid rgba(201,176,55,0.08);
            border-radius: 12px;
            overflow-x: clip;
            margin-bottom: 1.25rem;
        }

        .hsh-kpi {
            padding: 0.75rem 0.6rem;
            background: rgba(10,14,22,0.5);
            text-align: center;
        }

        .hsh-kpi:first-child { border-radius: 12px 0 0 12px; }
        .hsh-kpi:last-child  { border-radius: 0 12px 12px 0; }

        .hsh-kpi-val {
            font-size: clamp(1.17rem, 2.16vw, 1.53rem);
            font-weight: 900;
            letter-spacing: -0.03em;
            color: var(--light-text);
            line-height: 1;
            margin-bottom: 0.3rem;
            font-variant-numeric: tabular-nums;
        }

        .hsh-kpi-label {
            font-size: 0.54rem;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 0.1em;
            color: rgba(255,255,255,0.3);
        }

        /* Methodology tooltip */
        .hsp-method-btn {
            background: transparent;
            border: none;
            cursor: pointer;
            color: rgba(255,255,255,0.2);
            font-size: 0.85rem;
            padding: 0;
            margin-left: 0.4rem;
            line-height: 1;
            transition: color 0.15s;
        }
        .hsp-method-btn:hover { color: var(--primary-gold); }

        .hsp-method-tooltip {
            display: none;
            position: absolute;
            top: calc(100% + 8px);
            left: 0;
            z-index: 20;
            width: min(420px, 90vw);
            background: #0d1117;
            border: 1px solid rgba(201,176,55,0.3);
            border-radius: 10px;
            padding: 0.85rem 1rem;
            font-size: 0.72rem;
            line-height: 1.55;
            color: rgba(255,255,255,0.55);
            box-shadow: 0 8px 24px rgba(0,0,0,0.5);
        }
        .hsp-method-tooltip strong { color: rgba(255,255,255,0.8); }
        .hsp-method-tooltip.visible { display: block; }

        @media (max-width: 640px) {
            .hist-stats-title { padding-left: 0.6rem; }
            .hsh-kpi { padding: 0.65rem 0.25rem; }
            .hsh-kpi-val { font-size: 1.035rem; }
            .hsh-kpi-label {
                font-size: 0.45rem;
                letter-spacing: 0.06em;
                line-height: 1.25;
            }
            .hsp-period-bar { width: 100%; gap: 0.2rem; }
            .hsp-period-btn { flex: 1 1 0; padding-inline: 0.25rem; }
        }

        /* Period filter bar — mirrors equity-period-btn from trading-journal */
        .hsp-period-bar {
            display: flex;
            gap: 0.12rem;
        }

        .hsp-period-btn {
            background: transparent;
            border: none;
            cursor: pointer;
            padding: 0.28rem 0.6rem;
            font-size: 0.72rem;
            font-weight: 600;
            color: rgba(255,255,255,0.35);
            font-family: inherit;
            border-radius: 6px;
            transition: background 0.18s, color 0.18s;
        }

        .hsp-period-btn:hover { color: rgba(255,255,255,0.65); }

        .hsp-period-btn.active {
            background: rgba(201,176,55,0.15);
            color: var(--primary-gold);
        }

        /* Compact ticker cards — single scrollable row */
        .hsp-cards-row {
            display: grid;
            grid-template-columns: repeat(2, 1fr);
            gap: 0.6rem;
        }

        .hsp-ticker-card {
            width: auto;
            background: rgba(255,255,255,0.02);
            border: 1px solid rgba(255,255,255,0.07);
            border-radius: 12px;
            padding: 0.6rem 0.75rem 0.54rem;
            cursor: pointer;
            overflow-x: clip;
            transition: border-color 0.18s, background 0.18s, transform 0.15s;
        }
        .hsp-ticker-card:hover {
            border-color: rgba(255,255,255,0.18);
            background: rgba(255,255,255,0.04);
            transform: translateY(-1px);
        }

        .hsp-card-header {
            display: grid;
            grid-template-columns: auto minmax(0, 1fr) auto;
            align-items: center;
            gap: 0.4rem;
            margin-bottom: 0.42rem;
        }

        .hsp-ticker-badge {
            display: inline-block;
            justify-self: start;
            font-size: 0.63rem;
            font-weight: 800;
            letter-spacing: 0.05em;
            padding: 0.16rem 0.45rem;
            border-radius: 5px;
        }

        .hsp-card-sigcount {
            justify-self: end;
            font-size: 0.58rem;
            color: rgba(255,255,255,0.22);
        }

        .hsp-card-positions {
            display: flex;
            justify-content: center;
            gap: 0.3rem;
        }

        .hsp-card-kpis {
            display: grid;
            grid-template-columns: 1fr;
            gap: 0.3rem;
        }

        .hsp-kpi {
            text-align: center;
            padding: 0.22rem 0.15rem;
            background: rgba(255,255,255,0.025);
            border-radius: 6px;
        }

        .hsp-kpi-val {
            display: block;
            font-size: 0.95rem;
            font-weight: 800;
            color: rgba(255,255,255,0.78);
            letter-spacing: -0.02em;
            line-height: 1.2;
        }
        .hsp-kpi-val.muted { color: rgba(255,255,255,0.2); font-weight: 500; }

        .hsp-kpi-label {
            display: block;
            font-size: 0.48rem;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 0.07em;
            color: rgba(255,255,255,0.24);
            margin-top: 0.1rem;
        }

        .hsp-calls-pill, .hsp-puts-pill {
            font-size: 0.57rem;
            font-weight: 700;
            padding: 0.1rem 0.38rem;
            border-radius: 4px;
            letter-spacing: 0.02em;
        }
        .hsp-calls-pill { background: rgba(74,222,128,0.1);  color: #4ade80; }
        .hsp-puts-pill  { background: rgba(248,113,113,0.1); color: #f87171; }

        /* Popup overlay */
        .hsp-popup-backdrop {
            display: none;
            position: fixed;
            inset: 0;
            background: rgba(0,0,0,0.65);
            backdrop-filter: blur(4px);
            -webkit-backdrop-filter: blur(4px);
            z-index: 1000;
        }
        .hsp-popup-backdrop.open { display: block; }

        .hsp-popup-panel {
            display: none;
            position: fixed;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            z-index: 1001;
            width: min(600px, 92vw);
            max-height: 82vh;
            overflow-y: auto;
            background: #0d1117;
            border: 0;
            border-radius: 16px;
            padding: 1.4rem 1.5rem 1.5rem;
        }
        .hsp-popup-panel.open {
            display: block;
            animation: hspPopupIn 0.34s cubic-bezier(0.16, 1, 0.3, 1) both;
        }
        .hsp-popup-panel.bcs-closing {
            animation: hspPopupOut 0.18s ease-in both !important;
        }
        @keyframes hspPopupIn {
            from { opacity: 0; transform: translate(-50%, calc(-50% + 14px)) scale(0.95); }
            to   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
        }
        @keyframes hspPopupOut {
            from { opacity: 1; transform: translate(-50%, -50%) scale(1); }
            to   { opacity: 0; transform: translate(-50%, calc(-50% + 8px)) scale(0.96); }
        }
        @keyframes histTableIn {
            from { opacity: 0; transform: translateY(4px); }
            to   { opacity: 1; transform: none; }
        }
        .hist-table-in { animation: histTableIn 0.22s ease-out both; }

        .hsp-popup-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            margin-bottom: 0.8rem;
        }
        .hsp-popup-title {
            display: flex;
            align-items: center;
            gap: 0.7rem;
        }
        .hsp-popup-subtitle {
            font-size: 0.7rem;
            font-weight: 600;
            color: rgba(255,255,255,0.32);
            text-transform: uppercase;
            letter-spacing: 0.07em;
        }
        .hsp-popup-close {
            background: transparent;
            border: none;
            cursor: pointer;
            color: rgba(255,255,255,0.35);
            font-size: 1.3rem;
            line-height: 1;
            padding: 0.25rem 0.4rem;
            border-radius: 6px;
            font-family: inherit;
            transition: color 0.15s, background 0.15s;
        }
        .hsp-popup-close:hover { color: rgba(255,255,255,0.8); background: rgba(255,255,255,0.07); }

        .hsp-popup-summary {
            font-size: 0.68rem;
            color: rgba(255,255,255,0.28);
            margin-bottom: 1rem;
            padding-bottom: 0.7rem;
            border-bottom: 1px solid rgba(255,255,255,0.06);
            letter-spacing: 0.02em;
        }
        .hsp-popup-summary strong { color: rgba(255,255,255,0.55); font-weight: 700; }

        /* Two-column layout used inside popup */
        .hsp-two-col {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 0.75rem;
        }

        .hsp-col {
            display: flex;
            flex-direction: column;
            gap: 0.7rem;
            padding: 0.8rem 0.85rem;
            border-radius: 10px;
        }
        .hsp-col.calls { background: rgba(74,222,128,0.05);  border: 1px solid rgba(74,222,128,0.12); }
        .hsp-col.puts  { background: rgba(248,113,113,0.05); border: 1px solid rgba(248,113,113,0.12); }

        .hsp-col-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
        }
        .hsp-col-label {
            font-size: 0.62rem;
            font-weight: 700;
            letter-spacing: 0.08em;
            text-transform: uppercase;
        }
        .hsp-col.calls .hsp-col-label { color: #4ade80; }
        .hsp-col.puts  .hsp-col-label { color: #f87171; }
        .hsp-col-count { font-size: 0.6rem; color: rgba(255,255,255,0.25); }

        .hsp-stat-item {
            display: flex;
            flex-direction: column;
            gap: 0.2rem;
        }
        .hsp-stat-label {
            font-size: 0.56rem;
            font-weight: 700;
            letter-spacing: 0.07em;
            text-transform: uppercase;
            color: rgba(255,255,255,0.28);
        }
        .hsp-stat-val {
            font-size: 1.25rem;
            font-weight: 800;
            letter-spacing: -0.02em;
            line-height: 1;
            color: rgba(255,255,255,0.78);
        }
        .hsp-stat-val.muted { font-size: 0.9rem; color: rgba(255,255,255,0.2); font-weight: 500; }

        .hsp-stat-bar-track {
            height: 3px;
            border-radius: 999px;
            background: rgba(255,255,255,0.07);
            overflow-x: clip;
            margin-top: 0.08rem;
        }
        .hsp-stat-bar-fill {
            display: block;
            height: 100%;
            border-radius: 999px;
            transition: width 0.5s ease;
        }
        .hsp-col.calls .hsp-stat-bar-fill { background: linear-gradient(90deg, #4ade80, #86efac); }
        .hsp-col.puts  .hsp-stat-bar-fill { background: linear-gradient(90deg, #f87171, #fca5a5); }

        .hsp-avg-move strong { color: rgba(255,255,255,0.45); }

        .hsp-loading {
            text-align: center;
            padding: 2rem 1rem;
            color: rgba(255,255,255,0.25);
            font-size: 0.82rem;
        }

        @media (max-width: 768px) {
            .hsp-two-col { grid-template-columns: 1fr; }
            .hist-stats-header { flex-direction: column; align-items: flex-start; }

            /* Hide green call / red put count pills on mobile; keep total on the right */
            .hsp-card-positions {
                display: none;
            }
            .hsp-card-header {
                grid-template-columns: auto auto;
                justify-content: space-between;
            }

            /* Outcome column: STOPPED / CLOSED only — hide exit-reason sublines */
            .hist-status-reason {
                display: none;
            }
        }

        /* CSV export button */
        .hist-filter-toggle,
        .hist-export-btn {
            display: inline-flex;
            align-items: center;
            gap: 0.3rem;
            font-size: 0.68rem;
            font-weight: 700;
            font-family: inherit;
            padding: 0.32rem 0.75rem;
            border-radius: 8px;
            border: 1px solid rgba(201,176,55,0.25);
            background: rgba(201,176,55,0.07);
            color: rgba(255,255,255,0.45);
            cursor: pointer;
            transition: all 0.18s;
        }
        .hist-filter-toggle:hover,
        .hist-export-btn:hover {
            border-color: rgba(201,176,55,0.5);
            color: var(--primary-gold);
            background: rgba(201,176,55,0.13);
        }

        .hist-filter-toggle[aria-expanded="true"] {
            border-color: rgba(201,176,55,0.5);
            color: var(--primary-gold);
            background: rgba(201,176,55,0.13);
        }

        .hist-filter-toggle .hfc-active-count {
            padding: 0.04rem 0.34rem;
            font-size: 0.55rem;
        }

        /* Row accent border */
        table.hist-table tbody tr.hist-data-row td:first-child {
            box-shadow: inset 3px 0 0 var(--row-accent, transparent);
        }

        .hist-ticker-cell {
            white-space: nowrap;
        }

        .hist-signal-type {
            font-size: 0.58rem;
            font-weight: 600;
            color: rgba(255,255,255,0.3);
            letter-spacing: 0.04em;
            text-transform: uppercase;
            margin-top: 0.18rem;
        }

        .hist-num-cell {
            font-size: 0.78rem;
            color: rgba(255,255,255,0.6);
            font-variant-numeric: tabular-nums;
            white-space: nowrap;
        }

        /* CLS guard: footer is injected at runtime by footer-component.js. Reserve
           its rendered height so the swap does not shift the page bottom. Nav is
           position:fixed, so its placeholder needs no reserved space. */
        #footer-placeholder { display: block; min-height: 120px; }
        @media (max-width: 900px) { #footer-placeholder { min-height: 150px; } }
        @media (max-width: 560px) { #footer-placeholder { min-height: 180px; } }


        /* ================================================================
           POSITION SIZING PANEL
           Wears the .hist-overview shell and the .hsh-kpis hairline grid so
           it reads as the same page, not a new component. Slider values are
           ported from track-record's .tr-slider, the sibling control doing
           this exact job. No shadow and no glow: the neighbour has neither.
        ================================================================ */
        .hist-pnl-card {
            background: rgba(255,255,255,0.02);
            border: 1px solid rgba(201,176,55,0.1);
            border-radius: 16px;
            padding: 1.25rem 1.4rem;
            margin-bottom: 1.25rem;
            overflow-x: clip;
        }

        /* Same column rhythm and internal hairline as .hist-overview. */
        .hpn-top {
            display: grid;
            grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr);
            gap: 1.4rem;
            /* stretch, so the divider runs the full band instead of floating
               short against the taller column. Same as .hist-overview. */
            align-items: stretch;
            margin-bottom: 1.15rem;
        }

        .hpn-result {
            display: flex;
            flex-direction: column;
            justify-content: flex-end;
            border-left: 1px solid rgba(201,176,55,0.1);
            padding-left: 1.4rem;
            text-align: right;
        }

        /* ---- control ---- */
        .hpn-ctl-label,
        .hpn-hero-label {
            display: block;
            font-size: 0.54rem;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 0.1em;
            color: rgba(255,255,255,0.3);
            margin-bottom: 0.34rem;
        }

        .hpn-amount {
            font-size: 1.28rem;
            font-weight: 800;
            letter-spacing: -0.025em;
            color: var(--light-text);
            font-variant-numeric: tabular-nums;
            line-height: 1;
            margin-bottom: 0.85rem;
        }

        .hpn-slider { position: relative; min-width: 0; }

        .hpn-range {
            -webkit-appearance: none;
            appearance: none;
            display: block;
            width: 100%;
            height: 4px;
            border-radius: 999px;
            cursor: pointer;
            outline: none;
            background: linear-gradient(to right,
                var(--primary-gold) 0 var(--hpn-pct, 10%),
                rgba(255,255,255,0.09) var(--hpn-pct, 10%) 100%);
            transition: background 0.36s cubic-bezier(0.12,1,0.28,1);
        }

        .hpn-range::-webkit-slider-thumb {
            -webkit-appearance: none;
            appearance: none;
            width: 15px;
            height: 15px;
            border-radius: 50%;
            background: var(--primary-gold);
            border: 2px solid #0c0f16;
            box-shadow: 0 1px 3px rgba(0,0,0,0.55);
            cursor: grab;
        }

        .hpn-range::-moz-range-thumb {
            width: 15px;
            height: 15px;
            border-radius: 50%;
            background: var(--primary-gold);
            border: 2px solid #0c0f16;
            box-shadow: 0 1px 3px rgba(0,0,0,0.55);
            cursor: grab;
        }

        .hpn-range:focus-visible {
            box-shadow: 0 0 0 3px rgba(201,176,55,0.15);
        }

        .hpn-range-ends {
            display: flex;
            justify-content: space-between;
            margin-top: 0.7rem;
            font-size: 0.54rem;
            color: rgba(255,255,255,0.26);
            font-variant-numeric: tabular-nums;
        }

        .hpn-custom-btn,
        .hpn-custom-clear {
            margin-top: 0.75rem;
            background: none;
            border: 0;
            padding: 0;
            font-family: inherit;
            font-size: 0.66rem;
            font-weight: 600;
            color: rgba(255,255,255,0.32);
            cursor: pointer;
            text-align: left;
            transition: color 0.18s ease;
        }

        .hpn-custom-btn:hover,
        .hpn-custom-clear:hover { color: var(--primary-gold); }

        .hpn-custom { margin-top: 0.85rem; }
        .hpn-custom[hidden] { display: none; }

        .hpn-custom-row {
            display: flex;
            align-items: center;
            gap: 0.34rem;
            background: #0d1117;
            border: 1px solid rgba(255,255,255,0.12);
            border-radius: 8px;
            padding: 0.35rem 0.55rem;
        }

        .hpn-custom-row:focus-within {
            border-color: rgba(201,176,55,0.48);
            box-shadow: 0 0 0 2px rgba(201,176,55,0.08);
        }

        .hpn-custom-prefix {
            font-size: 0.78rem;
            font-weight: 700;
            color: rgba(255,255,255,0.32);
        }

        .hpn-custom-input {
            flex: 1;
            min-width: 0;
            background: none;
            border: 0;
            outline: none;
            color: rgba(255,255,255,0.85);
            font-family: inherit;
            font-size: 0.82rem;
            font-weight: 700;
            font-variant-numeric: tabular-nums;
        }

        .hpn-custom-clear { margin-top: 0.5rem; display: block; }

        /* ---- result: the focal value, plain weight and colour only ---- */
        .hpn-hero-val {
            font-size: clamp(1.9rem, 4.4vw, 2.75rem);
            font-weight: 900;
            letter-spacing: -0.035em;
            line-height: 1;
            color: var(--light-text);
            font-variant-numeric: tabular-nums;
        }

        .hpn-hero-delta {
            margin-top: 0.4rem;
            font-size: 0.8rem;
            font-weight: 800;
            color: var(--gray-text);
            font-variant-numeric: tabular-nums;
        }

        .hpn-hero-delta.is-up   { color: #4ade80; }
        .hpn-hero-delta.is-down { color: #f87171; }

        /* ---- stat strip: the .hsh-kpis hairline grid, full width ---- */
        .hpn-strip {
            display: grid;
            grid-template-columns: repeat(4, minmax(0, 1fr));
            gap: 1px;
            background: rgba(201,176,55,0.08);
            border: 1px solid rgba(201,176,55,0.08);
            border-radius: 12px;
            overflow-x: clip;
        }

        .hpn-cell {
            padding: 0.75rem 0.6rem;
            background: rgba(10,14,22,0.5);
            text-align: center;
        }

        .hpn-cell:first-child { border-radius: 12px 0 0 12px; }
        .hpn-cell:last-child  { border-radius: 0 12px 12px 0; }

        .hpn-cell-val {
            font-size: clamp(0.92rem, 1.6vw, 1.12rem);
            font-weight: 800;
            letter-spacing: -0.025em;
            color: var(--light-text);
            line-height: 1;
            margin-bottom: 0.3rem;
            font-variant-numeric: tabular-nums;
        }

        .hpn-cell-label {
            font-size: 0.54rem;
            font-weight: 700;
            text-transform: uppercase;
            letter-spacing: 0.1em;
            color: rgba(255,255,255,0.3);
        }

        .hpn-note {
            margin: 0.9rem 0 0;
            font-size: 0.68rem;
            line-height: 1.5;
            color: rgba(255,255,255,0.38);
        }

        .hpn-note:empty { display: none; }

        .hpn-fence {
            margin: 1rem 0 0;
            padding-top: 0.85rem;
            border-top: 1px solid rgba(255,255,255,0.07);
            font-size: 0.63rem;
            line-height: 1.6;
            color: rgba(255,255,255,0.3);
        }

        .hpn-fence i { color: rgba(201,176,55,0.6); margin-right: 0.34rem; }
        .hpn-fence a { color: var(--primary-gold); text-decoration: underline; }

        @media (max-width: 900px) {
            .hpn-top { grid-template-columns: 1fr; gap: 1.25rem; align-items: start; }
            .hpn-result {
                border-left: 0;
                padding-left: 0;
                border-top: 1px solid rgba(201,176,55,0.1);
                padding-top: 1.25rem;
                text-align: left;
            }
        }

        @media (max-width: 720px) {
            .hpn-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
            .hpn-cell:first-child { border-radius: 12px 0 0 0; }
            .hpn-cell:nth-child(2) { border-radius: 0 12px 0 0; }
            .hpn-cell:nth-child(3) { border-radius: 0 0 0 12px; }
            .hpn-cell:last-child   { border-radius: 0 0 12px 0; }
        }

        @media (max-width: 420px) {
            .hist-pnl-card { padding: 1.1rem 1rem; }
        }

        @media (prefers-reduced-motion: reduce) {
            .hpn-range { transition: none; }
        }

/* Expanded trades own their layout, independent of the table's nowrap cells. */
table.hist-table tbody tr.hist-expansion-row > td {
    padding: 0;
    white-space: normal;
}
.sig-detail.sig-detail-history {
    grid-template-columns: minmax(0, 1.35fr) minmax(280px, 1fr);
    align-items: start;
    gap: 20px;
    padding: 20px;
}
.sig-detail-history .sig-detail-info,
.sig-detail-history .sig-detail-section,
.sig-detail-history .sig-detail-grid > div { min-width: 0; }
.sig-detail-history .sig-detail-info { display: grid; gap: 14px; }
.sig-detail-history .sig-detail-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.sig-detail-history .sig-detail-grid .value,
.sig-detail-history .sig-play-sub { overflow-wrap: anywhere; }
.sig-detail-history .sig-play { margin-bottom: 8px; padding: 14px 16px; }
.sig-detail-history .sig-play-chart-toggle { margin-bottom: 0; }
.sig-detail-history .sig-playc svg { max-height: none; }
.sig-detail-history .sig-detail-section + .sig-detail-section { padding-top: 14px; }
.sig-detail-history .sig-step { padding-bottom: 10px; }
.sig-detail-history .sig-step:last-child { padding-bottom: 0; }
@media (min-width: 1100px) {
    .sig-detail-history .sig-detail-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
.sig-detail-history .sig-play-foot { gap: 12px; flex-wrap: wrap; }
@media (max-width: 900px) {
    .sig-detail.sig-detail-history { grid-template-columns: minmax(0, 1fr); gap: 20px; padding: 16px; }
    .sig-detail-history .sig-detail-info { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .sig-detail-history .sig-detail-section + .sig-detail-section { border-top: 0; padding-top: 0; }
}
@media (max-width: 600px) {
    .sig-detail-history .sig-detail-info { grid-template-columns: minmax(0, 1fr); }
    .sig-detail-history .sig-detail-grid { grid-auto-rows: minmax(44px, auto); }
    .sig-detail-history .sig-detail-section + .sig-detail-section {
        border-top: 1px solid rgba(255,255,255,0.06); padding-top: 16px;
    }
}
