/* Signal History Page Styles */

html {
    width: 100%;
    max-width: 100vw;
    /* Don't set overflow on html - breaks sticky headers */
}

body {
    width: 100%;
    max-width: 100vw;
    overflow-x: clip; /* Use clip instead of hidden - doesn't break sticky */
}

/* Make navbar fully opaque on signal history page */
.navbar {
    background: rgba(255, 254, 247, 1) !important;
    backdrop-filter: blur(20px) saturate(180%);
    opacity: 1 !important;
    transition: transform 1.5s cubic-bezier(0.4, 0, 0.2, 1) !important;
}

@media (max-width: 768px) {
    .navbar {
        transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1) !important;
    }
}

.nav-link {
    color: #A0522D;
    text-decoration: none;
    font-weight: 600;
    font-size: 15px;
    padding: 10px 20px;
    border-radius: 10px;
    transition: all 0.3s ease;
}

.nav-link:hover {
    opacity: 0.7;
}

.page-header {
    background: linear-gradient(135deg, rgba(160, 82, 45, 0.05) 0%, rgba(205, 133, 63, 0.03) 100%);
    padding: 40px 0 60px;
    margin-top: -88px;
    padding-top: calc(88px + 40px);
    margin-bottom: 60px;
    border-bottom: 1px solid rgba(160, 82, 45, 0.15);
}

@media (max-width: 768px) {
    .page-header {
        margin-top: -59px;
        padding-top: calc(59px + 40px);
    }
}

.header-content {
    text-align: center;
}

.page-header h1 {
    font-size: 64px;
    font-weight: 900;
    letter-spacing: -3px;
    color: #3E2723;
    margin-bottom: 16px;
}

body.rtl .page-header h1 {
    font-size: 80px !important;
    font-weight: 900 !important;
}

.page-header p {
    font-size: 20px;
    color: rgba(62, 39, 35, 0.7);
    font-weight: 400;
    margin-bottom: 12px;
}

.page-note {
    font-size: 15px;
    color: rgba(62, 39, 35, 0.6);
    font-weight: 500;
    margin-bottom: 0;
}

/* Settings Bar */
.settings-bar {
    background: linear-gradient(135deg, #FFF9F0 0%, #ffffff 100%);
    border: 2px solid rgba(160, 82, 45, 0.2);
    border-radius: 20px;
    padding: 32px;
    margin-bottom: 32px;
    display: flex;
    gap: 40px;
    align-items: center;
    justify-content: center;
}

.settings-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.settings-label {
    font-size: 13px;
    font-weight: 700;
    color: #5D4037;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.settings-input {
    padding: 14px 20px;
    font-size: 16px;
    font-weight: 600;
    color: #3E2723;
    border: 2px solid rgba(160, 82, 45, 0.3);
    border-radius: 12px;
    background: white;
    width: 180px;
    transition: all 0.3s ease;
}

.settings-input:focus {
    outline: none;
    border-color: #A0522D;
    box-shadow: 0 0 0 3px rgba(160, 82, 45, 0.1);
}

/* Filter Bar */
.filter-bar {
    background: linear-gradient(135deg, #ffffff 0%, #FFF9F0 100%);
    border: 1px solid rgba(160, 82, 45, 0.15);
    border-radius: 20px;
    padding: 32px;
    margin-bottom: 40px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.filter-header {
    display: flex;
    align-items: center;
    gap: 12px;
}

.filter-label {
    font-size: 14px;
    font-weight: 700;
    color: #5D4037;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.filter-description {
    font-size: 13px;
    font-weight: 500;
    color: rgba(62, 39, 35, 0.65);
    font-style: italic;
}

.filter-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: flex-start;
}

.filter-btn {
    padding: 10px 12px;
    background: rgba(160, 82, 45, 0.08);
    border: 1px solid rgba(160, 82, 45, 0.2);
    border-radius: 12px;
    color: #5D4037;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    white-space: nowrap;
    width: 130px;
    box-sizing: border-box;
    height: 40px;
}

.filter-btn:hover {
    background: rgba(160, 82, 45, 0.15);
    border-color: rgba(160, 82, 45, 0.4);
    transform: translateY(-2px);
}

.filter-btn.active {
    background: linear-gradient(135deg, #A0522D 0%, #CD853F 50%, #DAA520 100%);
    color: white;
    border-color: transparent;
    box-shadow: 0 4px 16px rgba(160, 82, 45, 0.3);
}

.filter-date-picker {
    padding: 12px 24px;
    background: rgba(160, 82, 45, 0.08);
    border: 1px solid rgba(160, 82, 45, 0.2);
    border-radius: 12px;
    color: #5D4037;
    font-size: 14px;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 180px;
}

.filter-date-picker:hover {
    background: rgba(160, 82, 45, 0.15);
    border-color: rgba(160, 82, 45, 0.4);
}

.filter-date-picker:focus {
    outline: none;
    border-color: #A0522D;
    background: rgba(160, 82, 45, 0.12);
}

/* Custom Date Range Container */
.custom-date-range {
    display: flex;
    align-items: center;
    gap: 8px;
}

.custom-date-range .filter-date-picker {
    min-width: 140px;
    padding: 10px 14px;
}

.date-range-separator {
    color: #8B7355;
    font-size: 13px;
    font-weight: 500;
}

/* Flatpickr Weekend Styling */
.flatpickr-calendar {
    font-family: 'Inter', sans-serif;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(160, 82, 45, 0.2);
}

.flatpickr-day.flatpickr-disabled,
.flatpickr-day.flatpickr-disabled:hover {
    color: rgba(62, 39, 35, 0.2) !important;
    background: transparent !important;
    cursor: not-allowed !important;
    text-decoration: line-through;
}

.filter-date-picker::placeholder {
    color: rgba(93, 64, 55, 0.5);
    font-weight: 500;
    text-align: center;
}

.flatpickr-input::placeholder {
    color: rgba(93, 64, 55, 0.5);
    font-weight: 500;
    text-align: center;
}

.filter-date-picker,
.flatpickr-input {
    text-align: center;
}

/* Separate date input boxes (DD/Month/YYYY) */
.date-input-group {
    display: flex;
    align-items: center;
    background: rgba(160, 82, 45, 0.08);
    border: 1px solid rgba(160, 82, 45, 0.2);
    border-radius: 12px;
    padding: 0 8px;
    gap: 2px;
    transition: border-color 0.2s;
    height: 40px;
    box-sizing: border-box;
}

.date-input-group:focus-within {
    border-color: #A0522D;
    background: rgba(160, 82, 45, 0.12);
}

.date-part {
    border: none;
    background: transparent;
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    font-weight: 600;
    color: #5D4037;
    text-align: center;
    outline: none;
}

.date-part.day {
    width: 22px;
}

.date-part.month-name {
    width: 24px;
    cursor: pointer;
}

.date-part.year {
    width: 38px;
}

.date-part::placeholder {
    color: rgba(93, 64, 55, 0.4);
    font-weight: 500;
}

.date-sep {
    color: rgba(93, 64, 55, 0.4);
    font-size: 14px;
    font-weight: 500;
}

.flatpickr-day.selected {
    background: #A0522D !important;
    border-color: #A0522D !important;
}

.flatpickr-day:hover:not(.flatpickr-disabled) {
    background: rgba(160, 82, 45, 0.15);
    border-color: rgba(160, 82, 45, 0.3);
}

.flatpickr-months .flatpickr-month {
    background: rgba(160, 82, 45, 0.05);
}

.flatpickr-current-month .flatpickr-monthDropdown-months,
.flatpickr-current-month input.cur-year,
.flatpickr-year-dropdown {
    font-weight: 600;
    color: #3E2723;
}

.flatpickr-current-month .flatpickr-monthDropdown-months {
    background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath fill='%233E2723' d='M0 0l5 6 5-6z'/%3E%3C/svg%3E") no-repeat right center !important;
    background-size: 10px 6px !important;
    border: none !important;
    font-size: 14px !important;
    cursor: pointer !important;
    padding: 0 18px 0 4px !important;
    padding-right: 18px !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
}

/* Ensure month dropdown arrow shows on all devices */
select.flatpickr-monthDropdown-months {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath fill='%233E2723' d='M0 0l5 6 5-6z'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right center !important;
    background-size: 10px 6px !important;
    -webkit-appearance: none !important;
    -moz-appearance: none !important;
    appearance: none !important;
}

.flatpickr-year-dropdown {
    background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath fill='%233E2723' d='M0 0l5 6 5-6z'/%3E%3C/svg%3E") no-repeat right center;
    border: none;
    font-size: 14px;
    cursor: pointer;
    padding: 0 16px 0 4px;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

/* Hide year up/down arrows */
.flatpickr-current-month .numInputWrapper {
    width: auto;
}

.flatpickr-current-month .numInputWrapper span.arrowUp,
.flatpickr-current-month .numInputWrapper span.arrowDown {
    display: none !important;
}

.flatpickr-current-month input.cur-year {
    pointer-events: none;
}

.flatpickr-weekday {
    color: #8B7355;
    font-weight: 600;
}

.flatpickr-today-btn {
    width: 100%;
    padding: 6px;
    background: rgba(160, 82, 45, 0.08);
    color: #5D4037;
    border: none;
    border-top: 1px solid rgba(160, 82, 45, 0.15);
    border-radius: 0 0 12px 12px;
    font-weight: 500;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.flatpickr-today-btn:hover {
    background: rgba(160, 82, 45, 0.15);
}

/* Time Filter Section */
.time-filter-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-top: 20px;
    border-top: 1px solid rgba(160, 82, 45, 0.1);
    margin-top: 8px;
}

.time-filter-header {
    display: flex;
    align-items: center;
    gap: 8px;
}

.time-filter-current {
    margin-top: -8px;
}

.time-filter-label {
    font-size: 13px;
    font-weight: 700;
    color: #5D4037;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.time-filter-hint {
    font-size: 12px;
    font-weight: 500;
    color: rgba(93, 64, 55, 0.6);
}

#londonLiveClock {
    font-weight: 700;
    color: rgba(93, 64, 55, 0.6);
    font-family: 'Inter', monospace;
    letter-spacing: 0.5px;
    font-variant-numeric: tabular-nums;
    display: inline-block;
    min-width: 70px;
}

.time-filter-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 20px;
}

.time-range-container {
    display: flex;
    align-items: center;
    gap: 12px;
}

.time-input-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.time-input-label {
    font-size: 11px;
    font-weight: 700;
    color: #5D4037;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: linear-gradient(135deg, #A0522D 0%, #CD853F 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.time-input {
    padding: 8px 12px;
    background: rgba(160, 82, 45, 0.04);
    border: 1px solid rgba(160, 82, 45, 0.15);
    border-radius: 8px;
    color: #3E2723;
    font-size: 15px;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 110px;
}

/* Hide reset/clear button on time inputs */
.time-input::-webkit-clear-button {
    display: none;
    -webkit-appearance: none;
}

.time-input::-webkit-inner-spin-button {
    display: none;
    -webkit-appearance: none;
}

.time-input:hover {
    border-color: rgba(160, 82, 45, 0.4);
    background: rgba(160, 82, 45, 0.06);
}

.time-input:focus {
    outline: none;
    border-color: #A0522D;
    background: white;
    box-shadow: 0 0 0 3px rgba(160, 82, 45, 0.1);
}

.time-range-separator {
    font-size: 14px;
    font-weight: 500;
    color: rgba(93, 64, 55, 0.6);
    padding: 0 8px;
    text-transform: lowercase;
}

.time-filter-actions {
    display: flex;
    gap: 10px;
}

.time-filter-apply {
    padding: 12px 24px;
    background: linear-gradient(135deg, #A0522D 0%, #CD853F 100%);
    border: none;
    border-radius: 10px;
    color: white;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(160, 82, 45, 0.2);
}

.time-filter-apply:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(160, 82, 45, 0.3);
}

.time-filter-apply:active {
    transform: translateY(0);
}

.time-filter-apply.active {
    background: linear-gradient(135deg, #228B22 0%, #32CD32 100%);
    box-shadow: 0 2px 8px rgba(34, 139, 34, 0.3);
}

.time-filter-clear {
    padding: 12px 20px;
    background: transparent;
    border: 1px solid rgba(160, 82, 45, 0.25);
    border-radius: 10px;
    color: #5D4037;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.time-filter-clear:hover {
    background: rgba(160, 82, 45, 0.08);
    border-color: rgba(160, 82, 45, 0.4);
}

@media (max-width: 768px) {
    .time-filter-section {
        gap: 16px;
    }

    .time-filter-controls {
        flex-direction: column;
        align-items: stretch;
        gap: 16px;
    }

    .time-range-container {
        justify-content: center;
        padding: 12px 20px;
    }

    .time-filter-actions {
        justify-content: stretch;
    }

    .time-filter-apply,
    .time-filter-clear {
        flex: 1;
        text-align: center;
    }
}

/* Sort Controls */
.sort-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 16px;
    background: linear-gradient(135deg, rgba(160, 82, 45, 0.05) 0%, rgba(160, 82, 45, 0.02) 100%);
    border: 1px solid rgba(160, 82, 45, 0.15);
    border-radius: 12px;
    min-width: 225px;
    min-height: 44px;
    box-sizing: border-box;
}

.sort-label {
    font-size: 13px;
    font-weight: 600;
    color: #5D4037;
    user-select: none;
    white-space: nowrap;
}

.sort-select {
    padding: 6px 12px;
    background: white;
    border: 1px solid rgba(160, 82, 45, 0.3);
    border-radius: 8px;
    color: #3E2723;
    font-size: 13px;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: all 0.3s ease;
    outline: none;
}

.sort-select:hover {
    border-color: #A0522D;
    background: rgba(160, 82, 45, 0.05);
}

.sort-select:focus {
    border-color: #A0522D;
    box-shadow: 0 0 0 3px rgba(160, 82, 45, 0.1);
}

/* Active Positions Toggle */
.active-toggle-container {
    display: flex;
    flex-direction: row-reverse;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 16px;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.05) 0%, rgba(59, 130, 246, 0.02) 100%);
    border: 1px solid rgba(59, 130, 246, 0.15);
    border-radius: 12px;
    min-width: 225px;
    min-height: 44px;
    box-sizing: border-box;
}

.toggle-label {
    position: relative;
    display: inline-block;
    width: 52px;
    height: 28px;
    cursor: pointer;
}

.toggle-label input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(160, 82, 45, 0.2);
    transition: all 0.3s ease;
    border-radius: 28px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: all 0.3s ease;
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.toggle-label input:checked + .toggle-slider {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
}

.toggle-label input:checked + .toggle-slider:before {
    transform: translateX(24px);
}

.toggle-text {
    font-size: 13px;
    font-weight: 600;
    color: #3b82f6;
    user-select: none;
    white-space: nowrap;
}

/* Toggle Tooltip */
.toggle-tooltip {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    padding: 12px 16px;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: white;
    font-size: 12px;
    font-weight: 600;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(59, 130, 246, 0.3);
    white-space: nowrap;
    z-index: 1000;
    opacity: 0;
    transform: translateY(-10px);
    transition: all 0.3s ease;
    pointer-events: none;
}

.toggle-tooltip::before {
    content: '';
    position: absolute;
    bottom: 100%;
    right: 20px;
    border: 6px solid transparent;
    border-bottom-color: #3b82f6;
}

.toggle-tooltip.show {
    opacity: 1;
    transform: translateY(0);
}

.results-header-right {
    position: relative;
}

/* Period Message */
.period-message {
    text-align: center;
    font-size: 18px;
    font-weight: 600;
    color: #5D4037;
    margin-bottom: 50px;
    padding: 20px;
    background: linear-gradient(135deg, rgba(160, 82, 45, 0.05) 0%, rgba(205, 133, 63, 0.03) 100%);
    border-radius: 16px;
    border: 1px solid rgba(160, 82, 45, 0.15);
    position: relative;
}

.period-message::after {
    content: '▼';
    position: absolute;
    bottom: -32px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 20px;
    color: #A0522D;
    text-shadow: 0 0 10px rgba(160, 82, 45, 0.3);
    animation: bounce 2s ease-in-out infinite;
}

@keyframes bounce {
    0%, 100% {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
    }
    50% {
        transform: translateX(-50%) translateY(5px);
        opacity: 0.7;
    }
}

.period-highlight {
    font-weight: 800;
    color: #A0522D;
    text-transform: capitalize;
}

/* Summary Stats */
.summary-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 24px;
    margin-bottom: 60px;
    direction: ltr;
}

.summary-card {
    background: linear-gradient(135deg, #ffffff 0%, #FFF9F0 100%);
    border: 1px solid rgba(160, 82, 45, 0.15);
    border-radius: 20px;
    padding: 32px 8px;
    text-align: center;
    transition: all 0.4s ease;
    overflow: hidden;
}

.summary-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 32px rgba(160, 82, 45, 0.15);
}

.summary-label {
    font-size: 12px;
    color: #5D4037;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    font-weight: 800;
    margin-bottom: 12px;
    white-space: nowrap;
}

.summary-value {
    font-size: 48px;
    font-weight: 900;
    background: linear-gradient(135deg, #A0522D 0%, #CD853F 50%, #DAA520 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    line-height: 1.2;
    letter-spacing: -2px;
    white-space: nowrap;
}

.summary-value.win {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.summary-value.loss {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Results Section */
.results-section {
    margin-bottom: 80px;
}

.results-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 40px;
    gap: 4px;
}

.results-header h2 {
    font-size: 36px;
    font-weight: 900;
    color: #3E2723;
    letter-spacing: -1px;
    margin: 0;
}

.results-controls-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 16px;
    margin-bottom: 0;
    overflow: hidden;
    box-sizing: border-box;
}

.results-header-right {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 12px;
    margin-left: auto;
}

.results-count {
    font-size: 16px;
    color: #5D4037;
    font-weight: 600;
}

.count-number {
    font-size: 24px;
    font-weight: 900;
    background: linear-gradient(135deg, #A0522D 0%, #CD853F 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin: 0 8px;
}

/* Results Table */
.results-table {
    background: linear-gradient(135deg, #ffffff 0%, #FFF9F0 100%);
    border: none;
    border-radius: 20px;
    direction: ltr;
}

/* NOTE: overflow-x: auto breaks position: sticky on table-header
   The table-header sticky behavior requires no overflow on parent.
   On mobile (768px), the table header is hidden anyway so we handle
   horizontal scrolling differently via the table-body overflow */
@media (max-width: 1280px) and (min-width: 769px) {
    /* Don't set overflow on results-table to preserve sticky header */
    .results-table {
        overflow-x: visible;
    }

    /* Let the table body scroll horizontally if needed */
    .table-body {
        overflow-x: auto;
    }
}

/* Sticky wrapper for both headers */
.sticky-headers {
    position: -webkit-sticky;
    position: sticky;
    top: var(--navbar-height, 88px);
    z-index: 999;
    transition: top 1.5s cubic-bezier(0.4, 0, 0.2, 1);
    background: #FEF8EF;
    margin-top: 0;
}

/* Sticky header position is controlled by JavaScript via --navbar-height variable */

/* Match mobile navbar transition speed */
@media (max-width: 768px) {
    .sticky-headers {
        transition: top 0.5s cubic-bezier(0.4, 0, 0.2, 1);
        display: none;
    }
}

.table-header {
    display: grid;
    grid-template-columns: 40px 1fr 1fr 1.5fr 1.5fr 1fr 1fr 1fr 0.8fr 1fr;
    gap: 10px;
    padding: 24px 20px;
    border: 1.5px solid rgba(160, 82, 45, 0.15);
    border-bottom: none;
    background: linear-gradient(135deg, rgba(255, 249, 240, 0.98) 0%, rgba(255, 255, 255, 0.98) 100%);
    backdrop-filter: blur(10px);
    border-radius: 20px 20px 0 0;
    box-shadow: none;
    position: relative;
    z-index: 1;
}

/* Show bottom border when sticky header is stuck - only primary header */
.sticky-headers.is-stuck .table-header:not(.table-header-secondary) {
    border-bottom: 1.5px solid rgba(160, 82, 45, 0.15);
}

.table-header .table-cell {
    font-size: 11px;
    font-weight: 800;
    color: #5D4037;
    text-transform: uppercase;
    letter-spacing: 1.2px;
    justify-content: center;
    text-align: center;
}

/* Secondary header - positioned behind the primary, same exact position */
.table-header.table-header-secondary {
    position: absolute;
    top: 0;
    left: -50vw;
    right: -50vw;
    z-index: -1;
    border-radius: 0;
    background: #FFFEF7;
    border: none;
    box-shadow: none;
    backdrop-filter: none;
}

/* Match the page's gradient overlay on secondary header */
.table-header.table-header-secondary::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background:
        radial-gradient(circle at 20% 50%, rgba(160, 82, 45, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(218, 165, 32, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 40% 20%, rgba(205, 133, 63, 0.06) 0%, transparent 50%);
    background-attachment: fixed;
    pointer-events: none;
}


.table-body {
    /* No max-height or overflow here */
    border: 1px solid rgba(160, 82, 45, 0.15);
    border-top: none;
    border-radius: 0 0 20px 20px;
}

.table-row {
    display: grid;
    grid-template-columns: 40px 1fr 1fr 1.5fr 1.5fr 1fr 1fr 1fr 0.8fr 1fr;
    gap: 10px;
    padding: 20px 20px;
    border-bottom: 1px solid rgba(160, 82, 45, 0.1);
    transition: all 0.2s ease;
}

.table-row:hover {
    background: rgba(160, 82, 45, 0.05);
}

.table-row:last-child {
    border-bottom: none;
}

.table-cell {
    font-size: 15px;
    font-weight: 600;
    color: #3E2723;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.cell-number {
    font-size: 14px;
    font-weight: 600;
    color: #8B7355;
}

.cell-date {
    font-size: 16px;
    color: #5D4037;
}

.cell-pair {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
    color: #5D4037;
    background: linear-gradient(135deg, #3E2723 0%, #5D4037 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.cell-time {
    font-size: 14px;
    color: #5D4037;
    font-weight: 600;
    line-height: 1.4;
}

.cell-datetime {
    font-size: 14px;
    color: #5D4037;
    font-weight: 600;
    line-height: 1.4;
}

.cell-price {
    font-size: 14px;
    color: #5D4037;
    font-weight: 600;
    line-height: 1.4;
}

.cell-result {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 6px;
    font-weight: 700;
    font-size: 12px;
    min-width: 56px;
}

.result-win {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: 999px !important;
}

.result-win::before {
    content: none;
}

.result-loss {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 999px !important;
}

.result-loss::before {
    content: none;
}

/* Status column styling */
.cell-status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 13px;
    min-width: 90px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.status-active {
    background: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
    -webkit-text-fill-color: #3b82f6;
    border: 1px solid rgba(59, 130, 246, 0.3);
    animation: pulse-glow 2s ease-in-out infinite;
    border-radius: 999px !important;
}

.status-tp {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
    border: 1px solid rgba(16, 185, 129, 0.3);
    min-width: 90px;
}

.status-sl {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
    border: 1px solid rgba(239, 68, 68, 0.3);
    min-width: 90px;
}

/* Direction column styling */
.cell-direction {
    font-weight: 600;
    font-size: 14px;
    text-transform: uppercase;
    color: #5D4037;
}

/* Pulsing animation for active status */
@keyframes pulse-glow {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.4);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 0 15px 3px rgba(59, 130, 246, 0.3);
        transform: scale(1.05);
    }
}

/* Active row styling */
.table-row.row-active {
    background: rgb(248, 251, 255);
    border-top: 1px solid rgba(59, 130, 246, 0.2);
    border-bottom: none;
}

/* First active row - no rounded top to match section header above */
.table-row.row-active:first-of-type,
.table-row.row-active.first-active {
    border-radius: 0;
}

/* Last active row before info banner */
.table-row.row-active.last-active {
    border-bottom: 1px solid rgba(59, 130, 246, 0.2);
}

/* Active row inline (when toggle is OFF - chronological order) */
.table-row.row-active-inline {
    background: rgb(248, 251, 255);
    border-top: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: 12px 12px 0 0;
    border-bottom: none;
}

/* Active position info inline (when toggle is OFF - appears after each active signal) */
.active-position-info-inline {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 12px 24px;
    background: rgb(231, 240, 254) !important;
    border: none;
    border-bottom: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: 0 0 12px 12px;
    margin-bottom: 20px;
    color: #3b82f6;
    font-size: 13px;
    font-weight: 600;
    position: relative;
}

/* Top separator removed - was cutting through side borders */

.active-position-info-inline::before {
    content: none;
}

/* Active position info banner */
.active-position-info {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 15px 24px;
    background: rgb(231, 240, 254) !important;
    border: none;
    border-bottom: 3px solid rgba(59, 130, 246, 0.4);
    border-radius: 0 0 12px 12px;
    margin-bottom: 20px;
    color: #3b82f6;
    font-size: 13px;
    font-weight: 600;
    position: relative;
}

/* Top separator removed - was cutting through side borders */

.active-position-info::before {
    content: none;
}

@keyframes pulse-scale {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.2);
    }
}

/* Placeholder when no active positions */
.no-active-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 24px;
    min-height: 80px;
    background: rgba(59, 130, 246, 0.12);
    border: 1px solid rgba(59, 130, 246, 0.2);
    border-radius: 12px;
    margin-bottom: 20px;
    color: #3b82f6;
    font-size: 15px;
    font-weight: 600;
    border-left: 3px solid rgba(59, 130, 246, 0.4);
    border-right: 3px solid rgba(59, 130, 246, 0.4);
}

.no-active-placeholder::before {
    content: '🔵';
    font-size: 16px;
    animation: pulse-scale 2s ease-in-out infinite;
}

/* Section Headers for Open/Closed Positions */
.section-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 24px;
    font-size: 15px;
    font-weight: 700;
    color: #1a1a1a;
    background: linear-gradient(135deg, rgba(160, 82, 45, 0.08) 0%, rgba(205, 133, 63, 0.04) 100%);
    border-bottom: 2px solid rgba(160, 82, 45, 0.2);
    margin-top: 8px;
}

.section-header.open-positions {
    background: rgb(235, 243, 254);
    border-top: 3px solid rgba(59, 130, 246, 0.4);
    border-bottom: none;
    color: #3b82f6;
    margin-top: 0;
    border-radius: 12px 12px 0 0;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 12px 20px 5px;
    gap: 1px;
}

/* Message when no open positions */
.no-positions-message {
    font-size: inherit;
    font-weight: inherit;
    color: inherit;
    padding: 12px 0 8px;
    text-align: center;
}

.section-header.closed-positions {
    background: linear-gradient(135deg, rgba(160, 82, 45, 0.08) 0%, rgba(205, 133, 63, 0.04) 100%);
    border-top: 3px solid rgba(160, 82, 45, 0.4);
    border-bottom: none;
    color: #92400e;
    margin-top: 32px;
    padding-top: 16px;
    border-radius: 12px 12px 0 0;
}

.section-header .section-icon {
    font-size: 18px;
}

.section-header .section-count {
    font-weight: 600;
    font-size: 13px;
    padding: 4px 10px;
    border-radius: 20px;
    margin-left: auto;
}

.section-header.open-positions .section-count {
    background: none;
    color: #3b82f6;
    padding: 0;
    margin-left: 0;
    font-size: inherit;
    font-weight: inherit;
}

.section-header.closed-positions .section-count {
    background: rgba(160, 82, 45, 0.15);
    color: #92400e;
}

/* Closed positions header with arrow below */
.section-header.closed-positions {
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 12px 24px 8px;
}

.section-header-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.section-header.open-positions .section-header-content {
    flex-direction: row;
    gap: 6px;
    justify-content: center;
    width: 100%;
}

.section-header.open-positions .arrow-down {
    color: #3b82f6;
}

/* Down arrow */
.section-header .arrow-down {
    font-size: 11px;
    font-weight: 700;
    color: #92400e;
}

@keyframes bounce-down {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(2px);
    }
}

@media (max-width: 768px) {
    .section-header {
        padding: 12px 16px;
        font-size: 14px;
    }

    .section-header .arrow-down {
        font-size: 16px;
    }
}

.cell-percentage {
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.cell-percentage.positive {
    color: #10b981;
}

.cell-percentage.negative {
    color: #ef4444;
}

/* No Results */
.no-results {
    text-align: center;
    padding: 80px 40px;
    background: linear-gradient(135deg, #ffffff 0%, #FFF9F0 100%);
    border: 1px solid rgba(160, 82, 45, 0.15);
    border-radius: 20px;
}

.no-results-icon {
    font-size: 64px;
    margin-bottom: 24px;
    opacity: 0.5;
}

.no-results-text {
    font-size: 18px;
    color: #5D4037;
    font-weight: 600;
}

/* Scrollbar Styling */
.table-body::-webkit-scrollbar {
    width: 8px;
}

.table-body::-webkit-scrollbar-track {
    background: rgba(160, 82, 45, 0.05);
}

.table-body::-webkit-scrollbar-thumb {
    background: rgba(160, 82, 45, 0.3);
    border-radius: 4px;
}

.table-body::-webkit-scrollbar-thumb:hover {
    background: rgba(160, 82, 45, 0.5);
}

/* Responsive Design */
@media (max-width: 1024px) {
    .table-header,
    .table-row {
        grid-template-columns: 35px 1fr 1fr 1.4fr 1.4fr 1fr 1fr 1fr 0.8fr 1fr;
        gap: 8px;
        padding: 16px 15px;
        font-size: 12px;
    }

    .summary-stats {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }

    .settings-bar {
        flex-direction: column;
        gap: 24px;
    }

    .settings-group {
        width: 100%;
    }

    .settings-input {
        width: 100%;
    }
}

@media (max-width: 768px) {
    .page-header h1 {
        font-size: 42px;
        letter-spacing: -2px;
    }

    .page-header p {
        font-size: 16px;
    }

    .filter-bar {
        padding: 24px;
    }

    .filter-btn {
        padding: 10px 8px;
        font-size: 13px;
        height: 38px;
        width: calc(50% - 6px);
        flex: 0 0 calc(50% - 6px);
    }

    .filter-buttons {
        justify-content: center;
    }

    .custom-date-range {
        flex-wrap: wrap;
        width: 100%;
        justify-content: center;
    }

    .custom-date-range .filter-date-picker {
        min-width: 120px;
        flex: 1;
        max-width: 140px;
    }

    .date-input-group {
        min-width: 0;
        flex: 0 0 auto;
        max-width: none;
        padding: 0 10px;
        height: 38px;
    }

    .date-part {
        font-size: 12px;
    }

    .date-part.day {
        width: 27px;
    }

    .date-part.month-name {
        width: 27px;
    }

    .date-part.year {
        width: 39px;
    }

    .date-sep {
        font-size: 12px;
    }

    .time-input {
        min-width: 80px;
        padding: 6px 8px;
        font-size: 13px;
    }

    .time-input-label {
        font-size: 10px;
    }

    .time-range-separator {
        font-size: 12px;
    }

    .flatpickr-calendar {
        position: fixed !important;
        top: 50% !important;
        left: 50% !important;
        right: auto !important;
        transform: translate(-50%, -50%) !important;
        max-width: 300px !important;
        width: calc(100vw - 32px) !important;
        font-size: 13px;
        z-index: 99999 !important;
    }

    .flatpickr-calendar.arrowTop::before,
    .flatpickr-calendar.arrowTop::after,
    .flatpickr-calendar.arrowBottom::before,
    .flatpickr-calendar.arrowBottom::after {
        display: none !important;
    }

    .summary-stats {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .results-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
        margin-bottom: 20px;
    }

    .results-header h2 {
        font-size: 28px;
    }

    .results-header-right {
        width: 100%;
        align-items: stretch;
    }

    .results-controls-row {
        flex-direction: column-reverse;
        align-items: stretch;
        gap: 26px;
    }

    body.statistics-mode .results-controls-row {
        margin-top: 23px; /* 31px - 25% = 23px for mobile */
    }

    .view-toggle-container {
        width: 100%;
        justify-content: center;
    }

    .active-toggle-container {
        width: 100%;
        min-width: 0;
        justify-content: space-between;
    }

    .sort-controls {
        width: 100%;
        min-width: 0;
        justify-content: space-between;
        box-sizing: border-box;
    }

    .toggle-tooltip {
        right: auto;
        left: 0;
        white-space: normal;
        max-width: 280px;
    }

    .toggle-tooltip::before {
        right: auto;
        left: 20px;
    }

    /* Switch to card layout on mobile */
    .results-table {
        overflow-x: visible !important;
        overflow-y: visible !important;
        width: 100% !important;
        border: none !important;
        background: transparent !important;
    }

    .table-body {
        width: 100% !important;
        overflow-x: visible !important;
        border: none !important;
        background: transparent !important;
    }

    .table-header {
        display: none;
    }

    .table-row {
        display: block;
        padding: 24px;
        border-radius: 16px;
        margin-bottom: 12px;
        background: white;
        border-left: none !important;
        border-top: none !important;
        border-bottom: none !important;
        min-width: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        overflow: visible !important;
    }

    /* Override active row styling on mobile - separate cards */
    .table-row.row-active,
    .table-row.row-active-inline {
        background: rgba(59, 130, 246, 0.05) !important;
        border: 1px solid rgba(59, 130, 246, 0.5) !important;
        margin-bottom: 12px !important;
        border-radius: 16px !important;
    }

    .table-row.row-active.first-active {
        border-radius: 16px !important;
        margin-top: 0 !important;
    }

    /* Last active - connects to info banner below */
    .table-row.row-active.last-active {
        border-radius: 16px 16px 0 0 !important;
        margin-bottom: 0 !important;
        border-bottom: none !important;
    }

    .table-row.row-active-inline {
        border-radius: 16px 16px 0 0 !important;
        margin-bottom: 0 !important;
        border-bottom: none !important;
    }

    /* Closed positions on mobile - separate cards */
    .table-row:not(.row-active):not(.row-active-inline) {
        border: 1px solid rgba(160, 82, 45, 0.25) !important;
        margin-bottom: 12px !important;
        border-radius: 16px !important;
    }

    /* Open Positions header - separate card on mobile */
    .section-header.open-positions {
        border: 1px solid rgba(59, 130, 246, 0.5) !important;
        border-radius: 16px !important;
        margin-bottom: 12px !important;
    }

    /* Info banner - connects to active row above */
    .active-position-info,
    .active-position-info-inline {
        border: 1px solid rgba(59, 130, 246, 0.5) !important;
        border-top: none !important;
        border-radius: 0 0 16px 16px !important;
        margin-top: 0 !important;
        text-align: center !important;
        flex-wrap: wrap !important;
    }

    /* Closed Positions header - separate card on mobile */
    .section-header.closed-positions {
        border: 1px solid rgba(160, 82, 45, 0.25) !important;
        border-radius: 16px !important;
        margin-bottom: 12px !important;
        margin-top: 12px !important;
    }

    .table-cell {
        display: flex !important;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 12px;
        padding: 8px 0;
        border-bottom: 1px solid rgba(160, 82, 45, 0.1);
        color: #5D4037;
        font-size: 14px;
        font-weight: 600;
        line-height: 1.4;
    }

    .table-cell:last-child {
        border-bottom: none;
    }

    .table-cell::before {
        content: attr(data-label);
        font-size: 12px;
        font-weight: 800;
        color: #5D4037;
        text-transform: uppercase;
        letter-spacing: 1px;
        white-space: nowrap;
        flex: 0 0 140px;
        text-align: left;
    }

    /* All cell content aligns to the right */
    .table-cell > * {
        text-align: right;
        margin-left: auto;
    }

    /* Ensure badges and spans are properly aligned */
    .cell-status,
    .cell-result,
    .cell-direction {
        margin-left: auto !important;
        text-align: right !important;
    }

    /* Plain text dashes should align right without badge styling */
    .table-cell .cell-result:not(.result-win):not(.result-loss) {
        background: none !important;
        border: none !important;
        padding: 0 !important;
        min-width: 0 !important;
        font-size: 14px !important;
        font-weight: 600 !important;
    }
}

/* ========== PAGINATION STYLES ========== */

#paginationControls {
    margin-top: 30px;
    margin-bottom: 30px;
}

.pagination-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.pagination-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 10px 16px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.3s ease;
    min-width: 44px;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.pagination-btn.pagination-nav {
    min-width: 100px;
}

.pagination-btn:hover:not(.disabled) {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.pagination-btn.active {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    box-shadow: 0 4px 12px rgba(245, 87, 108, 0.4);
}

.pagination-btn.disabled {
    background: #ccc;
    cursor: not-allowed;
    box-shadow: none;
    opacity: 0.5;
}

.pagination-ellipsis {
    color: var(--text-color, #888);
    padding: 10px 8px;
    font-weight: 600;
}

/* Pagination Mobile Responsive */
@media (max-width: 768px) {
    .pagination-wrapper {
        gap: 6px;
    }

    .pagination-btn {
        padding: 8px 12px;
        font-size: 13px;
        min-width: 38px;
    }

    .pagination-btn.pagination-nav {
        min-width: 70px;
        padding: 8px 10px;
    }

    .pagination-ellipsis {
        padding: 8px 4px;
        font-size: 13px;
    }
}

@media (max-width: 480px) {
    .pagination-btn.pagination-nav {
        min-width: 44px;
        padding: 8px 12px;
        font-size: 16px;
    }
}

/* Loading Indicator */
.loading-indicator {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    font-size: 16px;
    color: #A0522D;
    font-weight: 500;
}

.loading-indicator::before {
    content: '';
    width: 20px;
    height: 20px;
    border: 2px solid rgba(160, 82, 45, 0.2);
    border-top-color: #A0522D;
    border-radius: 50%;
    margin-right: 12px;
    animation: spin 0.8s linear infinite;
}

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

/* Stats Loading Animation */
.stat-loading {
    display: inline-block;
    background: linear-gradient(135deg, #A0522D 0%, #CD853F 50%, #DAA520 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: pulse 1.2s ease-in-out infinite;
}

.stat-loading .loading-text {
    font-size: 16px;
    font-weight: 500;
    margin-right: 2px;
}

.summary-value.win .stat-loading {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.summary-value.loss .stat-loading {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

@keyframes pulse {
    0%, 100% {
        opacity: 0.4;
    }
    50% {
        opacity: 1;
    }
}

/* ============================================
   VIEW TOGGLE (Signals / Statistics)
   ============================================ */
.view-toggle-container {
    display: flex;
    gap: 8px;
    padding: 6px;
    background: rgba(160, 82, 45, 0.08);
    border-radius: 12px;
    width: fit-content;
}

.view-toggle-btn {
    padding: 10px 24px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    background: transparent;
    color: #8B7355;
}

.view-toggle-btn:hover {
    background: rgba(160, 82, 45, 0.1);
}

.view-toggle-btn.active {
    background: linear-gradient(135deg, #A0522D 0%, #CD853F 50%, #DAA520 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(160, 82, 45, 0.3);
}

/* ============================================
   STATISTICS VIEW
   ============================================ */

/* Increase gap between Trading History and toggle in statistics mode (40% more) */
body.statistics-mode .results-header {
    margin-bottom: 40px;
}

body.statistics-mode .results-controls-row {
    margin-top: 41px; /* 34px + 20% = 41px - gap between Trading History and toggle */
}

@media (max-width: 768px) {
    body.statistics-mode .results-controls-row {
        margin-top: 23px !important; /* Reduced for mobile */
    }
    body.statistics-mode .statistics-section {
        margin-top: -60px !important; /* -50px - 20% = -60px for mobile */
    }
}

body.statistics-mode .statistics-section {
    margin-top: -50px; /* Reduced by extra 25% */
}

.statistics-section {
    margin-top: 20px;
}

.statistics-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
}

@media (max-width: 768px) {
    .statistics-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }
}

.stats-column {
    background: rgba(255, 255, 255, 0.9);
    border-radius: 16px;
    padding: 20px;
    border: 1px solid rgba(160, 82, 45, 0.1);
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
}

.stats-column-title {
    font-size: 16px;
    font-weight: 700;
    color: #5D4037;
    margin: 0 0 16px 0;
    padding-bottom: 12px;
    border-bottom: 2px solid rgba(160, 82, 45, 0.15);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-align: center;
}

.stats-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: 500px;
    overflow-y: auto;
}

/* Individual stat card */
.stat-period-card {
    display: flex;
    flex-direction: column;
    padding: 14px 16px;
    background: rgba(160, 82, 45, 0.04);
    border-radius: 10px;
    border: 1px solid rgba(160, 82, 45, 0.08);
    transition: all 0.2s ease;
}

.period-top-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    gap: 12px;
}

/* Expand chevron indicator */
.expand-chevron {
    font-size: 13px;
    color: #A0522D;
    opacity: 0.5;
    transition: transform 0.3s ease, opacity 0.3s ease;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.expand-chevron span {
    line-height: 0.8;
    display: block;
}

.stat-period-card:hover .expand-chevron {
    opacity: 1;
}

.stat-period-card.expanded .expand-chevron {
    display: none;
}

.stat-period-card.current-period .expand-chevron {
    color: #3b82f6;
}

.stat-period-card.current-period:hover .expand-chevron {
    opacity: 1;
}

.stat-period-card:hover {
    background: rgba(160, 82, 45, 0.08);
}

/* Current/Active period (blue styling) */
.stat-period-card.current-period {
    background: rgba(59, 130, 246, 0.12);
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-left: 3px solid rgba(59, 130, 246, 0.7);
}

.stat-period-card.current-period:hover {
    background: rgba(59, 130, 246, 0.12);
}

.stat-period-card.current-period .period-label {
    color: #3b82f6;
}

/* Period info section */
.period-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.period-label {
    font-size: 14px;
    font-weight: 700;
    color: #5D4037;
}

/* Hide mobile line breaks on desktop, show desktop comma */
.period-label .mobile-break {
    display: none;
}

.period-label .desktop-comma {
    display: inline;
}

@media (max-width: 768px) {
    .period-label .mobile-break {
        display: inline;
    }
    .period-label .desktop-comma {
        display: none;
    }
}

.period-dates {
    font-size: 11px;
    color: #8B7355;
}

/* Period stats section */
.period-stats {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}

.period-performance {
    font-size: 15px;
    font-weight: 800;
}

.period-performance.positive {
    color: #10b981;
}

.period-performance.negative {
    color: #ef4444;
}

.period-performance.neutral {
    color: #8B7355;
}

.period-record {
    font-size: 11px;
    color: #8B7355;
    font-weight: 500;
}

.period-record .wins {
    color: #10b981;
    font-weight: 600;
}

.period-record .losses {
    color: #ef4444;
    font-weight: 600;
}

.period-record .open {
    color: #3b82f6;
    font-weight: 600;
}

/* Win rate badge */
.period-winrate {
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
    margin-top: 4px;
}

.period-winrate.high {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
}

.period-winrate.medium {
    background: rgba(245, 158, 11, 0.15);
    color: #f59e0b;
}

.period-winrate.low {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

/* No data message */
.stats-no-data {
    text-align: center;
    padding: 40px 20px;
    color: #8B7355;
    font-size: 14px;
}

/* Loading state for statistics */
.stats-loading {
    text-align: center;
    padding: 40px 20px;
    color: #A0522D;
    font-size: 14px;
    font-weight: 500;
    animation: statsPulse 1.5s ease-in-out infinite;
}

@keyframes statsPulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

/* Expandable period card styles */
.stat-period-card {
    cursor: pointer;
}

.period-header {
    flex: 1;
}

.period-expand-icon {
    font-size: 10px;
    color: #8B7355;
    transition: transform 0.2s ease;
}

/* Last viewed card styling (persists after modal closes) */
.stat-period-card.last-viewed:not(.expanded):not(.current-period) {
    background: rgba(217, 119, 6, 0.12);
    border: 2px solid rgba(217, 119, 6, 0.4);
    box-shadow: 0 2px 8px rgba(217, 119, 6, 0.15);
    position: relative;
}

.stat-period-card.last-viewed:not(.expanded):not(.current-period) .period-label {
    color: #b45309;
    font-weight: 700;
}

.stat-period-card.last-viewed:not(.expanded):not(.current-period)::after {
    content: 'Just Viewed Details';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(217, 119, 6, 0.9);
    color: white;
    font-size: 9px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 4px 10px;
    border-radius: 12px;
    white-space: nowrap;
}

.stat-period-card.expanded:not(.current-period) {
    background: rgba(245, 158, 11, 0.07);
    border: 1px solid rgba(245, 158, 11, 0.18);
    border-left: 3px solid rgba(245, 158, 11, 0.45);
}

.stat-period-card.expanded:not(.current-period) .period-label {
    color: #d97706;
}

.stat-period-card.expanded .period-expand-icon {
    color: #d97706;
}

/* Modal animation keyframes */
@keyframes modalFadeIn {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.9);
    }
    100% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

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

/* Expanded card becomes centered modal */
.stat-period-card.expanded {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 75%;
    max-width: 900px;
    height: 90vh;
    max-height: 95vh;
    overflow-y: auto;
    z-index: 1001;
    box-shadow: 0 25px 60px rgba(0, 0, 0, 0.4);
    border-radius: 16px;
    background: #ffffff !important;
    border: 2px solid rgba(160, 82, 45, 0.3) !important;
    padding: 20px !important;
    animation: modalFadeIn 0.3s ease-out forwards;
}

/* Override the transparent backgrounds when expanded */
.stat-period-card.expanded:not(.current-period) {
    background: #ffffff !important;
}

.stat-period-card.expanded.current-period {
    background: #ffffff !important;
}

/* Modal navigation arrows */
.modal-nav-arrow {
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 48px;
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid rgba(120, 120, 120, 0.25);
    border-radius: 50%;
    cursor: pointer;
    z-index: 1002;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: #555;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
}

.modal-nav-arrow:hover {
    background: rgba(255, 255, 255, 0.98);
    color: #333;
    border-color: rgba(100, 100, 100, 0.4);
    transform: translateY(-50%) scale(1.08);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
}

.modal-nav-arrow.disabled {
    opacity: 0.25;
    cursor: not-allowed;
    pointer-events: none;
}

.modal-nav-arrow.prev {
    left: calc(50% - 560px);
}

.modal-nav-arrow.next {
    right: calc(50% - 560px);
}

@media (max-width: 1280px) {
    .modal-nav-arrow.prev {
        left: 20px;
    }
    .modal-nav-arrow.next {
        right: 20px;
    }
}

@media (max-width: 768px) {
    .stat-period-card.expanded {
        width: 100%;
        height: 100dvh;
        height: 100vh; /* fallback */
        max-height: 100dvh;
        max-height: 100vh; /* fallback */
        top: 0;
        left: 0;
        transform: none;
        padding: 15px !important;
        padding-top: 50px !important;
        border-radius: 0;
        animation: none;
    }

    .modal-nav-arrow {
        display: none !important;
    }
}

/* Mobile modal controls */
.mobile-modal-controls {
    display: none;
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 1003;
    gap: 8px;
}

.mobile-modal-btn {
    width: 36px;
    height: 36px;
    background: rgba(100, 100, 100, 0.3);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 14px;
    font-weight: 300;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s ease;
    line-height: 1;
    padding: 0;
}

.mobile-modal-btn.nav-btn {
    font-size: 12px;
}

.mobile-modal-btn .arrow {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-right: 2px solid white;
    border-bottom: 2px solid white;
}

.mobile-modal-btn .arrow.left {
    transform: rotate(135deg);
    margin-left: 2px;
}

.mobile-modal-btn .arrow.right {
    transform: rotate(-45deg);
    margin-right: 2px;
}

.mobile-modal-btn:hover {
    background: rgba(80, 80, 80, 0.45);
}

.mobile-modal-btn.disabled {
    opacity: 0.3;
    pointer-events: none;
}

@media (max-width: 768px) {
    .mobile-modal-controls {
        display: flex;
    }
}

/* Overlay behind expanded card */
.stats-column::before {
    content: '';
    display: none;
}

.stats-column:has(.stat-period-card.expanded)::before {
    content: '';
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(30, 30, 30, 0.75);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 1000;
    animation: backdropFadeIn 0.4s ease-out forwards;
}

/* Hide navbar and prevent scroll when modal is open */
body.modal-open {
    overflow: hidden !important;
    position: fixed;
    width: 100%;
    height: 100%;
}

body.modal-open .navbar {
    display: none !important;
}

/* Ensure scrolling works inside expanded modal */
.stat-period-card.expanded {
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y pinch-zoom;
    overscroll-behavior: contain;
}

/* Expanded signals list */
.period-signals-list {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(160, 82, 45, 0.15);
    width: 100%;
    /* Force GPU compositing layer to fix Safari paint bug */
    -webkit-transform: translateZ(0);
    transform: translateZ(0);
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

.period-signals-table {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.period-signal-row {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    padding: 8px 10px;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 6px;
    font-size: 12px;
    flex-wrap: nowrap;
}

.period-signal-row .signal-count {
    font-weight: 600;
    font-size: 11px;
    color: #8B7355;
    min-width: 20px;
}

.period-signal-row .signal-pair {
    font-weight: 600;
    color: #3E2723;
    min-width: 70px;
}

.period-signal-row .signal-pair.result-open {
    background: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
    border: 1px solid rgba(59, 130, 246, 0.3);
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.period-signal-row .signal-direction {
    font-weight: 600;
    font-size: 11px;
    color: #5C4D3C;
}

.period-signal-row .signal-datetime {
    color: #8B7355;
    font-size: 11px;
    flex: 1;
    min-width: 130px;
}

.period-signal-row .signal-result {
    font-weight: 600;
    font-size: 11px;
    padding: 2px 0;
    border-radius: 4px;
    width: 36px;
    text-align: center;
    flex-shrink: 0;
    display: inline-flex;
    justify-content: center;
    align-items: center;
}

.period-signal-row .signal-result.result-win {
    background: rgba(16, 185, 129, 0.15);
    color: #059669;
    border: 1px solid rgba(16, 185, 129, 0.3);
    border-radius: 999px !important;
    padding: 2px 24px;
}

.period-signal-row .signal-result.result-win::before {
    content: none;
}

.period-signal-row .signal-result.result-loss {
    background: rgba(239, 68, 68, 0.15);
    color: #dc2626;
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: 999px !important;
    padding: 2px 24px;
}

.period-signal-row .signal-result.result-loss::before {
    content: none;
}

.period-signal-row .signal-percentage {
    font-weight: 600;
    font-size: 11px;
    min-width: 90px;
    text-align: left;
    flex-shrink: 0;
    padding-left: 10px;
}

.period-signal-row .signal-percentage.positive {
    color: #059669;
}

.period-signal-row .signal-percentage.negative {
    color: #dc2626;
}

.period-signal-row .signal-result.result-open {
    background: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
    border: 1px solid rgba(59, 130, 246, 0.3);
    animation: pulse-glow 2s ease-in-out infinite;
}

.period-signal-row .signal-result.result-open-static {
    background: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: 999px !important;
    padding: 2px 24px;
}

.period-signal-row .signal-percentage.open {
    color: #3b82f6;
}

/* Entry/TP/SL prices - desktop shows as separate columns */
.period-signal-row .signal-entry,
.period-signal-row .signal-tp,
.period-signal-row .signal-sl {
    font-size: 10px;
    color: #8B7355;
}

/* Hide result text on desktop - only show on mobile */
.period-signal-row .signal-result-text {
    display: none;
}

/* Entry datetime - show on desktop after exit datetime */
.period-signal-row .signal-datetime-entry {
    font-size: 11px;
    color: #8B7355;
}

/* Desktop: Make prices-row wrapper invisible to layout */
.period-signal-row .signal-prices-row {
    display: contents;
}

.period-signal-row.open-row {
    background: rgba(59, 130, 246, 0.12);
    border-left: 2px solid #3b82f6;
    margin-bottom: 6px;
}

.period-signal-row.closed-row {
    background: rgba(160, 82, 45, 0.08);
    border-left: 2px solid rgba(160, 82, 45, 0.4);
    margin-bottom: 6px;
}

/* Desktop: Flexbox with auto-wrap - stays on one line if fits, wraps if not */
.period-signal-row.closed-row,
.period-signal-row.open-row {
    display: flex !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    gap: 6px !important;
    width: 100% !important;
}

/* All elements use auto width, don't shrink, and center content */
.period-signal-row .signal-count,
.period-signal-row .signal-pair,
.period-signal-row .signal-direction,
.period-signal-row .signal-datetime,
.period-signal-row .signal-entry,
.period-signal-row .signal-tp,
.period-signal-row .signal-sl,
.period-signal-row .signal-result,
.period-signal-row .signal-percentage {
    flex-shrink: 0 !important;
    white-space: nowrap !important;
    text-align: center !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
}


/* Hide entry datetime on desktop */
.period-signal-row .signal-datetime-entry {
    display: none !important;
}

/* ========== FORCE MOBILE LAYOUT (when content overflows) ========== */
/* Applied via JavaScript when row content doesn't fit in container */

/* Force mobile layout for closed rows */
.period-signal-row.closed-row.force-mobile {
    display: grid !important;
    grid-template-columns: 1fr auto 1.5fr auto auto auto !important;
    grid-template-rows: auto auto auto !important;
    gap: 0 6px !important;
    width: 100% !important;
}

.period-signal-row.closed-row.force-mobile .signal-count {
    grid-column: 1;
    grid-row: 1;
    min-width: auto !important;
    padding: 0 !important;
    margin: 0 !important;
    text-align: center !important;
}

.period-signal-row.closed-row.force-mobile .signal-pair {
    grid-column: 2;
    grid-row: 1;
    min-width: auto !important;
    margin: 0 !important;
    padding: 4px 6px !important;
    text-align: center !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
}

.period-signal-row.closed-row.force-mobile .signal-direction {
    grid-column: 3;
    grid-row: 1;
    text-align: center !important;
}

.period-signal-row.closed-row.force-mobile .signal-datetime {
    grid-column: 4;
    grid-row: 1;
    text-align: center !important;
    white-space: nowrap !important;
}

.period-signal-row.closed-row.force-mobile .signal-result {
    display: none !important;
}

.period-signal-row.closed-row.force-mobile .signal-percentage {
    grid-column: 6;
    grid-row: 1;
    text-align: right !important;
    white-space: nowrap !important;
}

/* Dashed line separator for force-mobile closed rows */
.period-signal-row.closed-row.force-mobile::after {
    content: '';
    grid-column: 1 / -1;
    grid-row: 2;
    height: 1px;
    border-top: 1px dashed rgba(160, 82, 45, 0.35);
    margin: 8px 0;
}

/* Prices row for force-mobile closed rows */
.period-signal-row.closed-row.force-mobile .signal-prices-row {
    grid-column: 1 / -1;
    grid-row: 3;
    display: flex !important;
    gap: 10px !important;
}

.period-signal-row.closed-row.force-mobile .signal-entry,
.period-signal-row.closed-row.force-mobile .signal-tp,
.period-signal-row.closed-row.force-mobile .signal-sl {
    white-space: nowrap !important;
}

/* Result text for force-mobile closed rows */
.period-signal-row.closed-row.force-mobile .signal-result-text {
    display: inline !important;
    margin-left: auto !important;
    padding-right: 5px !important;
    background: none !important;
    border: none !important;
    font-weight: 600 !important;
    white-space: nowrap !important;
}

.period-signal-row.closed-row.force-mobile .signal-result-text.result-tp {
    color: #22c55e !important;
}

.period-signal-row.closed-row.force-mobile .signal-result-text.result-sl {
    color: #ef4444 !important;
}

/* Force mobile layout for open rows - same structure as closed rows */
.period-signal-row.open-row.force-mobile {
    display: grid !important;
    grid-template-columns: 1fr auto 1.5fr auto auto auto !important;
    grid-template-rows: auto auto auto !important;
    gap: 0 6px !important;
    width: 100% !important;
}

.period-signal-row.open-row.force-mobile .signal-count {
    grid-column: 1;
    grid-row: 1;
    min-width: auto !important;
    padding: 0 !important;
    margin: 0 !important;
    text-align: center !important;
}

.period-signal-row.open-row.force-mobile .signal-pair {
    grid-column: 2;
    grid-row: 1;
    min-width: auto !important;
    margin: 0 !important;
    padding: 4px 6px !important;
    text-align: center !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
}

.period-signal-row.open-row.force-mobile .signal-direction {
    grid-column: 3;
    grid-row: 1;
    text-align: center !important;
}

.period-signal-row.open-row.force-mobile .signal-datetime {
    grid-column: 4;
    grid-row: 1;
    text-align: center !important;
    white-space: nowrap !important;
}

.period-signal-row.open-row.force-mobile .signal-result {
    display: none !important;
}

.period-signal-row.open-row.force-mobile .signal-percentage {
    grid-column: 6;
    grid-row: 1;
    text-align: right !important;
    white-space: nowrap !important;
}

/* Dashed line separator for force-mobile open rows */
.period-signal-row.open-row.force-mobile::after {
    content: '';
    grid-column: 1 / -1;
    grid-row: 2;
    height: 1px;
    border-top: 1px dashed rgba(59, 130, 246, 0.35);
    margin: 8px 0;
}

/* Prices row for force-mobile open rows */
.period-signal-row.open-row.force-mobile .signal-prices-row {
    grid-column: 1 / -1;
    grid-row: 3;
    display: flex !important;
    gap: 10px !important;
}

.period-signal-row.open-row.force-mobile .signal-entry,
.period-signal-row.open-row.force-mobile .signal-tp,
.period-signal-row.open-row.force-mobile .signal-sl {
    white-space: nowrap !important;
}

/* First open row after header needs spacing */
.section-header.open-header + .period-signal-row.open-row,
.period-signals-table > .period-signal-row.open-row:first-child {
    margin-top: 8px;
}

/* Section headers for expanded signals */
.section-header {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 12px 14px;
    margin: 0;
    border-radius: 20px;
    display: block;
    text-align: center;
    width: 100%;
    box-sizing: border-box;
}

.section-header.open-header {
    color: #3b82f6;
    background: rgba(59, 130, 246, 0.12);
    border: 1px solid rgba(59, 130, 246, 0.4);
    margin-top: 0;
    margin-bottom: 8px;
}

.section-header.closed-header {
    color: #8B7355;
    background: rgba(160, 82, 45, 0.06);
    border: 1px solid rgba(160, 82, 45, 0.12);
    margin-top: 12px;
    margin-bottom: 8px;
}

.no-signals-message {
    text-align: center;
    padding: 15px;
    color: #8B7355;
    font-size: 12px;
    font-style: italic;
}

/* Mobile responsive for expanded signals */
@media (max-width: 768px) {
    .period-signal-row {
        flex-wrap: wrap;
        gap: 4px 8px;
    }

    .period-signal-row .signal-count {
        min-width: 18px;
    }

    .period-signal-row .signal-pair {
        min-width: 60px;
    }

    .period-signal-row .signal-datetime {
        min-width: auto;
        flex: 0 0 auto;
    }

    .period-signal-row .signal-percentage {
        min-width: 40px;
        padding-left: 0;
    }

    /* Hide entry datetime on mobile - desktop only */
    .period-signal-row .signal-datetime-entry {
        display: none !important;
    }

    /* Mobile: Closed rows - Row 1: ID/Pair/Direction/DateTime/Result/Percentage, Row 2: dashed line, Row 3: Entry/TP/SL */
    .period-signal-row.closed-row {
        display: grid !important;
        grid-template-columns: 1fr auto 1.5fr auto auto auto !important;
        grid-template-rows: auto auto auto !important;
        gap: 0 6px !important;
        width: 100% !important;
    }

    .period-signal-row.closed-row .signal-count {
        grid-column: 1;
        grid-row: 1;
        min-width: auto !important;
        padding: 0 !important;
        margin: 0 !important;
        text-align: center !important;
    }

    .period-signal-row.closed-row .signal-pair {
        grid-column: 2;
        grid-row: 1;
        min-width: auto !important;
        margin: 0 !important;
        padding: 4px 6px !important;
        text-align: center !important;
        display: flex !important;
        justify-content: center !important;
        align-items: center !important;
    }

    .period-signal-row.closed-row .signal-direction {
        grid-column: 3;
        grid-row: 1;
        text-align: center !important;
    }

    .period-signal-row.closed-row .signal-datetime {
        grid-column: 4;
        grid-row: 1;
        text-align: center !important;
        white-space: nowrap !important;
    }

    .period-signal-row.closed-row .signal-result {
        display: none !important;
    }

    .period-signal-row.closed-row .signal-percentage {
        grid-column: 6;
        grid-row: 1;
        text-align: right !important;
        white-space: nowrap !important;
    }

    /* Row 2: Dashed line separator spanning all columns */
    .period-signal-row.closed-row::after {
        content: '';
        grid-column: 1 / -1;
        grid-row: 2;
        height: 1px;
        border-top: 1px dashed rgba(160, 82, 45, 0.35);
        margin: 8px 0;
    }

    /* Row 3: Flex container for Entry, TP, SL */
    .period-signal-row.closed-row .signal-prices-row {
        grid-column: 1 / -1;
        grid-row: 3;
        display: flex !important;
        gap: 10px !important;
    }

    .period-signal-row.closed-row .signal-entry,
    .period-signal-row.closed-row .signal-tp,
    .period-signal-row.closed-row .signal-sl {
        white-space: nowrap !important;
    }

    /* Row 3: Result text (TP HIT / SL HIT) on right side */
    .period-signal-row.closed-row .signal-result-text {
        display: inline !important;
        margin-left: auto !important;
        padding-right: 5px !important;
        background: none !important;
        border: none !important;
        font-weight: 600 !important;
        white-space: nowrap !important;
    }

    .period-signal-row.closed-row .signal-result-text.result-tp {
        color: #22c55e !important;
    }

    .period-signal-row.closed-row .signal-result-text.result-sl {
        color: #ef4444 !important;
    }

    /* Mobile: Open rows - Row 1: columns, Row 2: dashed line, Row 3: Entry/TP/SL */
    /* Mobile: Open rows - same structure as closed rows */
    .period-signal-row.open-row {
        display: grid !important;
        grid-template-columns: 1fr auto 1.5fr auto auto auto !important;
        grid-template-rows: auto auto auto !important;
        gap: 0 6px !important;
        width: 100% !important;
    }

    .period-signal-row.open-row .signal-count {
        grid-column: 1;
        grid-row: 1;
        min-width: auto !important;
        padding: 0 !important;
        margin: 0 !important;
        text-align: center !important;
    }

    .period-signal-row.open-row .signal-pair {
        grid-column: 2;
        grid-row: 1;
        min-width: auto !important;
        margin: 0 !important;
        padding: 4px 6px !important;
        text-align: center !important;
        display: flex !important;
        justify-content: center !important;
        align-items: center !important;
    }

    .period-signal-row.open-row .signal-direction {
        grid-column: 3;
        grid-row: 1;
        text-align: center !important;
    }

    .period-signal-row.open-row .signal-datetime {
        grid-column: 4;
        grid-row: 1;
        text-align: center !important;
        white-space: nowrap !important;
    }

    .period-signal-row.open-row .signal-result {
        display: none !important;
    }

    .period-signal-row.open-row .signal-percentage {
        grid-column: 6;
        grid-row: 1;
        text-align: right !important;
        white-space: nowrap !important;
    }

    /* Row 2: Dashed line separator spanning all columns */
    .period-signal-row.open-row::after {
        content: '';
        grid-column: 1 / -1;
        grid-row: 2;
        height: 1px;
        border-top: 1px dashed rgba(59, 130, 246, 0.35);
        margin: 8px 0;
    }

    /* Row 3: Flex container for Entry, TP, SL */
    .period-signal-row.open-row .signal-prices-row {
        grid-column: 1 / -1;
        grid-row: 3;
        display: flex !important;
        gap: 10px !important;
    }

    .period-signal-row.open-row .signal-entry,
    .period-signal-row.open-row .signal-tp,
    .period-signal-row.open-row .signal-sl {
        white-space: nowrap !important;
    }
}

/* Compact footer for trade history page */
.footer {
    padding: 30px 40px !important;
    margin-top: 360px !important;
}

.footer-logo {
    font-size: 22px !important;
    margin-bottom: 10px !important;
}

.footer-text {
    font-size: 13px !important;
    line-height: 1.5 !important;
}

@media (max-width: 768px) {
    .footer {
        padding: 24px 20px !important;
        margin-top: 240px !important;
    }

    .footer-logo {
        font-size: 20px !important;
        margin-bottom: 8px !important;
    }

    .footer-text {
        font-size: 12px !important;
    }
}

/* ============================================
   DESKTOP EXPANDABLE OVERRIDE - MUST BE LAST
   ============================================ */
@media (min-width: 769px) {
    .period-signal-row.closed-row {
        display: grid !important;
        grid-template-columns: 30px 70px 45px 150px 1fr 1fr 1fr 50px 90px !important;
        align-items: center !important;
        gap: 8px !important;
    }

    .period-signal-row.closed-row > * {
        text-align: left !important;
    }

    .period-signal-row.closed-row .signal-entry,
    .period-signal-row.closed-row .signal-tp,
    .period-signal-row.closed-row .signal-sl {
        border-top: none !important;
        padding-top: 0 !important;
        margin-top: 0 !important;
    }

    /* Active/Open rows - same grid structure as closed */
    .period-signal-row.open-row {
        display: grid !important;
        grid-template-columns: 30px 70px 45px 150px 1fr 1fr 1fr 50px 90px !important;
        align-items: center !important;
        gap: 8px !important;
    }

    .period-signal-row.open-row > * {
        text-align: left !important;
    }

    .period-signal-row.open-row .signal-entry,
    .period-signal-row.open-row .signal-tp,
    .period-signal-row.open-row .signal-sl {
        border-top: none !important;
        padding-top: 0 !important;
        margin-top: 0 !important;
    }
}
