/*
 * SH-WEB-T34 - Preview UI Phase 1: Spacing Tokens + Density Modes + Unified Scrollbars
 * 
 * DESIGN TOKENS (Single Source of Truth):
 * - Spacing: --card-padding, --card-gap, --panel-header-gap, --item-gap, --details-padding, --details-margin
 * - Typography: --text-size-base, --text-size-title, --text-size-small, --line-height-base, --line-height-tight
 * 
 * DENSITY MODES:
 * - compact (default): Tighter spacing (12px padding, 10px gaps) + smaller font (14px base)
 * - comfortable: More spacing (16px padding, 12px gaps) + larger font (15px base)
 * - Applied via: body[data-density="compact"] or body[data-density="comfortable"]
 * - Legacy support: .density-compact and .density-comfy classes still work (mapped to same variables)
 * 
 * SCROLLBAR POLICY:
 * - Unified thin scrollbar style (8px width) on all scrollable containers
 * - Firefox: scrollbar-width: thin; scrollbar-color: rgba(255,255,255,0.2) transparent;
 * - WebKit: Custom 8px scrollbar with subtle alpha, hover slightly stronger
 * - All scrollable areas use: padding-right: 8px + scrollbar-gutter: stable (prevents content hidden)
 */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* Theme variables / canonical card system */
:root {
    --card-accent: rgba(73, 158, 255, 0.65);
    --card-bg: rgba(255,255,255,0.03);
    --card-border: 1px solid rgba(255,255,255,0.08);
    --card-radius: 10px;
    /* Legacy variable --card-pad mapped to --card-padding for backward compatibility */
    --card-pad: var(--card-padding);
    --card-gap: 10px;

    --card-hover-bg: rgba(255,255,255,0.045);
    --card-hover-border: 1px solid rgba(73, 158, 255, 0.22);
    --card-hover-glow: 0 0 0 1px rgba(73, 158, 255, 0.18), 0 10px 22px rgba(0,0,0,0.22);

    --focus-ring: 0 0 0 2px rgba(73, 158, 255, 0.45);
    
    /* SH-WEB-T70 - Phase 1: Design tokens for spacing, typography, and density */
    /* Default (comfortable) values */
    --card-padding: 16px;
    --card-gap: 12px;
    --panel-header-gap: 10px;
    --item-gap: 10px;
    --details-padding: 12px;
    --details-margin: 12px;
    
    /* Typography tokens (comfortable) */
    --text-size-base: 0.9375rem; /* 15px */
    --text-size-title: 1.15rem;
    --text-size-small: 0.85rem;
    --line-height-base: 1.5;
    --line-height-tight: 1.4;
    
    /* Layout spacing (comfortable) */
    --header-margin-bottom: 20px;
    --status-margin-bottom: 12px;
    --status-padding: 8px;
    --controls-margin-bottom: 14px;
    --controls-padding: 16px;
    --card-header-margin-bottom: 10px;
    --card-header-padding-bottom: 8px;
    --section-gap: 14px;
    
    /* SH-WEB-T?? - Dashboard row height ratio (adjustable) */
    --dash-top-fr: 50;
    --dash-bottom-fr: 50;
}

/* Override mechanism for card accents (prepared but not activated)
   Example usage if needed later:
   .ui-card[data-accent="green"] { --card-accent: rgba(0, 200, 120, 0.65); }
*/

html, body {
    overflow-x: hidden;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #1a1a1a;
    color: #e0e0e0;
    line-height: 1.6;
    padding: var(--card-padding);
}

/* SH-WEB-T70 - Compact density mode (default) */
body[data-density="compact"],
body:not([data-density]) {
    --card-padding: 12px;
    --card-pad: 12px;
    --card-gap: 10px;
    --panel-header-gap: 8px;
    --item-gap: 8px;
    --details-padding: 8px;
    --details-margin: 8px;
    
    /* Typography tokens (compact) */
    --text-size-base: 0.875rem; /* 14px */
    --text-size-title: 1.05rem;
    --text-size-small: 0.8rem;
    --line-height-base: 1.4;
    --line-height-tight: 1.35;
    
    /* Layout spacing (compact) */
    --header-margin-bottom: 16px;
    --status-margin-bottom: 8px;
    --status-padding: 6px;
    --controls-margin-bottom: 10px;
    --controls-padding: 12px;
    --card-header-margin-bottom: 6px;
    --card-header-padding-bottom: 6px;
    --section-gap: 10px;
}

/* SH-WEB-T70 - Comfortable density mode */
body[data-density="comfortable"] {
    --card-padding: 16px;
    --card-pad: 16px;
    --card-gap: 12px;
    --panel-header-gap: 10px;
    --item-gap: 10px;
    --details-padding: 12px;
    --details-margin: 12px;
    
    /* Typography tokens (comfortable) */
    --text-size-base: 0.9375rem; /* 15px */
    --text-size-title: 1.15rem;
    --text-size-small: 0.85rem;
    --line-height-base: 1.5;
    --line-height-tight: 1.4;
    
    /* Layout spacing (comfortable) */
    --header-margin-bottom: 20px;
    --status-margin-bottom: 12px;
    --status-padding: 8px;
    --controls-margin-bottom: 14px;
    --controls-padding: 16px;
    --card-header-margin-bottom: 10px;
    --card-header-padding-bottom: 8px;
    --section-gap: 14px;
}

.container {
    max-width: 1600px;
    margin: 0 auto;
    padding: 0 var(--card-padding) 32px var(--card-padding); /* Add bottom padding so overlay doesn't cover content */
    overflow-x: hidden;
}

header {
    margin-bottom: var(--header-margin-bottom);
    text-align: center;
}

header h1 {
    color: #4a9eff;
    font-size: 1.75rem;
    font-weight: 600;
    margin: 0;
}

.site-logo {
    color: #4a9eff;
    font-size: 1.8rem;
    font-weight: 600;
    margin: 0;
}

.sh-brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    line-height: 1;
    color: #4a9eff;
}

.sh-brand img {
    opacity: 1 !important;
    filter: none !important;
    mix-blend-mode: normal !important;
    display: block;
}

.sh-brand__mark {
    height: 32px;
    width: auto;
    max-height: 36px;
    display: block;
}

/* Default: assume dark UI */
.sh-brand__mark--light {
    display: none;
}

/* If user prefers light mode, swap */
@media (prefers-color-scheme: light) {
    .sh-brand__mark--dark {
        display: none;
    }

    .sh-brand__mark--light {
        display: block;
    }
}

/* SH-WEB-TXX: Force header logo to always use dark (white) version */
/* Header has dark background (#252525), so always use white logo regardless of system theme */
header .sh-brand__mark--dark {
    display: block !important;
}

header .sh-brand__mark--light {
    display: none !important;
}

.sh-brand:focus-visible {
    outline: 2px solid rgba(120, 170, 255, 0.9);
    outline-offset: 3px;
    border-radius: 6px;
}

.brand-link {
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    display: inline-block;
}

.brand-link:hover {
    filter: brightness(1.1);
}

.brand-link:focus-visible {
    outline: 2px solid rgba(80, 160, 255, 0.8);
    outline-offset: 4px;
    border-radius: 6px;
}

.controls {
    display: flex;
    gap: 16px;
    align-items: flex-end;
    margin-bottom: var(--controls-margin-bottom);
    flex-wrap: wrap;
    padding: var(--controls-padding);
    background: #252525;
    border-radius: 8px;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.control-group label {
    font-size: 0.9rem;
    color: #b0b0b0;
}

.control-group select,
.control-group input {
    padding: 8px 12px;
    background: #2a2a2a;
    border: 1px solid #3a3a3a;
    border-radius: 4px;
    color: #e0e0e0;
    font-size: 1rem;
    min-width: 150px;
}

.control-group input {
    min-width: 200px;
}

.control-group select:focus,
.control-group input:focus {
    outline: none;
    border-color: #4a9eff;
}

.control-group select:focus-visible,
.control-group input:focus-visible {
    outline: var(--focus-ring);
    outline-offset: 2px;
}

/* Intent thresholds controls - match filter selects styling */
#intent-thresholds-group select {
    font-size: 0.85rem;
    padding: 2px 6px;
    border: 1px solid #333;
    background: #1a1a1a;
    color: #fff;
    border-radius: 4px;
}

#intent-thresholds-group select:focus {
    outline: none;
    border-color: #4a9eff;
}

#intent-thresholds-group select:focus-visible {
    outline: var(--focus-ring);
    outline-offset: 2px;
}

#intent-thresholds-group select:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.preview-help-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
    margin-left: 4px;
    border-radius: 50%;
    border: 1px solid #c0c8ff;
    color: #c0c8ff;
    font-size: 10px;
    font-weight: 600;
    cursor: help;
    opacity: 0.75;
    line-height: 1;
}

.preview-help-icon:hover {
    opacity: 1;
}

.refresh-btn {
    padding: 10px 20px;
    background: #4a9eff;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.2s;
}

.refresh-btn:hover {
    background: #3a8eef;
}

.refresh-btn:active {
    background: #2a7edf;
}

.details-toggle-btn {
    padding: 10px 20px;
    background: #3a3a3a;
    color: #e0e0e0;
    border: 1px solid #4a4a4a;
    border-radius: 4px;
    font-size: 1rem;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.2s, border-color 0.2s;
    min-width: 100px;
}

.details-toggle-btn:hover {
    background: #4a4a4a;
    border-color: #4a9eff;
}

.details-toggle-btn.active {
    background: #4a9eff;
    color: white;
    border-color: #4a9eff;
}

.details-toggle-btn.active:hover {
    background: #3a8eef;
}

.details-toggle-btn:active {
    background: #2a7edf;
}

.view-controls {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.toggle-btn {
    padding: 10px 16px;
    background: #3a3a3a;
    color: #e0e0e0;
    border: 1px solid #4a4a4a;
    border-radius: 4px;
    font-size: 0.9rem;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.2s, border-color 0.2s;
    min-width: 80px;
}

.toggle-btn:hover {
    background: #4a4a4a;
    border-color: #4a9eff;
}

.toggle-btn--active,
.toggle-btn[aria-pressed="true"] {
    background: #4a9eff;
    color: white;
    border-color: #4a9eff;
}

.toggle-btn--active:hover,
.toggle-btn[aria-pressed="true"]:hover {
    background: #3a8eef;
}

.toggle-btn:active {
    background: #2a7edf;
}

.toggle-btn:focus-visible {
    outline: var(--focus-ring);
    outline-offset: 2px;
}

.profile-status {
    font-size: 12px;
    opacity: 0.85;
    margin-left: 6px;
    color: #b0b0b0;
    white-space: nowrap;
}

/* Profiles section refactor (T19) */
.profiles-details {
    width: 100%;
}

.profiles-summary {
    font-size: 0.9rem;
    color: #b0b0b0;
    cursor: pointer;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    list-style: none;
    user-select: none;
    transition: background 0.2s, border-color 0.2s;
}

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

.profiles-summary::before {
    content: '▶';
    display: inline-block;
    margin-right: 8px;
    transition: transform 0.2s;
    font-size: 0.7rem;
    color: #888;
}

.profiles-details[open] .profiles-summary::before {
    transform: rotate(90deg);
}

.profiles-summary:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(74, 158, 255, 0.3);
}

.profiles-summary:focus-visible {
    outline: var(--focus-ring);
    outline-offset: 2px;
}

.profiles-container {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    margin-top: 12px;
}

.profile-block {
    padding: var(--card-padding);
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.profile-block.profile-a {
    border-left: 3px solid rgba(74, 158, 255, 0.5);
}

.profile-block.profile-b {
    border-left: 3px solid rgba(180, 180, 180, 0.4);
}

.profiles-heading {
    font-size: 0.85rem;
    font-weight: 600;
    color: #b0b0b0;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
}

.profile-status-row {
    margin-bottom: 4px;
}

.profile-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.profile-action-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.profile-group-label {
    font-size: 0.75rem;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 2px;
}

.profile-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.profile-swap-row {
    display: flex;
    justify-content: center;
    padding: 8px 0;
}

.profile-swap-row .toggle-btn {
    min-width: 100px;
}

.profile-name-input {
    padding: 10px 12px;
    background: #2a2a2a;
    border: 1px solid #4a4a4a;
    border-radius: 4px;
    color: #e0e0e0;
    font-size: 0.9rem;
    min-width: 100px;
    max-width: 120px;
    transition: background 0.2s, border-color 0.2s;
}

.profile-name-input:hover {
    background: #323232;
    border-color: #5a5a5a;
}

.profile-name-input:focus {
    outline: none;
    border-color: #4a9eff;
    background: #323232;
}

.profile-name-input:focus-visible {
    outline: var(--focus-ring);
    outline-offset: 2px;
}

.profile-name-input:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* SH-WEB-T70 - Legacy class-based density support (backward compatibility) */
/* Note: data-density attribute takes precedence over classes if both are present */
.density-compact {
    --card-padding: 12px;
    /* Map legacy --card-pad to --card-padding for backward compatibility */
    --card-pad: var(--card-padding);
    --card-gap: 10px;
    --panel-header-gap: 8px;
    --item-gap: 8px;
    --details-padding: 8px;
    --details-margin: 8px;
    --text-size-base: 0.875rem;
    --text-size-title: 1.05rem;
    --line-height-base: 1.4;
    --line-height-tight: 1.35;
}

.density-comfy {
    --card-padding: 16px;
    /* Map legacy --card-pad to --card-padding for backward compatibility */
    --card-pad: var(--card-padding);
    --card-gap: 12px;
    --panel-header-gap: 10px;
    --item-gap: 10px;
    --details-padding: 12px;
    --details-margin: 12px;
    --text-size-base: 0.9375rem;
    --text-size-title: 1.15rem;
    --line-height-base: 1.5;
    --line-height-tight: 1.4;
}

/* SH-WEB-T70 - Density mode polish: tokens handle most spacing, but fine-tune specific elements */
body[data-density="compact"] .narrative-line,
body[data-density="compact"] .signal-detail-item,
body[data-density="compact"] .digest-item {
    font-size: var(--text-size-base);
    line-height: var(--line-height-base);
    margin: calc(var(--item-gap) * 0.5) 0;
}

body[data-density="compact"] .narrative {
    margin-top: calc(var(--item-gap) * 0.75);
}

body[data-density="compact"] .signal-item,
body[data-density="compact"] .whale-card,
body[data-density="compact"] .news-card,
body[data-density="compact"] .x-signal-card {
    margin-bottom: var(--item-gap);
}

body[data-density="compact"] .topmover-item {
    padding: calc(var(--item-gap) * 0.5) 0;
}

/* Comfortable density mode: more spacing */
body[data-density="comfortable"] .narrative-line,
body[data-density="comfortable"] .signal-detail-item,
body[data-density="comfortable"] .digest-item {
    font-size: var(--text-size-base);
    line-height: var(--line-height-base);
    margin: calc(var(--item-gap) * 0.6) 0;
}

body[data-density="comfortable"] .narrative {
    margin-top: var(--item-gap);
}

body[data-density="comfortable"] .signal-item,
body[data-density="comfortable"] .whale-card,
body[data-density="comfortable"] .news-card,
body[data-density="comfortable"] .x-signal-card {
    margin-bottom: var(--item-gap);
}

.beginner-summary {
    position: relative; /* SH-WEB-T30: Normal flow */
    margin: 10px 0;
    padding: 8px 0;
    color: #e0e0e0;
    font-size: 0.95rem;
    line-height: 1.5;
    z-index: 0; /* SH-WEB-T30: Normal stacking order */
    overflow-wrap: anywhere; /* SH-WEB-T30: Prevent text overflow */
}

.narrative {
    margin-top: 8px;
}

.narrative-line {
    opacity: 0.9;
    font-size: 13px;
    line-height: 1.35;
    margin: 4px 0;
}

.narrative-key {
    opacity: 0.7;
    font-weight: 600;
    margin-right: 6px;
}

/* Clamp narrative blocks to max 3 lines with ellipsis (beginner mode) */
.narrative-clamp {
    /* Container: ensures max 3 lines total */
    max-height: calc(1.35em * 3 + 8px); /* line-height * 3 lines + margins */
    overflow: hidden;
}

.narrative-clamp .narrative-line {
    /* Each line clamped to single line */
    display: -webkit-box;
    -webkit-line-clamp: 1;
    line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: normal;
    margin: 4px 0;
}

.details-block {
    position: relative; /* SH-WEB-T30: Normal flow, no overlap */
    margin: var(--details-margin) 0;
    padding: var(--details-padding);
    background: #2a2a2a;
    border-radius: 4px;
    border-left: 3px solid #4a9eff;
    z-index: 0; /* SH-WEB-T30: Normal stacking order */
    isolation: isolate; /* SH-WEB-T30: Prevent inner z-index from leaking */
    overflow-wrap: anywhere; /* SH-WEB-T30: Prevent text overflow */
}

.details-block .signal-detail-item,
.details-block .digest-item {
    margin: 6px 0;
    font-size: 0.9rem;
    color: #c0c0c0;
}

/* SH-WEB-T70 - Normalize spacing for WHAT/WHY/WATCH blocks using tokens */
.narrative-line,
.signal-detail-item,
.digest-item {
    margin: calc(var(--item-gap) * 0.6) 0;
}

.details-block .signal-detail-item strong,
.details-block .digest-item strong {
    color: #e0e0e0;
    margin-right: 8px;
}

/* SH-WEB-UI-STATUS-BAR-META-DIM-01 — Label/value hierarchy + pending state */
.card .panel-body .digest-item,
.card .card-content .digest-item,
.card .panel-body .signal-detail-item,
.card .card-content .signal-detail-item {
    font-weight: 600;
}

.card .panel-body .digest-item strong,
.card .card-content .digest-item strong,
.card .panel-body .signal-detail-item strong,
.card .card-content .signal-detail-item strong {
    font-weight: 500;
    opacity: 0.6;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.explanation--pending {
    opacity: 0.65;
    font-weight: 500;
}

.details-only {
    display: none;
}

.status {
    margin-bottom: var(--status-margin-bottom);
    padding: var(--status-padding);
    border-radius: 4px;
    text-align: center;
    font-size: 0.85rem;
    min-height: 18px;
}

.status.loading {
    background: #2a4a6a;
    color: #8ac4ff;
}

.status.error {
    background: #6a2a2a;
    color: #ff8a8a;
}

.status.success {
    background: #2a6a3a;
    color: #8affaa;
}

/* SH-WEB-T28 - Global Signal Summary Strip */
.summary-strip {
    margin-bottom: var(--section-gap);
    padding: calc(var(--card-padding) * 0.625) calc(var(--card-padding) - 2px);
    background: var(--card-bg);
    border: var(--card-border);
    border-radius: var(--card-radius);
    font-size: 0.9rem;
    min-height: 48px;
    display: flex;
    align-items: flex-start; /* SH-WEB-T36: allow clean wrapping without clipping */
}

.summary-strip-content {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    width: 100%;
    row-gap: 6px; /* SH-WEB-T36: tighter wrap spacing */
    overflow-x: auto; /* SH-WEB-T36: safe fallback when wrapping is insufficient */
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
}

.summary-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    white-space: nowrap;
}

button.summary-chip {
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
    font: inherit;
    color: inherit;
}

button.summary-chip:focus-visible {
    outline: 2px solid rgba(80, 160, 255, 0.8);
    outline-offset: 2px;
    border-radius: 2px;
}

.summary-chip.summary-symbol {
    font-weight: 600;
    color: #4a9eff;
}

.summary-label {
    color: rgba(255, 255, 255, 0.6);
    font-size: 0.85rem;
}

.summary-value {
    color: #e0e0e0;
    font-weight: 500;
}

.summary-value.summary-bias-long {
    color: #4ade80;
}

.summary-value.summary-bias-short {
    color: #f87171;
}

.summary-value.summary-bias-neutral {
    color: rgba(255, 255, 255, 0.7);
}

.summary-value.summary-confidence {
    color: #4a9eff;
    font-weight: 600;
}

.summary-separator {
    color: rgba(255, 255, 255, 0.3);
    margin: 0 2px;
}

/* SH-WEB-T36: Ensure snapshot tooltip overlays neighboring panels */
#panel-data-sources {
    position: relative;
    z-index: 5;
}

#panel-data-sources .panel-title-row {
    overflow: visible;
}

#panel-data-sources .sh-tooltip__content {
    z-index: 10050;
}

/* Allow wrapping on smaller screens */
@media (max-width: 1100px) {
    .summary-strip-content {
        gap: 6px;
    }
    
    .summary-chip {
        font-size: 0.85rem;
    }
    
    .summary-label {
        font-size: 0.8rem;
    }
}

@media (max-width: 720px) {
    .summary-strip {
        padding: 8px 12px;
        min-height: 44px;
    }
    
    .summary-strip-content {
        gap: 4px;
    }
}

/* SH-WEB-T29 - Panel focus highlight */
.panel-focus {
    outline: 2px solid rgba(80, 160, 255, 0.65);
    outline-offset: 2px;
    box-shadow: 0 0 0 3px rgba(80, 160, 255, 0.12);
    transition: outline-color 180ms ease, box-shadow 180ms ease;
}

/* T35 - Digest as Anchor Module: Give Digest more width, reduce others slightly */
/* SH-WEB-T24 - Responsive dashboard grid */
/* SH-WEB-T28 - Stable grid with explicit breakpoints (3/2/1 columns) */
/* SH-WEB-T29 - Pro layout stability (container + fixed grid + top-row height lock) */
/* SH-WEB-T24 - Bottom modules layout stabilization: fixed row height */
/* FIXED: Use auto rows instead of 50fr 50fr to prevent overlaps with fixed-height panels */
.dashboard-grid {
    display: grid;
    gap: var(--section-gap);
    grid-template-columns: repeat(2, minmax(0, 1fr));
    /* Use auto rows so rows size based on their content (fixed panel heights) */
    grid-template-rows: auto auto;
    /* Remove fixed height constraint - let rows size naturally */
    height: auto;
    min-height: 0;
    align-items: start;
}

/* 2 columns - now default for desktop */
/* 1 column for tablet/mobile */
@media (max-width: 1199px) {
    .dashboard-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* 1 column — earlier breakpoint for tablet/zoomed viewports */
@media (max-width: 860px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    .dashboard-row,
    .dashboard-row--top,
    .dashboard-row--bottom {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 720px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

/* SH-PREVIEW-T04 — Stable core panel heights (reduce load/refresh layout shift)
   Apply min-height to content containers (not cards) for conservative stabilization. */
#digest-content { min-height: 240px; }
#signals-content { min-height: 280px; }
#whales-content { min-height: 260px; }
#news-content { min-height: 320px; }

#digest-content .empty-message,
#signals-content .empty-message,
#whales-content .empty-message,
#news-content .empty-message {
    min-height: inherit;
}

/* SH-PREVIEW-T05 — Row-pair stabilization (reduce large empty gaps)
   Goal: keep left/right panels in the same row visually dense when one side is empty. */
:root {
    --dash-pair-min-h-medium: 360px; /* X News & Signals + Polymarket */
    --dash-pair-min-h-small: 260px;  /* Flows + Volatility, Leverage + Liquidations */
    --dash-pair-min-h-large: 320px;  /* Liquidity Stress + Top Movers */
}

#xnews-content { min-height: var(--dash-pair-min-h-medium); }
#polymarket-content { min-height: var(--dash-pair-min-h-medium); }

#stablecoin-flows-content { min-height: var(--dash-pair-min-h-small); }
#market-structure-content { min-height: var(--dash-pair-min-h-small); }

#leverage-state-content { min-height: var(--dash-pair-min-h-small); }
#liquidations-content { min-height: var(--dash-pair-min-h-small); }

#liquidity-stress-content { min-height: var(--dash-pair-min-h-large); }
#topmovers-content { min-height: var(--dash-pair-min-h-large); }

/* Desktop dashboard layout fix: robust row-based grid (no display: contents, no grid-template-areas) */
@media (min-width: 1200px) {
    /* SH-WEB-T62 - Unified panel height variable for all dashboard panels */
    :root { --dash-panel-h: 360px; }
    
    /* Top row: 2 columns - Digest, Signals, Whales, News (2 modules per row) */
    .dashboard-row--top {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: var(--section-gap);
        align-items: stretch !important; /* Ensure Digest and Market Context have equal height */
    }
    
    /* Override general .dashboard-row--top .card { height: auto; } rule to allow stretch */
    .dashboard-row--top .card {
        height: auto; /* Will be overridden by specific panel rules with !important */
    }
    
    /* SH-WEB-TXX - Bottom row: explicit grid with 2 columns - prevents overlaps */
    /* CRITICAL: This rule must override the general .dashboard-row--bottom rule at line 1098 */
    .dashboard-row--bottom {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: var(--section-gap) !important; /* Use consistent gap */
        align-items: start !important; /* Start alignment to prevent stretching that causes overlaps */
        height: auto !important; /* Auto height to prevent overlap */
        min-height: 0 !important; /* Allow grid to shrink if needed */
        position: relative !important; /* Ensure normal flow */
    }
    
    /* SH-WEB-PREVIEWDASH-LAYOUT-FIX-NEWS-XNEWS-POLY-TOPM-08: pair X News + News on row 1, unpin Polymarket */
    #panel-xnews {
        grid-column: 1;
        grid-row: 1;
        position: relative !important;
        top: auto !important;
        left: auto !important;
        right: auto !important;
        bottom: auto !important;
    }

    #panel-news {
        grid-column: 2;
        grid-row: 1;
        position: relative !important;
        top: auto !important;
        left: auto !important;
        right: auto !important;
        bottom: auto !important;
    }
    
    #panel-polymarket {
        grid-column: auto;
        grid-row: auto;
        position: relative !important;
        top: auto !important;
        left: auto !important;
        right: auto !important;
        bottom: auto !important;
    }
    
    /* SH-WEB-T64 - Market Structure panel: center column, row 2 (under Polymarket) */
    #panel-market-structure {
        grid-column: 2;
        grid-row: 2;
        position: relative !important;
        top: auto !important;
        left: auto !important;
        right: auto !important;
        bottom: auto !important;
    }
    
    #panel-topmovers {
        /* Removed explicit grid-column for 2-column layout - will flow naturally */
        position: relative !important;
        top: auto !important;
        left: auto !important;
        right: auto !important;
        bottom: auto !important;
    }
    
    #panel-flows {
        grid-column: 1;
        grid-row: 2;
        position: relative !important;
        top: auto !important;
        left: auto !important;
        right: auto !important;
        bottom: auto !important;
    }
    
    /* Remove panel--wide span hack since we're using proper grid columns */
    .dashboard-row .panel--wide {
        grid-column: unset;
    }
    
    /* SH-WEB-TXX - Standard panels: fixed height (360px) - institutional dashboard */
    /* All standard panels must have stable height with internal scrolling */
    #panel-digest,
    #panel-market-context,
    #panel-signals,
    #panel-news {
        height: var(--dash-panel-h) !important;
        max-height: var(--dash-panel-h) !important;
        min-height: var(--dash-panel-h) !important;
        display: flex !important;
        flex-direction: column !important;
        overflow: hidden !important;
        min-width: 0 !important;
    }
    
    /* SH-WEB-TXX - Whales module pilot: fixed height (720px), 2x taller than other modules */
    /* Exception: Whales is taller with scroll internal + footer fixed */
    #panel-whales {
        height: 720px !important;
        max-height: 720px !important;
        min-height: 720px !important;
        display: flex !important;
        flex-direction: column !important;
        overflow: hidden !important;
        min-width: 0 !important;
    }

    /* SH-WEB-TXX - News/Digest/Signals/XNews/Polymarket panels: match Whales height */
    #panel-news,
    #panel-digest,
    #panel-signals,
    #panel-xnews,
    #panel-polymarket,
    #panel-flows,
    #panel-market-structure,
    #panel-leverage-state,
    #panel-liquidations,
    #panel-liquidity-stress,
    #panel-topmovers {
        height: 720px !important;
        max-height: 720px !important;
        min-height: 720px !important;
        display: flex !important;
        flex-direction: column !important;
        overflow: hidden !important;
        min-width: 0 !important;
    }
    
    /* SH-WEB-TXX - Whales interpretation line: positioned at bottom (non-scrollable footer) */
    #panel-whales .whales-interpretation {
        flex-shrink: 0 !important;
        flex-grow: 0 !important;
        margin-top: auto !important;
        padding-top: 12px;
        border-top: 1px solid rgba(255, 255, 255, 0.08);
        font-size: 0.85rem;
        color: rgba(255, 255, 255, 0.7);
        font-style: italic;
    }
    
    /* SH-WEB-T62 - Top row panels: ensure proper flex layout and scrolling */
    /* Panel headers must be fixed (non-scrolling) */
    #panel-digest .panel-title-row,
    #panel-market-context .panel-title-row,
    #panel-signals .panel-title-row,
    #panel-news .panel-title-row,
    #panel-whales .panel-title-row {
        flex: 0 0 auto !important; /* Fixed header, never shrinks or grows */
    }
    
    #panel-digest .card-content,
    #panel-market-context .card-content,
    #panel-signals .card-content,
    #panel-news .card-content {
        display: flex !important;
        flex-direction: column !important;
        flex: 1 1 auto !important;
        min-height: 0 !important;
    }
    
    /* SH-WEB-TXX - Whales controls: fixed (non-scrolling) */
    #panel-whales .whales-controls {
        flex: 0 0 auto !important; /* Fixed controls, never shrinks or grows */
    }
    
    /* SH-WEB-TXX - Whales module: content scrolls, interpretation at bottom */
    /* Card-content must scroll internally, leaving footer (.whales-interpretation) visible */
    /* Footer is sibling element, flex layout ensures proper space distribution */
    #panel-whales .card-content {
        display: flex !important;
        flex-direction: column !important;
        flex: 1 1 auto !important;
        min-height: 0 !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        padding-right: 8px !important;
        scrollbar-gutter: stable !important;
    }
    
    /* SH-WEB-T62 - Top row panels with .panel-body: scroll in .panel-body */
    #panel-digest .panel-body,
    #panel-market-context .panel-body,
    #panel-signals .panel-body,
    #panel-news .panel-body {
        flex: 1 1 auto !important;
        min-height: 0 !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        padding-right: 8px;
        scrollbar-gutter: stable;
    }
    
    /* SH-WEB-TXX - Whales panel-body: scroll within card-content */
    #panel-whales .panel-body {
        flex: 1 1 auto !important;
        min-height: 0 !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        padding-right: 8px;
        scrollbar-gutter: stable;
    }
    
    /* SH-WEB-T62 - Top row panels: if no .panel-body, scroll in .card-content */
    /* This will be handled by existing .dashboard-row--top .card.panel--scroll .card-content rule */
    
    
    /* SH-WEB-T62 - Bottom row panels: ensure headers are fixed (non-scrolling) */
    #panel-xnews .panel-title-row,
    #panel-polymarket .panel-title-row,
    #panel-market-structure .panel-title-row,
    #panel-topmovers .panel-title-row,
    #panel-flows .panel-title-row {
        flex: 0 0 auto !important; /* Fixed header, never shrinks or grows */
    }
    
    /* SH-WEB-T62 - Bottom row: X News, Polymarket, Market Structure, Top Movers: scroll in .panel-body */
    /* SH-WEB-T64 - Added #panel-market-structure to scroll pattern */
    #panel-xnews .card-content,
    #panel-polymarket .card-content,
    #panel-market-structure .card-content,
    #panel-topmovers .card-content {
        display: flex !important;
        flex-direction: column !important;
        flex: 1 1 auto !important;
        min-height: 0 !important;
        overflow: hidden !important; /* Hide overflow, let panel-body handle scrolling */
    }
    
    /* SH-WEB-TXX - Bottom row panel-body: internal scrolling for long content */
    /* Top Movers priority: ensure list scrolls internally within fixed panel */
    #panel-xnews .panel-body,
    #panel-polymarket .panel-body,
    #panel-market-structure .panel-body,
    #panel-topmovers .panel-body {
        flex: 1 1 auto !important;
        min-height: 0 !important;
        max-height: 100% !important; /* Constrain to parent */
        overflow-y: auto !important;
        overflow-x: hidden !important;
        padding-right: 8px;
        scrollbar-gutter: stable;
    }
    
    /* SH-WEB-TXX - Flows controls: fixed (non-scrolling) */
    #panel-flows .stablecoin-flows-controls {
        flex: 0 0 auto !important; /* Fixed controls, never shrinks or grows */
    }
    
    /* SH-WEB-TXX - Flows module: content scrolls, interpretation at bottom */
    /* Card-content must scroll internally, leaving footer (.stablecoin-flows-interpretation) visible */
    /* Footer is sibling element, flex layout ensures proper space distribution */
    #panel-flows .card-content {
        display: flex !important;
        flex-direction: column !important;
        flex: 1 1 auto !important;
        min-height: 0 !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        padding-right: 8px !important;
        scrollbar-gutter: stable !important;
    }
    
    /* SH-WEB-TXX - Flows interpretation line: positioned at bottom (non-scrollable footer) */
    #panel-flows .stablecoin-flows-interpretation {
        flex-shrink: 0 !important;
        flex-grow: 0 !important;
        margin-top: auto !important;
        padding-top: 12px;
        border-top: 1px solid rgba(255, 255, 255, 0.08);
        font-size: 0.85rem;
        color: rgba(255, 255, 255, 0.7);
        font-style: italic;
    }
}

/* SH-WEB-T29 - Dashboard row containers */
/* SH-WEB-T?? - min-height:0 is required so overflow-y:auto can actually clip and scroll */
.dashboard-row {
    display: grid;
    gap: var(--section-gap);
    grid-column: 1 / -1; /* Span all columns in parent grid */
    align-items: start;
    min-height: 0; /* CRITICAL: allows flex children to shrink properly and enables overflow scrolling */
    height: auto; /* Auto height to prevent overlaps */
    position: relative; /* Ensure normal flow, no absolute positioning */
}

/* Inherit column structure from parent grid at each breakpoint */
/* Default: 2 columns (desktop and tablet) */
.dashboard-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

@media (max-width: 1199px) {
    .dashboard-row {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 720px) {
    .dashboard-row {
        grid-template-columns: 1fr;
    }
}

/* Top row: auto height to prevent overlap */
.dashboard-row--top {
    align-items: start; /* Start alignment to prevent stretching that causes overlaps */
    min-height: 0; /* CRITICAL: required for overflow scrolling to work */
    height: auto; /* Auto height to prevent overlap */
    position: relative; /* Ensure normal flow */
}

/* Top row panels: flex layout with auto height */
/* SH-WEB-T?? - Removed viewport-based height (62vh), use auto height to prevent overlap */
.dashboard-row--top .card {
    display: flex;
    flex-direction: column;
    min-width: 0; /* Prevent overflow issues in grid */
    min-height: 0; /* CRITICAL: allows flex item to shrink below content size so overflow can work */
    height: auto; /* Auto height to prevent overlap */
}

/* Top row panel body: flex to fill available height */
.dashboard-row--top .card .card-content {
    flex: 1 1 auto;
    min-height: 0; /* Allow flex item to shrink below content size */
}

/* Top row scrollable panels: ensure they fill height and scroll internally */
/* Override max-height from general scrollable panel styles */
/* SH-WEB-T62 - Updated to work with fixed panel height */
.dashboard-row--top .card.panel--scroll .card-content {
    overflow-y: auto;
    overflow-x: hidden;
    max-height: none !important; /* Override responsive max-height, use flex instead */
    flex: 1 1 auto;
    min-height: 0;
    padding-right: 8px;
    scrollbar-gutter: stable;
}

/* SH-WEB-T24 - Bottom row: auto height with 3 columns grid */
/* SH-WEB-T?? - min-height:0 is required so overflow-y:auto can actually clip and scroll */
.dashboard-row--bottom {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--section-gap);
    height: auto; /* Auto height to prevent overlap */
    min-height: 0; /* CRITICAL: allows grid items to shrink below content size so overflow can work */
    align-items: start; /* Start alignment to prevent stretching that causes overlaps */
    position: relative; /* Ensure normal flow */
}

/* Responsive: 2 columns */
@media (max-width: 1199px) {
    .dashboard-row--bottom {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* Responsive: 1 column */
@media (max-width: 720px) {
    .dashboard-row--bottom {
        grid-template-columns: 1fr;
    }
}

/* SH-WEB-T24 - Bottom row panels: flex column structure with auto height */
.dashboard-row--bottom .card {
    display: flex;
    flex-direction: column;
    min-height: 0; /* CRITIQUE: permet au flex de respecter la contrainte de hauteur */
    min-width: 0; /* Prevent overflow issues in grid */
    height: auto; /* Auto height to prevent overlap */
}

/* Stablecoin Flows card: explicit flex column with min-height:0 (matches News/Whales pattern) */
#panel-flows {
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden; /* Prevent panel-level scrolling, only card-content scrolls */
}

/* SH-WEB-T24 - Bottom row panel content container: flex to contain panel-body */
/* Exception: #panel-flows uses top-row pattern (scrolls in .card-content, not .panel-body) */
.dashboard-row--bottom .card:not(#panel-flows) .card-content {
    display: flex;
    flex-direction: column;
    min-height: 0; /* CRITIQUE: permet au flex de respecter la contrainte */
    flex: 1 1 auto; /* Prend l'espace disponible */
    overflow: hidden; /* Hide overflow, let panel-body handle scrolling */
}

/* Stablecoin Flows: use exact top-row pattern (same as News/Whales) */
.dashboard-row--bottom #panel-flows .card-content {
    display: flex !important;
    flex-direction: column !important;
    flex: 1 1 auto !important;
    min-height: 0 !important; /* CRITICAL: Allow flex item to shrink below content size so overflow can work */
    overflow-y: auto !important;
    overflow-x: hidden !important;
    padding-right: 8px !important;
    scrollbar-gutter: stable !important;
}

/* SH-WEB-T24 - Bottom row panel body: scrollable list area */
.dashboard-row--bottom .card .card-content .panel-body {
    min-height: 0; /* CRITIQUE: permet au scroll de fonctionner */
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 8px; /* SH-WEB-T70: Account for scrollbar width */
    overscroll-behavior: auto;
    scrollbar-gutter: stable;
    flex: 1 1 auto; /* Prend l'espace disponible */
}

/* SH-WEB-T70 - Scrollbar styling unified above (no duplicates needed) */

/* SH-WEB-T24 - Override general panel--scroll styles for bottom row */
/* Bottom row panels scroll in .panel-body, not .card-content */
/* Exception: #panel-flows uses top-row pattern (scrolls in .card-content) */
.dashboard-row--bottom .card.panel--scroll:not(#panel-flows) .card-content {
    max-height: none !important; /* Override general max-height */
    overflow-y: hidden !important; /* Disable scrolling in card-content */
    overflow-x: hidden;
    padding-right: 0; /* Remove padding since scrollbar is in panel-body */
}

/* Stablecoin Flows: exact News/Whales pattern - scroll in .card-content */
/* Non-desktop: use max-height constraint for internal scrolling (like generic .card.panel--scroll .card-content) */
.dashboard-row--bottom #panel-flows.panel--scroll .card-content {
    display: flex !important;
    flex-direction: column !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    /* max-height: none only on desktop (>=1200px) where panel has fixed height - see desktop media query */
    flex: 1 1 auto !important;
    min-height: 0 !important; /* CRITICAL: enables overflow in flex layouts */
    padding-right: 8px !important;
    scrollbar-gutter: stable !important;
}

/* Non-desktop: apply max-height constraint for internal scrolling (matches generic .card.panel--scroll .card-content) */
@media (max-width: 1199px) {
    .dashboard-row--bottom #panel-flows.panel--scroll .card-content {
        max-height: none; /* Match generic responsive max-height for < 1200px */
    }
}

@media (max-width: 860px) {
    .dashboard-row--bottom #panel-flows.panel--scroll .card-content {
        max-height: 48vh; /* Match generic responsive max-height for < 860px */
    }
}

/* Desktop only: remove max-height constraint since panel has fixed height (360px) */
/* This ensures internal scrolling works correctly when panel height is fixed */
@media (min-width: 1200px) {
    .dashboard-row--bottom #panel-flows.panel--scroll .card-content {
        max-height: none !important; /* Override responsive max-height, use flex instead */
    }
}

/* SH-WEB-T70 - Scrollbar styling unified above (no duplicates needed) */

/* SH-WEB-T70 - Scrollbar styling unified above (no duplicates needed) */

/* SH-WEB-T24 - Bottom row panel header: fixed (non-scrollable) */
.dashboard-row--bottom .card .panel-title-row {
    flex-shrink: 0; /* Header ne rétrécit pas */
    position: static; /* Pas besoin de sticky car le scroll est dans le body */
}

/* SH-WEB-T24 - Override sticky header for bottom row panels with panel--scroll */
.dashboard-row--bottom .card.panel--scroll > .panel-title-row {
    position: static !important; /* Override sticky from general panel--scroll styles */
    z-index: auto;
    background: transparent;
    backdrop-filter: none;
    padding-bottom: var(--card-header-padding-bottom);
    margin-bottom: var(--card-header-margin-bottom);
    border-bottom: none;
}

/* SH-WEB-T24 - Special case: stablecoin-flows controls (non-sticky, juste fixe) */
.dashboard-row--bottom .card .stablecoin-flows-controls {
    flex-shrink: 0; /* Controls ne rétrécissent pas */
    position: static; /* Pas besoin de sticky car le scroll est dans le body */
}

/* SH-WEB-T24 - Override sticky controls for bottom row stablecoin-flows */
/* Exception: Stablecoin Flows uses top-row scroll pattern, so keep controls sticky */
.dashboard-row--bottom .card.panel--scroll:not(#panel-flows) .stablecoin-flows-controls {
    position: static !important; /* Override sticky from general panel--scroll styles */
    top: auto;
    z-index: auto;
    background: transparent;
    backdrop-filter: none;
    margin-top: 0;
}

/* Stablecoin Flows controls: sticky (matches top-row pattern) */
#panel-flows .stablecoin-flows-controls {
    flex-shrink: 0; /* Ensure controls don't shrink */
    position: sticky;
    top: calc(28px + var(--card-header-padding-bottom) + 1px);
    z-index: 1;
    background: rgba(37, 37, 37, 0.98);
    backdrop-filter: blur(2px);
}

/* Responsive adjustments: maintain auto height for all breakpoints */
@media (max-width: 1200px) {
    .dashboard-grid {
        height: auto;
        min-height: 0;
    }
}

@media (max-width: 860px) {
    .dashboard-grid {
        height: auto;
        min-height: 0;
    }
}

/* Mobile: if layout stacks vertically, allow rows to be auto */
@media (max-width: 720px) {
    .dashboard-grid {
        height: auto;
        min-height: 0;
    }
}

#panel-digest {
    /* T35 - Slightly higher contrast and more prominent header */
    background: rgba(255,255,255,0.035);
    border: 1px solid rgba(73, 158, 255, 0.12);
    position: relative; /* SH-WEB-T30: Ensure stacking context */
    isolation: isolate; /* SH-WEB-T30: Prevent z-index leakage */
}

#panel-digest h2 {
    font-size: 1.2rem;
    font-weight: 600;
    color: #5aaeff;
}

.card {
    position: relative; /* SH-WEB-T30: Establish stacking context to prevent z-index leakage */
    background: #252525;
    border: 1px solid #3a3a3a;
    border-radius: 8px;
    padding: var(--card-padding);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    min-width: 0; /* SH-WEB-T28: Prevent overflow in grid */
    isolation: isolate; /* SH-WEB-T30: Prevent stacking context leakage */
}

/* Base card class - canonical card system */
.ui-card {
    position: relative;
    background: var(--card-bg);
    border: var(--card-border);
    border-radius: var(--card-radius);
    padding: var(--card-padding);
    /* T36 - Micro-Interactions: Uniform transitions */
    transition: background-color 120ms ease, border-color 120ms ease, box-shadow 120ms ease;
}

.ui-card:hover {
    background: var(--card-hover-bg);
    box-shadow: var(--card-hover-glow);
    border: var(--card-hover-border);
}

.ui-card:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring), var(--card-hover-glow);
}

/* Accent variant - left accent bar */
.ui-card--accent::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--card-accent);
    border-radius: var(--card-radius) 0 0 var(--card-radius);
    pointer-events: none;
}

/* Map existing card classes to base system */
/* These classes inherit base styles from .ui-card */

/* Normalize vertical spacing between cards */
.ui-card + .ui-card {
    margin-top: var(--card-gap);
}

/* Apply accent bar to cards that should have it */
.whale-card::before,
.polymarket-item::before,
.stablecoin-flow-card::before,
.news-card::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--card-accent);
    border-radius: var(--card-radius) 0 0 var(--card-radius);
    pointer-events: none;
}

/* Override old border-left implementations for signal-item and x-signal-card */
.signal-item,
.x-signal-card {
    border-left: none !important;
}

.signal-item::before,
.x-signal-card::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    background: var(--card-accent);
    border-radius: var(--card-radius) 0 0 var(--card-radius);
    pointer-events: none;
}

/* Ensure focus rings on interactive elements inside cards remain visible */
.ui-card a:focus-visible,
.ui-card button:focus-visible,
.whale-card a:focus-visible,
.whale-card button:focus-visible,
.x-signal-card a:focus-visible,
.x-signal-card button:focus-visible,
.polymarket-item a:focus-visible,
.polymarket-item button:focus-visible,
.stablecoin-flow-card a:focus-visible,
.stablecoin-flow-card button:focus-visible,
.news-card a:focus-visible,
.news-card button:focus-visible,
.news-item a:focus-visible,
.news-item button:focus-visible,
.signal-item a:focus-visible,
.signal-item button:focus-visible {
    outline: 2px solid rgba(73, 158, 255, 0.8);
    outline-offset: 2px;
    border-radius: 6px;
}

/* T36 - Micro-Interactions: Uniform hover states for rows */
.signal-item:hover,
.whale-card:hover,
.news-card:hover,
.x-signal-card:hover,
.polymarket-item:hover,
.stablecoin-flow-card:hover,
.topmover-item:hover {
    background: var(--card-hover-bg);
    border-color: var(--card-hover-border);
    box-shadow: var(--card-hover-glow);
}

/* T36 - Highlight animation for new items (signals, whales) */
@keyframes highlight-new {
    0% {
        background: rgba(73, 158, 255, 0.15);
        border-color: rgba(73, 158, 255, 0.4);
    }
    100% {
        background: var(--card-bg);
        border-color: var(--card-border);
    }
}

.signal-item--new,
.whale-card--new {
    animation: highlight-new 2s ease-out;
}

/* T36 - Subtle row hover transitions */
.signal-item,
.whale-card,
.news-card,
.x-signal-card,
.polymarket-item,
.stablecoin-flow-card,
.topmover-item {
    transition: background-color 120ms ease, border-color 120ms ease, box-shadow 120ms ease;
}

/* SH-WEB-T23: Data Sources / API Status panel */
#panel-data-sources {
    margin-bottom: var(--section-gap);
}

#panel-data-sources .panel-title-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--card-header-margin-bottom);
    padding-bottom: var(--card-header-padding-bottom);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

/* SH-WEB-T27: Snapshot freshness badge in header - prevent auto margin push, allow natural flex flow */
#panel-data-sources .panel-title-row #snapshot-freshness-badge {
    margin-left: 0;
}

/* SH-WEB-T28: Snapshot metadata container in header */
.snapshot-metadata {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 0.75rem;
    color: #888;
    flex-wrap: wrap;
}

.snapshot-metadata-item {
    font-family: var(--font-mono, 'Courier New', monospace);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.snapshot-view-link {
    color: #4a9eff;
    text-decoration: none;
    white-space: nowrap;
    transition: opacity 0.2s;
}

.snapshot-view-link:hover:not([style*="cursor: not-allowed"]) {
    text-decoration: underline;
    opacity: 0.8;
}

.snapshot-view-link[style*="cursor: not-allowed"] {
    pointer-events: none;
}

/* SH-WEB-T29: Snapshot tooltip */
.sh-tooltip {
    position: relative;
    display: inline-block;
}

.sh-tooltip__btn {
    width: 18px;
    height: 18px;
    line-height: 18px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    background: rgba(255, 255, 255, 0.06);
    color: rgba(255, 255, 255, 0.85);
    font-size: 12px;
    cursor: help;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.sh-tooltip__btn:focus-visible {
    outline: 2px solid rgba(80, 160, 255, 0.9);
    outline-offset: 2px;
}

.sh-tooltip__content {
    position: absolute;
    bottom: 130%;
    left: 50%;
    transform: translateX(-50%);
    min-width: 260px;
    max-width: 320px;
    padding: 10px 12px;
    border-radius: 8px;
    background: rgba(20, 20, 20, 0.98);
    border: 1px solid rgba(255, 255, 255, 0.14);
    color: rgba(255, 255, 255, 0.92);
    font-size: 12px;
    line-height: 1.35;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.45);
    z-index: 9999;
    white-space: normal;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 120ms ease, transform 120ms ease, visibility 120ms;
}

.sh-tooltip:hover .sh-tooltip__content,
.sh-tooltip__btn:focus-visible + .sh-tooltip__content {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(-2px);
}

@media (max-width: 520px) {
    .sh-tooltip__content {
        max-width: 280px;
    }
}

/* SH-WEB-T30: Whales mode badge */
.whales-mode {
    display: inline-flex;
    align-items: center;
    margin-left: 8px;
}

.whales-mode__badge {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.06);
    color: #ddd;
    cursor: help;
    width: auto;
    height: auto;
    line-height: 1.2;
    min-width: auto;
}

.whales-mode__badge--live {
    border-color: rgba(60, 200, 120, 0.45);
    background: rgba(60, 200, 120, 0.12);
    color: #bff5d3;
}

.whales-mode__badge--lkg {
    border-color: rgba(80, 160, 255, 0.45);
    background: rgba(80, 160, 255, 0.12);
    color: #cfe6ff;
}

.whales-mode__badge--snapshot {
    border-color: rgba(255, 200, 80, 0.45);
    background: rgba(255, 200, 80, 0.12);
    color: #ffe3b0;
}

.whales-mode__badge--none {
    border-color: rgba(255, 80, 80, 0.35);
    background: rgba(255, 80, 80, 0.10);
    color: #ffd0d0;
}

/* SH-WEB-T31: Whales provenance strip */
.whales-provenance {
    display: none;
    margin-left: 10px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
    font-size: 11px;
    opacity: 0.9;
}

.whales-provenance--show {
    display: inline-flex;
    gap: 10px;
    align-items: center;
}

.whales-provenance__item {
    padding: 2px 6px;
    border: 1px solid rgba(255, 255, 255, 0.10);
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.04);
}

.whales-provenance__link {
    padding: 2px 6px;
    border-radius: 6px;
    text-decoration: none;
    border: 1px solid rgba(110, 170, 255, 0.30);
    color: inherit;
}

.whales-provenance__link:hover {
    border-color: rgba(110, 170, 255, 0.55);
}

.whales-provenance__link--disabled {
    opacity: 0.5;
    pointer-events: none;
    border-color: rgba(255, 255, 255, 0.10);
}

/* SH-WEB-T32: Whales "Why this data?" tooltip */
.whales-why {
    margin-left: 6px;
}

/* SH-WEB-T33: General "Why this data?" tooltip */
.why-tooltip {
    margin-left: 6px;
}

/* Ensure tooltips appear above sticky headers */
.why-tooltip .sh-tooltip__content {
    z-index: 10000;
}

.data-sources-table {
    display: flex;
    flex-direction: column;
    gap: 0;
    font-size: var(--text-size-small);
}

.data-sources-row {
    display: grid;
    grid-template-columns: 1fr 0.8fr 1fr 1.5fr 1fr 1.5fr;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    align-items: center;
}

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

.data-sources-header {
    font-weight: 600;
    color: #b0b0b0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
    padding-bottom: 10px;
    margin-bottom: 4px;
}

.data-sources-cell {
    color: #e0e0e0;
    word-break: break-word;
    overflow-wrap: break-word;
}

.data-sources-status-ok {
    color: #4ade80;
    font-weight: 500;
}

.data-sources-status-warn {
    color: #fbbf24;
    font-weight: 500;
}

.data-sources-status-fail {
    color: #f87171;
    font-weight: 500;
}

/* SH-WEB-T68: Data source badge */
.data-source-badge {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 500;
    text-transform: lowercase;
    color: #cbd5f5;
    background-color: rgba(96, 165, 250, 0.12);
    font-family: var(--font-mono, 'Courier New', monospace);
}

/* SH-WEB-T26: Freshness badges */
.freshness-badge {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.85rem;
    font-weight: 500;
    font-family: var(--font-mono, 'Courier New', monospace);
}

.freshness-good {
    color: #4ade80;
    background-color: rgba(74, 222, 128, 0.1);
}

.freshness-warn {
    color: #fbbf24;
    background-color: rgba(251, 191, 36, 0.1);
}

.freshness-stale {
    color: #f87171;
    background-color: rgba(248, 113, 113, 0.1);
}

/* Responsive: stack on smaller screens */
@media (max-width: 768px) {
    .data-sources-row {
        grid-template-columns: 1fr;
        gap: 4px;
    }
    
    .data-sources-header {
        display: none;
    }
    
    .data-sources-cell::before {
        content: attr(data-label) ': ';
        font-weight: 600;
        color: #b0b0b0;
        margin-right: 8px;
    }

    .snapshot-metadata {
        flex-direction: column;
        align-items: flex-start;
        width: 100%;
    }
    .snapshot-metadata-item {
        white-space: normal;
        word-break: break-all;
        overflow-wrap: break-word;
        max-width: 100%;
    }
    #panel-data-sources .panel-title-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    .panel-meta {
        width: 100%;
        justify-content: flex-start;
        margin-left: 0;
    }

    /* Container: tighter lateral padding on mobile */
    .container {
        padding-left: 8px;
        padding-right: 8px;
    }

    /* Controls: column layout, constrained to viewport */
    .controls {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        padding: 10px;
        max-width: 100%;
        box-sizing: border-box;
    }

    /* Control groups: fill parent width */
    .control-group {
        max-width: 100%;
        width: 100%;
        box-sizing: border-box;
    }

    /* Inputs/selects: no fixed min-width, fill container */
    .control-group select,
    .control-group input {
        min-width: 0;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }

    /* View/panel control rows: wrap */
    .control-group .view-controls,
    .control-group .panel-controls {
        flex-wrap: wrap;
        gap: 6px;
        max-width: 100%;
    }

    /* Toggle buttons: smaller on mobile */
    .toggle-btn {
        min-width: 60px;
        padding: 8px 12px;
        font-size: 0.85rem;
    }
    .details-toggle-btn {
        min-width: auto;
        width: 100%;
        padding: 8px 16px;
    }

    /* Refresh button: full width */
    .refresh-btn {
        width: 100%;
        padding: 10px;
        box-sizing: border-box;
    }

    /* Intent thresholds: each label+select on its own line */
    .view-controls {
        flex-wrap: wrap;
        gap: 8px;
        width: 100%;
    }
    .view-controls select {
        min-width: 0;
        flex: 1 1 120px;
        max-width: 100%;
    }
    .view-controls span {
        flex-basis: 100%;
    }

    /* Profile/share URL: break long strings */
    .profile-status {
        word-break: break-all;
        overflow-wrap: break-word;
    }

    /* Cards: never exceed viewport */
    .card {
        max-width: 100%;
        box-sizing: border-box;
    }

    /* Summary strip: wrap on mobile */
    .summary-strip {
        max-width: 100%;
        overflow-x: auto;
    }
    .summary-strip-content {
        flex-wrap: wrap;
    }
}

/* Respect reduced motion preference */
@media (prefers-reduced-motion: reduce) {
    .ui-card,
    .whale-card,
    .x-signal-card,
    .polymarket-item,
    .stablecoin-flow-card,
    .news-card,
    .signal-item,
    .news-item {
        transition: none;
    }
    
    .ui-card:hover,
    .whale-card:hover,
    .x-signal-card:hover,
    .polymarket-item:hover,
    .stablecoin-flow-card:hover,
    .news-card:hover,
    .news-item:hover,
    .signal-item:hover {
        transform: none;
    }
}

.card h2 {
    color: #4a9eff;
    font-size: var(--text-size-title);
    margin-bottom: var(--card-header-margin-bottom);
    padding-bottom: var(--card-header-padding-bottom);
    border-bottom: 1px solid #3a3a3a;
    line-height: var(--line-height-tight);
}

/* T34 - Card Header Unification: Standard layout (title left, badges right, single line) */
/* SH-WEB-T23 - Allow metadata to wrap instead of truncating title */
.panel-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    row-gap: 6px;
    min-height: 28px;
    overflow: visible;
}

/* SH-WEB-T23 - Title should never shrink or truncate */
.panel-title-row > span:first-child {
    flex: 0 0 auto;
    white-space: nowrap;
}

/* SH-WEB-T23 - Metadata container groups timestamp, info button, and intent badge */
.panel-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
    margin-left: auto;
    row-gap: 6px;
}

/* SH-WEB-UI-STATUS-BAR-META-DIM-01 — Status accent bar */
.card.panel-status--neutral,
.card.panel-status--bullish,
.card.panel-status--bearish {
    position: relative;
}

.card.panel-status--neutral::before,
.card.panel-status--bullish::before,
.card.panel-status--bearish::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: 2px;
    border-radius: 8px 0 0 8px;
    pointer-events: none;
}

.card.panel-status--neutral::before {
    background: rgba(120, 140, 160, 0.35);
}

.card.panel-status--bullish::before {
    background: rgba(80, 170, 120, 0.45);
}

.card.panel-status--bearish::before {
    background: rgba(200, 90, 90, 0.45);
}

#panel-leverage-state,
#panel-leverage-state .card-content,
#panel-leverage-state .panel-body {
    overflow: visible !important;
}

#panel-leverage-state .sh-tooltip__content {
    top: calc(100% + 8px) !important;
    bottom: auto !important;
    left: auto !important;
    right: 0 !important;
}

#panel-liquidations,
#panel-liquidations .card-content,
#panel-liquidations .panel-body {
    overflow: visible !important;
}

/* SH-WEB-T23 - Legacy support: if metadata elements are direct children, still style them */
.panel-title-row > span:not(:first-child),
.panel-title-row > .preview-symbol-badge,
.panel-title-row > .panel-timestamp,
.panel-title-row > .panel-info-btn,
.panel-title-row > .intent-coverage {
    flex: 0 0 auto;
}

.panel-title-row > span:not(:first-child),
.panel-title-row > .preview-symbol-badge,
.panel-title-row > .panel-timestamp,
.panel-title-row > .panel-info-btn,
.panel-title-row > .intent-coverage {
    margin-left: auto;
}

.panel-timestamp {
    font-size: 0.75rem;
    color: #888;
    font-variant-numeric: tabular-nums;
    margin-left: 8px;
    opacity: 0.55;
}

/* SH-WEB-UI-STATUS-BAR-META-DIM-01 — Panel header meta dimming */
.panel-meta {
    opacity: 0.55;
}

.panel-title-row > .preview-symbol-badge,
.panel-title-row > .panel-timestamp,
.panel-title-row > .panel-info-btn,
.panel-title-row > .intent-coverage,
.panel-title-row .preview-symbol-badge,
.panel-title-row .panel-info-btn,
.panel-title-row .panel-timestamp {
    opacity: 0.55;
}

/* SH-WEB-UI-BADGE-ICON-OPAQUE-01 — Restore full opacity for BTC badges and info icons */
.panel-meta {
    opacity: 1;
}

.panel-title-row .preview-symbol-badge,
.panel-title-row .panel-info-btn {
    opacity: 1;
}

.panel-meta > :not(.preview-symbol-badge):not(.panel-info-btn) {
    opacity: 0.55;
}

.preview-card-title {
    display: flex;
    align-items: center;
    gap: 0;
}

.preview-card-title.panel-title-row {
    gap: 10px;
}

.preview-symbol-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 30px;
    padding: 0 6px;
    margin-left: 6px;
    border-radius: 999px;
    border: 1px solid #3e4a70;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #d5dcff;
    background: rgba(62, 74, 112, 0.25);
    opacity: 0.9;
}

.card-content {
    position: relative; /* SH-WEB-T30: Establish stacking context for content */
    color: #e0e0e0;
    font-size: var(--text-size-base);
    line-height: var(--line-height-base);
    overflow-wrap: anywhere; /* SH-WEB-T30: Prevent text overflow causing layout collisions */
    isolation: isolate; /* SH-WEB-T30: Prevent z-index leakage from inner elements */
}

.card-content * {
    min-width: 0; /* SH-WEB-T30: Allow flex/grid items to shrink below content size */
}

.card-content.loading {
    color: #888;
    font-style: italic;
}

.card-content.error {
    color: #ff6b6b;
}

/* SH-WEB-T24 - Internal scrolling for long panels */
/* SH-WEB-T26 - Normalize scrollable panels (max-height + sticky header + consistent grid) */
/* SH-WEB-T30 - Ensure sticky only applies to scroll panels, not all panels */
.card.panel--scroll {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* SH-WEB-T30: Sticky header ONLY for scroll panels, not generic panel headers */
.card.panel--scroll > .panel-title-row {
    position: sticky;
    top: 0;
    z-index: 2;
    background: rgba(37, 37, 37, 0.98); /* Match card background (#252525) with slight transparency for backdrop */
    backdrop-filter: blur(2px);
    padding-bottom: var(--card-header-padding-bottom);
    margin-bottom: 0;
    border-bottom: 1px solid #3a3a3a; /* Ensure border remains visible when sticky */
}

/* SH-WEB-T30: Ensure non-scroll panels have static headers (no sticky) */
.card:not(.panel--scroll) > .panel-title-row {
    position: static;
}

/* Keep controls section visible (for stablecoin-flows and whales) - positioned below header */
.card.panel--scroll .stablecoin-flows-controls,
.card.panel--scroll .whales-controls {
    position: sticky;
    /* Approximate header height: min-height (28px) + padding + border */
    top: calc(28px + var(--card-header-padding-bottom) + 1px);
    z-index: 1;
    background: rgba(37, 37, 37, 0.98);
    backdrop-filter: blur(2px);
    margin-top: 0;
}

.card.panel--scroll .card-content {
    max-height: 62vh;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 8px; /* SH-WEB-T70: Account for scrollbar width (8px) to prevent content hidden */
    flex: 1 1 auto;
    min-height: 0; /* Critical: enables overflow in flex layouts */
    overscroll-behavior: auto;
    overflow-wrap: anywhere; /* Prevent long strings from breaking layout */
    scrollbar-gutter: stable; /* Reserve space for scrollbar to prevent layout shift */
}

/* Responsive max-height for scrollable panels */
@media (max-width: 1200px) {
    .card.panel--scroll .card-content {
        max-height: none;
    }
}

@media (max-width: 860px) {
    .card.panel--scroll .card-content {
        max-height: 48vh;
    }
}

/* SH-WEB-T34 - Unified scrollbar styling for ALL scrollable containers */
/* Applied to: top row panels, bottom row panels, stablecoin flows, filters popover */
/* Base scrollbar styles (Firefox) */
.card.panel--scroll .card-content,
.dashboard-row--bottom .card .card-content .panel-body,
.dashboard-row--bottom #panel-flows.panel--scroll .card-content,
.filters-module-panels {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

/* WebKit scrollbar styling - unified across all scrollable areas */
.card.panel--scroll .card-content::-webkit-scrollbar,
.dashboard-row--bottom .card .card-content .panel-body::-webkit-scrollbar,
.dashboard-row--bottom #panel-flows.panel--scroll .card-content::-webkit-scrollbar,
.filters-module-panels::-webkit-scrollbar {
    width: 8px;
}

.card.panel--scroll .card-content::-webkit-scrollbar-track,
.dashboard-row--bottom .card .card-content .panel-body::-webkit-scrollbar-track,
.dashboard-row--bottom #panel-flows.panel--scroll .card-content::-webkit-scrollbar-track,
.filters-module-panels::-webkit-scrollbar-track {
    background: transparent;
}

.card.panel--scroll .card-content::-webkit-scrollbar-thumb,
.dashboard-row--bottom .card .card-content .panel-body::-webkit-scrollbar-thumb,
.dashboard-row--bottom #panel-flows.panel--scroll .card-content::-webkit-scrollbar-thumb,
.filters-module-panels::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.18);
    border-radius: 8px;
    border: 2px solid transparent;
    background-clip: content-box;
}

.card.panel--scroll .card-content::-webkit-scrollbar-thumb:hover,
.dashboard-row--bottom .card .card-content .panel-body::-webkit-scrollbar-thumb:hover,
.dashboard-row--bottom #panel-flows.panel--scroll .card-content::-webkit-scrollbar-thumb:hover,
.filters-module-panels::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
    background-clip: content-box;
}

/* Digest styles */
/* SH-WEB-T23: Digest panel scroll container stabilization */
#digest-content {
    position: relative; /* SH-WEB-T30: Establish stacking context */
    isolation: isolate; /* SH-WEB-T30: Prevent z-index leakage */
    overflow-wrap: anywhere; /* SH-WEB-T30: Prevent text overflow */
    scrollbar-gutter: stable; /* SH-WEB-T23: Prevent layout shift when scrollbar appears */
}

#digest-content * {
    min-width: 0; /* SH-WEB-T30: Allow flex/grid items to shrink */
}

.digest-item {
    margin-bottom: 10px;
    overflow: visible;
    min-width: 0;
    position: relative; /* SH-WEB-T30: Normal flow */
    z-index: 0; /* SH-WEB-T30: Normal stacking order */
}

/* T35 - Visual separator between overview and details in Digest */
/* SH-WEB-T30: Ensure normal flow, no overlap */
.digest-global-bias-section {
    position: relative; /* SH-WEB-T30: Normal flow */
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    z-index: 0; /* SH-WEB-T30: Normal stacking order */
    isolation: isolate; /* SH-WEB-T30: Prevent inner z-index from leaking */
}

.digest-item strong {
    color: #4a9eff;
    display: inline-block;
    min-width: 120px;
}

.digest-price {
    font-size: 1.5rem;
    font-weight: 600;
    color: #4a9eff;
    margin: 10px 0;
    white-space: nowrap;
    overflow: visible;
    min-width: 0;
    flex-shrink: 0;
}

.digest-change {
    font-size: 1.1rem;
    margin-left: 10px;
}

.digest-change.positive {
    color: #4caf50;
}

.digest-change.negative {
    color: #f44336;
}

/* SH-WEB-UI-PREVIEWDASH-COLOR-RESTORE-01: restore vivid Digest accents (preview-dashboard only) */
body[data-page="preview-dashboard"] #panel-digest .digest-item strong {
    color: #4a9eff;
    opacity: 1;
    text-transform: none;
    letter-spacing: 0;
    font-weight: 600;
}

body[data-page="preview-dashboard"] #panel-digest .digest-price {
    color: #4a9eff;
}

body[data-page="preview-dashboard"] #panel-digest .digest-item a {
    color: #5aaeff;
}

body[data-page="preview-dashboard"] .panel-title-row > span:first-child {
    color: #4a9eff;
}

/* Signals styles */
.signal-item {
    /* Base styles inherited from .ui-card */
    margin-bottom: var(--item-gap);
}

/* T34 - Unified signal header: title left, badges right, single line */
.signal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
    gap: 8px;
    flex-wrap: nowrap;
    min-height: 24px;
}

.signal-header .signal-direction {
    flex: 0 1 auto;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.signal-header .signal-time {
    flex: 0 0 auto;
    margin-left: auto;
    font-size: 0.8rem;
}

.signal-direction {
    font-weight: 600;
    color: #4a9eff;
}

.signal-time {
    color: #888;
    font-size: 0.9rem;
}

.signal-details {
    font-size: 0.9rem;
    color: #b0b0b0;
}

/* Whales styles - legacy styles removed, using whale-card styles below */

/* Whales card body structure */
.whales-card-body {
    display: flex;
    flex-direction: column;
}

#whales-live-area {
    margin-bottom: 0;
}

/* Recent whale transfers section */
.whales-recent-section {
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 0.85rem;
}

.whales-recent-header {
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: #bbb;
}

#whales-recent-list {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.whales-recent-list-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.25rem 0;
    color: #ccc;
    font-size: 0.85rem;
}

.whales-recent-time {
    opacity: 0.7;
    margin-right: 0.5rem;
    min-width: 50px;
}

.whales-recent-amount {
    font-weight: 500;
    flex: 1;
    margin: 0 0.5rem;
}

.whales-recent-exchange {
    opacity: 0.8;
    text-align: right;
}

/* Whale live activity message */
.whale-live-message {
    color: #4a9eff;
    font-size: 0.9rem;
    font-weight: 500;
    padding: 0.5rem 0;
    margin-bottom: 0.5rem;
}

/* Whale transfers list (new format) */
.whale-transfers-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

/* Ensure whales scrollable container has enough padding for scrollbar */
/* SH-WEB-T74: Increased padding to 12px to ensure Tx column is never hidden behind scrollbar */
#whales-content.card-content {
    padding-right: 12px;
    box-sizing: border-box;
}

/* SH-WEB-WHALES-EMPTY-GAP-FIX-02: Whales empty state centered without changing panel height */
#panel-whales.whales-empty #whales-content.card-content {
    display: flex !important;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 18px 16px 20px !important;
    overflow: hidden !important;
}

#panel-whales.whales-empty #whales-content .empty-message {
    margin: 0;
    padding: 0;
    max-width: 48ch;
    text-align: center;
    color: rgba(255, 255, 255, 0.72);
    font-style: normal;
    line-height: 1.4;
}

.whale-transfer-item {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 0.5rem;
    font-size: 0.85rem;
    color: #ccc;
    padding: 0.5rem 0;
    border-left: 2px solid transparent;
    padding-left: 0.5rem;
    line-height: 1.5;
}

/* SH-WEB-T74 - Professional Whales row layout: CSS Grid for perfect column alignment */
#whales-content .wh-row {
    display: grid;
    grid-template-columns: 64px 96px 1fr 92px 40px;
    column-gap: 10px;
    align-items: center;
    min-height: 34px;
    padding: 6px 8px;
    box-sizing: border-box;
    overflow: visible;
}

#whales-content .wh-row:hover {
    background: rgba(255, 255, 255, 0.02);
    border-radius: 4px;
}

/* Time column: stable width, no wrap, tabular numerals */
#whales-content .wh-time {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: clip;
    color: #9aa0a6;
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum" 1;
    text-align: left;
    font-size: 0.85rem;
    opacity: 0.85;
}

/* Badge column: auto width, no wrap */
#whales-content .wh-badge {
    white-space: nowrap;
    overflow: visible;
}

/* Label column: flexible with ellipsis */
#whales-content .wh-label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #b0b0b0;
}

/* Non-exchange label: fixed width, no ellipsis */
#whales-content .wh-label--non-exchange {
    min-width: 120px;
    overflow: visible;
    text-overflow: clip;
    white-space: nowrap;
}

/* Amount column: right-aligned, tabular numerals, hard alignment */
#whales-content .wh-amount {
    justify-self: end;
    text-align: right;
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum" 1;
    white-space: nowrap;
    overflow: visible;
    color: #e0e0e0;
    font-weight: 500;
}

/* Tx column: fixed width, always visible, hard alignment */
#whales-content .wh-tx {
    justify-self: end;
    width: 40px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    white-space: nowrap;
    overflow: visible;
}

.whale-transfer-item:first-child {
    border-left-color: var(--card-accent);
}

.whale-transfer-time {
    color: #888;
    font-weight: 500;
    min-width: 50px;
    flex-shrink: 0;
}

.whale-transfer-direction-pill {
    flex-shrink: 0;
    white-space: nowrap;
}

.whale-transfer-exchange {
    color: #b0b0b0;
    flex-shrink: 0;
}

.whale-transfer-amount {
    color: #e0e0e0;
    font-weight: 500;
    white-space: nowrap;
    flex-shrink: 0;
}

.whale-tx-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 22px;
    line-height: 22px;
    font-size: 0.7rem;
    padding: 0;
    margin: 0;
    background: #333;
    color: #4a9eff;
    text-decoration: none;
    border-radius: 3px;
    white-space: nowrap;
    flex-shrink: 0;
}

.whale-tx-button:hover {
    background: #3a3a3a;
    color: #5aaeff;
}

.whale-transfer-separator {
    color: #555;
    flex-shrink: 0;
}

.whale-transfer-arrow {
    color: #4a9eff;
    flex-shrink: 0;
}

.whale-transfer-wallets {
    color: #888;
    font-size: 0.8rem;
    flex-shrink: 0;
}

/* Subtle note for whale transfers */
.whale-subtle-note {
    color: #888;
    font-size: 0.8rem;
    font-style: italic;
    padding: 0.25rem 0;
    margin-bottom: 0.5rem;
}

/* Embed whale line */
.embed-whales-line {
    font-size: 0.75rem;
    color: #888;
    margin-top: 4px;
    line-height: 1.4;
}

/* Whale card styles (matching stablecoin/polymarket cards) */
.whale-card {
    /* Base styles inherited from .ui-card */
    margin-top: var(--item-gap);
}

.whale-card:first-child {
    margin-top: 0;
}

/* T34 - Unified whale header: title left, badges right, single line */
.whale-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
    min-width: 0;
    flex-wrap: nowrap;
    min-height: 24px;
}

.whale-top-left {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    flex: 1;
    flex-wrap: wrap;
}

.whale-top-right {
    flex: 0 0 auto;
    white-space: nowrap;
}

.whale-time {
    color: rgba(255,255,255,0.65);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    flex-shrink: 0;
    cursor: help;
}

.whale-badge {
    flex-shrink: 0;
    white-space: nowrap;
}

.whale-dest {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    opacity: 0.9;
    color: rgba(255,255,255,0.7);
}

.whale-amount-row {
    display: flex;
    align-items: baseline;
    gap: 10px;
    flex-wrap: wrap;
}

.whale-amount {
    color: #fff;
    font-size: 18px;
    font-weight: 700;
    white-space: nowrap;
}

.whale-asset {
    color: rgba(255,255,255,0.9);
    font-weight: 500;
    white-space: nowrap;
    flex-shrink: 0;
}

.whale-meta {
    opacity: 0.75;
    font-size: 12px;
    flex-shrink: 0;
    color: #888;
}

/* News styles */
.news-item {
    /* Base styles inherited from .ui-card */
    margin-bottom: var(--item-gap);
}

.news-card {
    /* Base styles inherited from .ui-card */
    margin-top: var(--item-gap);
    margin-bottom: 0; /* override .news-item margin-bottom */
    overflow: hidden; /* prevents accent bar rounding glitches */
}

.news-card:first-child {
    margin-top: 0;
}

/* T34 - Unified news header: title left, badges right, single line */
.news-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
    gap: 8px;
    flex-wrap: nowrap;
    min-height: 24px;
}

.news-header .news-title {
    flex: 0 1 auto;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    margin: 0;
}

.news-header .news-importance,
.news-header .news-time {
    flex: 0 0 auto;
    margin-left: auto;
}

.news-importance {
    font-size: 0.8rem;
    padding: 2px 6px;
    border-radius: 3px;
    font-weight: 600;
}

.news-importance.high {
    background: #f44336;
    color: white;
}

.news-importance.medium {
    background: #ff9800;
    color: white;
}

.news-importance.low {
    background: #4a9eff;
    color: white;
}

.news-time {
    color: #888;
    font-size: 0.9rem;
}

.news-title {
    margin: 5px 0;
    color: #e0e0e0;
}

.news-link {
    color: #4a9eff;
    text-decoration: none;
    font-size: 0.9rem;
    word-break: break-all;
}

.news-link:hover {
    text-decoration: underline;
}

/* News thumbnail styles */
.news-item-row {
    display: flex;
    gap: 12px;
    align-items: flex-start;
}

.news-thumb {
    width: 180px;
    height: 100px;
    border-radius: 8px;
    object-fit: cover;
    flex: 0 0 auto;
    opacity: 0.95;
}

.news-thumb--empty {
    background: #1f1f1f;
    border: 1px dashed #333;
}

.news-item-content {
    flex: 1;
    min-width: 0;
}

@media (max-width: 900px) {
    .news-item-row {
        flex-direction: column;
    }

    .news-thumb {
        width: 100%;
        height: 160px;
    }
}

/* X News specific styles */
/* .xnews-item accent bar applied via .ui-card--accent or card-specific ::before */

.xnews-badge {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 3px;
    font-size: 0.7rem;
    font-weight: 600;
    background: rgba(29, 161, 242, 0.2);
    color: #1da1f2;
    border: 1px solid rgba(29, 161, 242, 0.4);
    margin-right: 6px;
}

.xnews-source {
    font-size: 0.85rem;
    color: #888;
    margin: 2px 0;
    font-style: italic;
}

/* SH-WEB-T61 - Fix X News panel overflow (contract fix) */
/* Ensure X News follows the same UI contract as other bottom-row panels */
#panel-xnews {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-width: 0;
    position: relative;
}

#panel-xnews .card-content {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    min-width: 0;
}

#panel-xnews .panel-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    min-width: 0;
    width: 100%;
}

#panel-xnews .panel-body > * {
    max-width: 100%;
    min-width: 0;
    overflow-wrap: break-word;
}

.empty-message {
    color: #888;
    font-style: italic;
    text-align: center;
    padding: var(--card-padding);
}

.empty-state {
    padding: var(--card-padding);
    text-align: center;
}

/* SH-WEB-T24 - Empty state in bottom row panels: fill height and center vertically */
.dashboard-row--bottom .card .card-content .panel-body .empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100%; /* Fill available height in panel-body */
    flex: 1 1 auto;
}

.empty-state-title {
    font-size: 0.95rem;
    color: #e0e0e0;
    margin-bottom: 8px;
    font-weight: 500;
}

.empty-state-reason {
    font-size: 0.85rem;
    color: #b0b0b0;
    margin-bottom: 12px;
}

.empty-state-action {
    display: inline-block;
    padding: 6px 12px;
    background: rgba(74, 158, 255, 0.15);
    border: 1px solid rgba(74, 158, 255, 0.3);
    border-radius: 4px;
    color: #4a9eff;
    font-size: 0.85rem;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
    font-weight: 500;
}

.empty-state-action:hover {
    background: rgba(74, 158, 255, 0.25);
    border-color: rgba(74, 158, 255, 0.5);
}

.empty-state-action:focus-visible {
    outline: var(--focus-ring);
    outline-offset: 2px;
}

.empty-state-action:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* Tags for directions and sentiment */
.tag {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

/* Intent tags */
.intent-tag {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 500;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.85);
    white-space: nowrap;
}

/* Intent coverage telemetry badge */
.intent-coverage {
    font-size: 12px;
    opacity: 0.75;
    padding: 2px 8px;
    border: 1px solid var(--card-border);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.03);
    color: rgba(255, 255, 255, 0.7);
    white-space: nowrap;
    margin-left: auto;
    flex-shrink: 0;
}

.intent-tag--volatility_watch {
    border-color: rgba(255, 193, 7, 0.3);
    background: rgba(255, 193, 7, 0.12);
    color: #ffc107;
}

.intent-tag--liquidity_magnet {
    border-color: rgba(73, 158, 255, 0.3);
    background: rgba(73, 158, 255, 0.12);
    color: #4a9eff;
}

.intent-tag--short_term_risk {
    border-color: rgba(255, 80, 80, 0.3);
    background: rgba(255, 80, 80, 0.12);
    color: #ff5050;
}

.intent-tag--momentum_shift {
    border-color: rgba(0, 200, 120, 0.3);
    background: rgba(0, 200, 120, 0.12);
    color: #00c878;
}

.intent-tag--no_action {
    border-color: rgba(180, 180, 180, 0.2);
    background: rgba(180, 180, 180, 0.08);
    color: rgba(255, 255, 255, 0.6);
}

.tag-bullish {
    background: rgba(0, 200, 120, 0.15);
    color: #00c878;
    border: 1px solid rgba(0, 200, 120, 0.3);
}

.tag-bearish {
    background: rgba(255, 80, 80, 0.15);
    color: #ff5050;
    border: 1px solid rgba(255, 80, 80, 0.3);
}

.tag-neutral {
    background: rgba(180, 180, 180, 0.15);
    color: #cccccc;
    border: 1px solid rgba(180, 180, 180, 0.3);
}

/* SH-WEB-T65 - Volatility Regime badges */
.tag-regime-compression {
    background: rgba(73, 158, 255, 0.15);
    color: #4a9eff;
    border: 1px solid rgba(73, 158, 255, 0.3);
}

.tag-regime-expansion {
    background: rgba(255, 150, 0, 0.15);
    color: #ffb347;
    border: 1px solid rgba(255, 150, 0, 0.3);
}

.tag-regime-neutral {
    background: rgba(180, 180, 180, 0.15);
    color: #cccccc;
    border: 1px solid rgba(180, 180, 180, 0.3);
}

.tag-inflow {
    background: rgba(0, 150, 255, 0.15);
    color: #51a9ff;
    border: 1px solid rgba(0, 150, 255, 0.3);
}

.tag-outflow {
    background: rgba(255, 150, 0, 0.15);
    color: #ffb347;
    border: 1px solid rgba(255, 150, 0, 0.3);
}

.tag-exchange {
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(0, 150, 255, 0.15);
    color: #51a9ff;
    border: 1px solid rgba(0, 150, 255, 0.3);
    margin-left: 4px;
}

/* Fear & Greed badge */
.badge-feargreed {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
}

.fg-extreme-fear {
    background: rgba(255, 80, 80, 0.2);
    color: #ffb3b3;
}

.fg-fear {
    background: rgba(255, 140, 0, 0.2);
    color: #ffd9a3;
}

.fg-neutral {
    background: rgba(180, 180, 180, 0.2);
    color: #f0f0f0;
}

.fg-greed {
    background: rgba(0, 200, 120, 0.2);
    color: #b3ffda;
}

.fg-extreme-greed {
    background: rgba(0, 255, 200, 0.2);
    color: #c1fff3;
}

/* Price change colors */
.price-change-positive {
    color: #00c878;
}

.price-change-negative {
    color: #ff5050;
}

.price-change-neutral {
    color: #cccccc;
}

/* Percentage change classes (reuse price-change colors) */
.pct-pos {
    color: #00c878;
}

.pct-neg {
    color: #ff5050;
}

/* Market Context (Global) styles */
.market-context-section {
    margin-bottom: 8px;
}

.market-context-item {
    font-size: 0.9rem;
    color: #fff;
    margin-bottom: 4px;
    line-height: 1.5;
}

.market-context-item strong {
    color: #fff;
    font-weight: 600;
}

.market-context-change {
    font-size: 0.9rem;
    margin-left: 4px;
}

.market-context-change-positive {
    color: #00c878;
}

.market-context-change-negative {
    color: #ff5050;
}

.market-context-feargreed-value-line {
    font-size: 0.95rem;
    color: #fff;
    margin-top: 4px;
    font-weight: 500;
}

.market-context-source {
    font-size: 0.85rem;
    color: #888;
    margin-top: 4px;
}

/* Fear & Greed classes for Market Context */
.feargreed-extreme-fear {
    background: rgba(255, 80, 80, 0.15);
    color: #ffb3b3;
}

.feargreed-fear {
    background: rgba(255, 140, 0, 0.15);
    color: #ffd9a3;
}

.feargreed-neutral {
    background: rgba(180, 180, 180, 0.15);
    color: #f0f0f0;
}

.feargreed-greed {
    background: rgba(0, 200, 120, 0.15);
    color: #b3ffda;
}

.feargreed-extreme-greed {
    background: rgba(0, 255, 200, 0.15);
    color: #c1fff3;
}

/* News importance tags */
.news-tag {
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 4px;
    margin-right: 6px;
    font-weight: 600;
    text-transform: uppercase;
}

.news-high {
    background: rgba(255, 80, 80, 0.2);
    color: #ffb3b3;
}

.news-medium {
    background: rgba(255, 200, 0, 0.2);
    color: #ffe9a3;
}

.news-low {
    background: rgba(180, 180, 180, 0.2);
    color: #f0f0f0;
}

/* Signal primary (top signal) */
.signal-item--primary {
    box-shadow: 0 0 8px rgba(74, 158, 255, 0.3);
    background: #2f2f2f;
}

.signal-item--primary::before {
    width: 4px; /* Thicker accent for primary */
}

.signal-item--primary.long {
    box-shadow: 0 0 8px rgba(74, 158, 255, 0.3);
}

.signal-item--primary.short {
    box-shadow: 0 0 8px rgba(255, 80, 80, 0.3);
}

/* Global Assessment styles */
/* SH-WEB-T30: Ensure normal flow, no absolute positioning */
#global-assessment {
    position: relative; /* SH-WEB-T30: Normal flow, establish stacking context */
    margin-top: 16px; /* SH-WEB-T30: Ensure proper spacing from digest-content */
    padding-top: 16px; /* SH-WEB-T30: Visual separation */
    border-top: 1px solid rgba(255, 255, 255, 0.08); /* SH-WEB-T30: Visual separator */
    isolation: isolate; /* SH-WEB-T30: Prevent z-index leakage */
}

.global-assessment {
    position: relative; /* SH-WEB-T30: Normal flow, establish stacking context */
    padding: 8px 10px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.06);
    font-size: 0.9rem;
    z-index: 0; /* SH-WEB-T30: Ensure it stays in normal stacking order */
}

.global-assessment-title {
    position: relative; /* SH-WEB-T30: Normal flow */
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    opacity: 0.7;
    margin-bottom: 4px;
    margin-top: 0; /* SH-WEB-T30: Ensure no negative margin */
    color: #4a9eff;
    z-index: 0; /* SH-WEB-T30: Normal stacking order */
    overflow-wrap: anywhere; /* SH-WEB-T30: Prevent text overflow */
}

.global-assessment-main {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-bottom: 6px;
}

.global-bias-tag {
    font-weight: 700;
}

.global-score {
    font-size: 0.85rem;
    opacity: 0.8;
    color: #b0b0b0;
}

.global-reasons {
    margin-top: 6px;
    font-size: 0.8rem;
    opacity: 0.85;
    color: #b0b0b0;
    padding-left: 16px;
}

.global-reasons li {
    margin-bottom: 2px;
}

.global-zone {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 4px;
    margin-bottom: 6px;
}

.global-zone-label {
    font-size: 0.85rem;
    opacity: 0.7;
    color: #b0b0b0;
}

.global-assessment-sources {
    margin-top: 0.25rem;
    font-size: 0.75rem;
    color: #888;
}

.squeeze-zone-tag {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.squeeze-zone-low {
    background: rgba(120, 140, 160, 0.2);
    color: #9bb5d4;
    border: 1px solid rgba(120, 140, 160, 0.3);
}

.squeeze-zone-watchlist {
    background: rgba(74, 158, 255, 0.2);
    color: #8ac4ff;
    border: 1px solid rgba(74, 158, 255, 0.3);
}

.squeeze-zone-high {
    background: rgba(255, 152, 0, 0.2);
    color: #ffb347;
    border: 1px solid rgba(255, 152, 0, 0.3);
}

.squeeze-zone-critical {
    background: rgba(255, 80, 80, 0.2);
    color: #ff8a8a;
    border: 1px solid rgba(255, 80, 80, 0.3);
}

/* Last update indicator */
.last-update-container {
    margin-bottom: var(--section-gap);
    text-align: center;
    padding: 6px;
}

#last-update-indicator {
    font-size: 0.85rem;
    color: #888;
    opacity: 0.8;
}

/* Embed header line */
.embed-header-line {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
}

.embed-header-line strong {
    color: #4a9eff;
}

.embed-header-line span:not(.tag) {
    color: #b0b0b0;
    font-size: 0.85rem;
}

/* SH-WEB-UI-LIVE-SNAPSHOT-01 — Live Market Snapshot embed visual polish */
.embed-root {
    color: #e6edf3;
    font-variant-numeric: tabular-nums;
}

/* SH-WEB-UI-LIVE-SNAPSHOT-BG-GRAY-01: restore neutral gray background for Live Market Snapshot embed */
.embed-root .embed-section {
    background: #252525;
    border-color: rgba(255, 255, 255, 0.06);
    box-shadow: none;
}

.embed-root .embed-header {
    letter-spacing: 0.02em;
}

.embed-root .embed-section-title {
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
    color: rgba(138, 196, 255, 0.85);
}

.embed-root #embed-signal .embed-section-title,
.embed-root #embed-whale .embed-section-title {
    color: rgba(230, 237, 243, 0.75);
}

.embed-root .embed-item-compact {
    color: rgba(230, 237, 243, 0.72);
    font-weight: 500;
}

.embed-root .embed-item-compact.positive {
    color: rgba(120, 205, 150, 0.9);
}

.embed-root .embed-item-compact.negative {
    color: rgba(230, 120, 120, 0.9);
}

.embed-root .embed-price {
    color: #8ac4ff;
    font-weight: 700;
    letter-spacing: 0.01em;
}

.embed-root #embed-digest .embed-digest-compact > .embed-item-compact {
    position: relative;
}

.embed-root #embed-digest .embed-digest-compact > .embed-item-compact:nth-child(2)::before,
.embed-root #embed-digest .embed-digest-compact > .embed-item-compact:nth-child(4)::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: -4px;
    height: 1px;
    background: rgba(255, 255, 255, 0.08);
}

.embed-root #embed-digest .embed-digest-compact > .embed-item-compact:nth-last-child(-n + 2) {
    color: rgba(230, 237, 243, 0.55);
}

/* SH-WEB-UI-LIVE-SNAPSHOT-TITLE-GRAY-01 — Match market-cap gray pill style for embed header */
#embed-header {
    background: #252525;
    color: #e0e0e0;
    border-radius: 8px;
    box-shadow: inset 0 0 0 1px #3a3a3a;
}

/* SH-WEB-UI-LIVE-SNAPSHOT-POLISH-01 — Soften borders + dark scrollbar (embed only) */
.embed-root .embed-section,
.embed-root .embed-header {
    border-color: rgba(255, 255, 255, 0.06);
}

.embed-root *::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.embed-root *::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.03);
}

.embed-root *::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.14);
    border-radius: 10px;
    border: 2px solid rgba(0, 0, 0, 0);
    background-clip: padding-box;
}

.embed-root {
    scrollbar-color: rgba(255, 255, 255, 0.14) rgba(255, 255, 255, 0.03);
    scrollbar-width: thin;
}

.embed-root #embed-signal,
.embed-root #embed-whale {
    position: relative;
    overflow: hidden;
}

.embed-root #embed-signal::before,
.embed-root #embed-whale::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 2px;
    border-radius: 2px 0 0 2px;
    background: rgba(120, 140, 160, 0.35);
    pointer-events: none;
}

.embed-root #embed-signal::before {
    background: rgba(120, 140, 160, 0.35);
}

.embed-root #embed-whale::before {
    background: rgba(120, 140, 160, 0.35);
}

.embed-root *::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.04);
}

.embed-root *::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.18);
    border-radius: 10px;
}

.embed-root {
    scrollbar-color: rgba(255, 255, 255, 0.18) rgba(255, 255, 255, 0.04);
}

.embed-zone-label {
    font-size: 0.85rem;
    padding: 2px 6px;
    border-radius: 3px;
    font-weight: 500;
}

.embed-zone-label.squeeze-zone-low {
    color: #888;
    opacity: 0.7;
}

.embed-zone-label.squeeze-zone-watchlist {
    color: #8ac4ff;
    background: rgba(74, 158, 255, 0.15);
}

.embed-zone-label.squeeze-zone-high {
    color: #ffb347;
    background: rgba(255, 152, 0, 0.15);
}

.embed-zone-label.squeeze-zone-critical {
    color: #ff8a8a;
    background: rgba(255, 80, 80, 0.15);
}

/* Polymarket styles */
.polymarket-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.polymarket-item {
    /* Base styles inherited from .ui-card */
    margin-top: var(--item-gap);
    font-size: var(--text-size-small);
    line-height: var(--line-height-tight);
    overflow: hidden; /* prevents accent bar rounding glitches */
}

.polymarket-item:first-child {
    margin-top: 0;
}

.polymarket-title-line {
    font-weight: 500;
    margin-bottom: 6px;
}

.polymarket-link {
    font-size: 0.8rem;
    text-decoration: underline;
    color: #4a9eff;
    margin-top: 0.2rem;
    display: inline-block;
}

.polymarket-link:hover {
    color: #3a8eef;
}

/* Macro event banner */
.macro-banner {
    margin: 15px 0;
    padding: var(--card-padding) var(--card-padding);
    border-radius: 6px;
    border-left: 4px solid;
    background: rgba(255, 255, 255, 0.05);
    font-size: 0.95rem;
}

.macro-banner.macro-normal {
    border-left-color: #4a9eff;
    color: #b0d5ff;
}

.macro-banner.macro-warning {
    border-left-color: #ffa500;
    color: #ffd699;
    background: rgba(255, 165, 0, 0.1);
}

.macro-banner.macro-urgent {
    border-left-color: #ff4444;
    color: #ffaaaa;
    background: rgba(255, 68, 68, 0.15);
    animation: pulse-urgent 2s ease-in-out infinite;
}

@keyframes pulse-urgent {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.8;
    }
}

.macro-banner-content {
    display: flex;
    align-items: center;
    gap: 8px;
}

.macro-banner strong {
    color: inherit;
    font-weight: 600;
}

.macro-banner-main {
    font-size: 0.9rem;
}

.macro-banner-secondary {
    margin-top: 2px;
    font-size: 0.75rem;
    color: #aaaaaa;
}

/* Demo data note */
.preview-demo-note {
    margin-top: 8px;
    font-size: 11px;
    opacity: 0.65;
    text-align: right;
    color: #888;
    font-style: italic;
}

/* Error banner */
.preview-error-banner {
    margin: 0 2rem 1rem 2rem;
    padding: 0.6rem 0.9rem;
    border-radius: 6px;
    background: rgba(200, 60, 60, 0.15);
    border: 1px solid rgba(200, 60, 60, 0.6);
    color: #ffb3b3;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.preview-error-banner span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.preview-error-close {
    background: transparent;
    border: none;
    color: inherit;
    cursor: pointer;
    font-size: 1.1rem;
    padding: 0 0.2rem;
}

.preview-info-banner {
    margin: 0 2rem 1rem 2rem;
    padding: 0.6rem 0.9rem;
    border-radius: 6px;
    background: rgba(73, 158, 255, 0.15);
    border: 1px solid rgba(73, 158, 255, 0.6);
    color: #b3d9ff;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.preview-info-banner span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.preview-info-close {
    background: transparent;
    border: none;
    color: inherit;
    cursor: pointer;
    font-size: 1.1rem;
    padding: 0 0.2rem;
}

.preview-hidden {
    display: none !important;
}

/* Shared profile banner (T15) */
.shared-profile-banner {
    margin: 0 2rem 1rem 2rem;
    padding: 0.75rem 1rem;
    border-radius: 6px;
    background: rgba(74, 158, 255, 0.15);
    border: 1px solid rgba(74, 158, 255, 0.4);
    color: #b0d5ff;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.shared-profile-banner strong {
    color: #fff;
    font-weight: 600;
}

.shared-profile-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

.shared-profile-actions .toggle-btn {
    font-size: 0.85rem;
    padding: 6px 12px;
    min-width: auto;
}

/* SH-WEB-T26/T27 - Disclaimer as fixed overlay (does not affect layout) */
/* DO NOT place this disclaimer inside the grid; it must remain overlay to avoid layout collapse. */
.preview-footer {
    /* Footer container - no layout impact since disclaimer is position:fixed */
    margin: 0;
    padding: 0;
    border: none;
    height: 0;
    overflow: visible;
}

.preview-disclaimer {
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    bottom: 10px;
    pointer-events: none;
    z-index: 50;
    max-width: min(900px, 90vw);
    text-align: center;
    font-size: 11px;
    opacity: 0.6;
    padding: 6px 10px;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px); /* Safari support */
    color: #858cab;
    line-height: 1.4;
}

/* Top Movers styles */
.topmovers-section {
    margin-top: 10px;
}

.topmovers-section-title {
    font-size: 0.85rem;
    color: #aaa;
    margin: 6px 0;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.topmover-item {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: calc(var(--item-gap) * 0.75) 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    gap: var(--item-gap);
}

.topmover-item:last-child {
    border-bottom: none;
}

.topmover-left {
    flex: 1;
    min-width: 0; /* Allow flex item to shrink below content size */
}

.topmover-name {
    font-weight: 600;
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #e0e0e0;
}

.topmover-price-row {
    font-size: 0.85rem;
    color: #888;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.topmover-change {
    font-weight: 500;
}

/* Contextual price highlighting for Top Movers */
.movers-price {
    font-variant-numeric: tabular-nums;
}

.movers-price--gainer {
    font-weight: 500;
    opacity: 0.95;
}

.movers-price--loser {
    font-weight: 400;
    opacity: 0.75;
}

.topmover-right {
    text-align: right;
    font-size: 0.85rem;
    color: #888;
    flex-shrink: 0;
    min-width: fit-content;
}

.topmover-stat {
    margin-bottom: 2px;
    white-space: nowrap;
}

.topmover-stat:last-child {
    margin-bottom: 0;
}

/* Panel info icon styles */
.panel-info-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 1px solid rgba(74, 158, 255, 0.5);
    background: transparent;
    color: #4a9eff;
    font-size: 12px;
    font-weight: 600;
    font-style: normal;
    cursor: pointer;
    padding: 0;
    margin: 0;
    flex-shrink: 0;
    transition: background 0.2s, border-color 0.2s;
    line-height: 1;
}

.panel-info-btn:hover {
    background: rgba(74, 158, 255, 0.15);
    border-color: #4a9eff;
}

.panel-info-btn:focus {
    outline: 2px solid #4a9eff;
    outline-offset: 2px;
}

.panel-info-btn:active {
    background: rgba(74, 158, 255, 0.25);
}

/* Tooltip styles */
.panel-tooltip {
    position: fixed;
    z-index: 10000;
    max-width: 320px;
    padding: 10px 12px;
    background: #2a2a2a;
    border: 1px solid #3a3a3a;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    pointer-events: none;
    animation: tooltipFadeIn 0.15s ease-out;
}

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

.panel-tooltip-title {
    font-weight: 600;
    color: #4a9eff;
    font-size: 0.9rem;
    margin-bottom: 6px;
}

.panel-tooltip-desc {
    color: #e0e0e0;
    font-size: 0.85rem;
    line-height: 1.4;
}

/* Stablecoin Flows panel styles */
.stablecoin-flows-controls {
    padding: 0.75rem 1rem;
    background: #1f1f1f;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    margin-bottom: 0.5rem;
}

.stablecoin-flows-control-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 6px;
}

.stablecoin-flows-control-row label {
    font-size: 0.85rem;
    color: #b0b0b0;
    white-space: nowrap;
}

.stablecoin-flows-control-row select {
    padding: 4px 8px;
    background: #2a2a2a;
    border: 1px solid #3a3a3a;
    border-radius: 4px;
    color: #e0e0e0;
    font-size: 0.85rem;
    min-width: 80px;
}

.stablecoin-flows-control-row select:focus {
    outline: none;
    border-color: #4a9eff;
}

.stablecoin-flows-control-row input[type="checkbox"] {
    margin-right: 4px;
    cursor: pointer;
}

.stablecoin-flows-control-row input[type="checkbox"]:focus {
    outline: 2px solid #4a9eff;
    outline-offset: 2px;
}

/* Currency toggle (All/USDT/USDC) */
.stablecoin-flows-currency-toggle {
    display: flex;
    gap: 4px;
    margin-right: 8px;
}

.stablecoin-flows-currency-btn {
    padding: 4px 12px;
    background: #2a2a2a;
    border: 1px solid #3a3a3a;
    border-radius: 4px;
    color: #e0e0e0;
    font-size: 0.85rem;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.2s, border-color 0.2s;
    min-width: 60px;
}

.stablecoin-flows-currency-btn:hover {
    background: #3a3a3a;
    border-color: #4a9eff;
}

.stablecoin-flows-currency-btn[aria-pressed="true"],
.stablecoin-flows-currency-btn.toggle-btn--active {
    background: #4a9eff;
    color: white;
    border-color: #4a9eff;
}

.stablecoin-flows-currency-btn[aria-pressed="true"]:hover,
.stablecoin-flows-currency-btn.toggle-btn--active:hover {
    background: #3a8eef;
}

.stablecoin-flows-currency-btn:active {
    background: #2a7edf;
}

.stablecoin-flows-currency-btn:focus-visible {
    outline: 2px solid #4a9eff;
    outline-offset: 2px;
}

.stablecoin-flows-refresh-btn {
    padding: 4px 12px;
    background: #2a2a2a;
    border: 1px solid #3a3a3a;
    border-radius: 4px;
    color: #e0e0e0;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
    margin-left: auto;
}

.stablecoin-flows-refresh-btn:hover {
    background: #3a3a3a;
    border-color: #4a9eff;
}

.stablecoin-flows-refresh-btn:focus {
    outline: 2px solid #4a9eff;
    outline-offset: 2px;
}

.stablecoin-flows-refresh-btn:active {
    background: #2a2a2a;
}

.stablecoin-flows-status {
    font-size: 0.75rem;
    color: #888;
    margin-top: 4px;
}

.stablecoin-flows-hint {
    font-size: 0.75rem;
    color: #888;
    margin-top: 6px;
    font-style: italic;
}

/* Whales panel controls - matching Stablecoin Flows pattern */
.whales-controls {
    padding: 0.75rem 1rem;
    background: #1f1f1f;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    margin-bottom: 0.5rem;
}

.whales-control-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 6px;
}

.whales-control-row label {
    font-size: 0.85rem;
    color: #b0b0b0;
    white-space: nowrap;
}

.whales-control-row select {
    padding: 4px 8px;
    background: #2a2a2a;
    border: 1px solid #3a3a3a;
    border-radius: 4px;
    color: #e0e0e0;
    font-size: 0.85rem;
    min-width: 80px;
}

.whales-control-row select:focus {
    outline: none;
    border-color: #4a9eff;
}

/* Direction toggle (All/Inflow/Outflow) */
.whales-direction-toggle {
    display: flex;
    gap: 4px;
    margin-right: 8px;
}

.whales-direction-btn {
    padding: 4px 12px;
    background: #2a2a2a;
    border: 1px solid #3a3a3a;
    border-radius: 4px;
    color: #e0e0e0;
    font-size: 0.85rem;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.2s, border-color 0.2s;
    min-width: 60px;
}

.whales-direction-btn:hover {
    background: #3a3a3a;
    border-color: #4a9eff;
}

.whales-direction-btn[aria-pressed="true"],
.whales-direction-btn.toggle-btn--active {
    background: #4a9eff;
    color: white;
    border-color: #4a9eff;
}

.whales-direction-btn[aria-pressed="true"]:hover,
.whales-direction-btn.toggle-btn--active:hover {
    background: #3a8eef;
}

.whales-direction-btn:active {
    background: #2a7edf;
}

.whales-direction-btn:focus-visible {
    outline: 2px solid #4a9eff;
    outline-offset: 2px;
}

.whales-refresh-btn {
    padding: 4px 12px;
    background: #2a2a2a;
    border: 1px solid #3a3a3a;
    border-radius: 4px;
    color: #e0e0e0;
    font-size: 0.85rem;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.2s, border-color 0.2s;
}

.whales-refresh-btn:hover {
    background: #3a3a3a;
    border-color: #4a9eff;
}

.whales-refresh-btn:focus {
    outline: 2px solid #4a9eff;
    outline-offset: 2px;
}

.whales-refresh-btn:active {
    background: #2a2a2a;
}

.whales-status {
    font-size: 0.75rem;
    color: #888;
    margin-top: 4px;
}

.whales-hint {
    font-size: 0.75rem;
    color: #888;
    margin-top: 6px;
    font-style: italic;
}

.stablecoin-flow-card {
    /* Base styles inherited from .ui-card */
    margin-top: var(--item-gap);
}

.stablecoin-flow-card:first-child {
    margin-top: 0;
}

.stablecoin-flow-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
}

.stablecoin-flow-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 120px;
    max-width: 120px;
    padding: 6px 10px;
    border-radius: 6px;
    border: 1px solid rgba(73, 158, 255, 0.35);
    background: rgba(73, 158, 255, 0.12);
    color: #4da3ff;
    font-weight: 600;
    font-size: 12px;
    letter-spacing: 0.2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.stablecoin-flow-time {
    color: rgba(255,255,255,0.65);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    cursor: help;
}

.stablecoin-flow-card-mid {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 6px;
}

.stablecoin-flow-amount {
    font-weight: 700;
    font-size: 18px;
    white-space: nowrap;
}

.stablecoin-flow-card-sub {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.stablecoin-flow-subtext {
    color: rgba(255,255,255,0.7);
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.stablecoin-flow-tx {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    background: #2a2a2a;
    border: 1px solid #3a3a3a;
    border-radius: 4px;
    color: #4a9eff;
    font-size: 0.8rem;
    text-decoration: none;
    transition: background 0.2s, border-color 0.2s;
    white-space: nowrap;
    min-width: 36px;
    text-align: center;
    justify-content: center;
    cursor: pointer;
}

.stablecoin-flow-tx:hover {
    background: #3a3a3a;
    border-color: #4a9eff;
}

.stablecoin-flow-tx:focus {
    outline: 2px solid #4a9eff;
    outline-offset: 2px;
}

.stablecoin-flow-exchange-tag {
    display: inline-flex;
    align-items: center;
    padding: 2px 6px;
    background: rgba(255, 193, 7, 0.15);
    border: 1px solid rgba(255, 193, 7, 0.3);
    border-radius: 3px;
    color: #ffc107;
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
    text-transform: uppercase;
    margin-left: 6px;
}

.stablecoin-flow-exchange-tag.tag-exchange {
    /* Ensure consistent styling when tag class is also present */
    background: rgba(255, 193, 7, 0.15);
    border: 1px solid rgba(255, 193, 7, 0.3);
    color: #ffc107;
}

.stablecoin-flow-from-to {
    font-size: 0.8rem;
    color: #999;
    margin-top: 4px;
    padding-left: 0;
}

/* SH-WEB-TXX - Stablecoin Flows: Improved readability - higher contrast, better typography */
.stablecoin-flow-card {
    /* Better contrast vs panel background (#252525) */
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 8px;
    padding: 10px 12px;
    margin: 8px 0;
    /* Typography */
    font-size: 12.5px;
    line-height: 1.45;
    color: rgba(255, 255, 255, 0.88);
}

/* Hover state: ensure hover is lighter than base */
.stablecoin-flow-card:hover {
    background: rgba(255, 255, 255, 0.06);
}

/* Header row (pill + time) - ensure proper spacing */
.stablecoin-flow-card-top {
    margin-bottom: 6px;
}

/* Pill badge styling */
.stablecoin-flow-badge {
    font-size: 12px;
    padding: 3px 8px;
    border-radius: 999px;
    background: rgba(80, 140, 255, 0.18);
    border: 1px solid rgba(80, 140, 255, 0.35);
    color: rgba(220, 235, 255, 0.95);
    letter-spacing: 0.2px;
}

/* Timestamp styling */
.stablecoin-flow-time {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.55);
}

/* Improve WHAT/WHY label visibility */
.stablecoin-flow-card .narrative-key {
    color: rgba(255, 255, 255, 0.70);
    font-weight: 600;
}

/* Improve narrative line readability */
.stablecoin-flow-card .narrative-line {
    font-size: 12.5px;
    line-height: 1.45;
    color: rgba(255, 255, 255, 0.92);
    margin: 5px 0;
}

/* Values/important words */
.stablecoin-flow-amount {
    color: rgba(255, 255, 255, 0.92);
}

/* Improve subtext readability */
.stablecoin-flow-subtext {
    font-size: 12.5px;
    color: rgba(255, 255, 255, 0.70);
    line-height: 1.45;
}

/* SH-WEB-T70 - Stablecoin Flows: scrollbar properties unified above, ensure padding */
.dashboard-row--bottom #panel-flows.panel--scroll .card-content {
    padding-right: 8px; /* Account for scrollbar width */
    overscroll-behavior: auto;
    scrollbar-gutter: stable;
}

/* Explicit scrollbar styling for #stablecoin-flows-content to match #whales-content exactly */
/* Firefox scrollbar */
#stablecoin-flows-content {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

/* WebKit scrollbar styling - match unified styles exactly */
#stablecoin-flows-content::-webkit-scrollbar {
    width: 8px;
}

#stablecoin-flows-content::-webkit-scrollbar-track {
    background: transparent;
}

#stablecoin-flows-content::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.18);
    border-radius: 8px;
    border: 2px solid transparent;
    background-clip: content-box;
}

#stablecoin-flows-content::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.25);
    background-clip: content-box;
}

.tx-btn {
    display: inline-flex;
    align-items: center;
    padding: 2px 8px;
    background: #2a2a2a;
    border: 1px solid #3a3a3a;
    border-radius: 4px;
    color: #4a9eff;
    font-size: 0.8rem;
    text-decoration: none;
    transition: background 0.2s, border-color 0.2s;
    white-space: nowrap;
    min-width: 36px;
    width: 36px;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
}

.tx-btn:hover {
    background: #3a3a3a;
    border-color: #4a9eff;
}

.tx-btn:focus {
    outline: 2px solid #4a9eff;
    outline-offset: 2px;
}

.tx-btn--disabled {
    opacity: 0.4;
    cursor: not-allowed;
    color: #666;
    background: #2a2a2a;
    border-color: #2a2a2a;
}

.tx-btn--disabled:focus {
    outline: none;
}

.tx-btn--disabled:hover {
    background: #2a2a2a;
    border-color: #2a2a2a;
}

/* X Signal card styles (matching Signals exactly) */
.x-signal-card {
    /* Base styles inherited from .ui-card */
    margin-bottom: var(--item-gap);
}

.x-signal-card:first-child {
    margin-top: 0;
}

/* X Signal text styles for readability */
.x-signal-text {
    color: #fff;
    line-height: 1.35;
}

.x-signal-raw-text {
    max-height: 4.5em; /* ~3 lines */
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.x-signal-raw-text.expanded {
    max-height: none;
}

.x-signal-show-more {
    display: inline-block;
    margin-top: 6px;
    padding: 2px 6px;
    background: transparent;
    border: none;
    color: #4a9eff;
    font-size: 0.8rem;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.x-signal-show-more:hover {
    color: #3a8eef;
}

.x-signal-show-more:focus-visible {
    outline: var(--focus-ring);
    outline-offset: 2px;
    border-radius: 2px;
}

.x-signal-handle {
    font-size: 0.85rem;
    color: rgba(255,255,255,0.65);
    margin: 2px 0;
}

.x-signal-time {
    color: rgba(255,255,255,0.65);
    font-size: 0.9rem;
}

.x-signal-link {
    color: #fff;
    text-decoration: none;
    line-height: 1.35;
    font-size: 0.9rem;
}

.x-signal-link:hover {
    color: #4a9eff;
    text-decoration: underline;
}

.x-signal-link:focus-visible {
    outline: 2px solid rgba(80, 160, 255, 0.8);
    outline-offset: 2px;
    border-radius: 2px;
}

.x-signal-content {
    margin-top: 4px;
}

/* Micro-polish CSS pour harmoniser avec Polymarket/Stablecoin */
.x-signal-card .x-signal-time {
    font-size: 0.9rem;
    margin-bottom: 6px;
}

.x-signal-card .x-signal-handle {
    font-size: 0.95rem;
    margin-bottom: 8px;
}

.x-signal-card .x-signal-text,
.x-signal-card .x-signal-content {
    font-size: 0.98rem;
    line-height: 1.32;
}

.x-signal-card .x-signal-link {
    font-size: 0.92rem;
    color: rgba(73, 158, 255, 0.95);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.x-signal-card .x-signal-link:hover {
    color: #fff;
}

.x-signal-card .news-header {
    margin-bottom: 8px;
}

/* X Signals header layout (matching Signals exactly) */
.x-signal-card .signal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
}

.x-signal-card .signal-direction {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    font-weight: 600;
    color: #4a9eff;
}

.x-handle {
    font-size: 0.85rem;
    color: rgba(255,255,255,0.65);
    margin: 2px 0;
}

/* Filters Popover Styles */
.filters-popover {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10000;
    background: #252525;
    border: 1px solid #3a3a3a;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
    min-width: 500px;
    max-width: 600px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}

.filters-popover-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--card-padding) calc(var(--card-padding) + 4px);
    border-bottom: 1px solid #3a3a3a;
}

.filters-active-summary {
    padding: calc(var(--card-padding) * 0.75) calc(var(--card-padding) + 4px);
    border-bottom: 1px solid #3a3a3a;
    background: rgba(255, 255, 255, 0.02);
    font-size: 0.85rem;
    color: #b0b0b0;
    min-height: 20px;
}

.filters-active-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.filters-active-chip {
    display: inline-block;
    padding: 3px 8px;
    border-radius: 4px;
    background: rgba(74, 158, 255, 0.15);
    border: 1px solid rgba(74, 158, 255, 0.3);
    color: #4a9eff;
    font-size: 0.8rem;
    font-weight: 500;
    white-space: nowrap;
}

.filters-module-footer {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    display: flex;
    justify-content: flex-end;
}

.filters-reset-btn {
    padding: 6px 12px;
    background: #3a3a3a;
    color: #e0e0e0;
    border: 1px solid #4a4a4a;
    border-radius: 4px;
    font-size: 0.85rem;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.2s, border-color 0.2s;
}

.filters-reset-btn:hover {
    background: #4a4a4a;
    border-color: #4a9eff;
}

.filters-reset-btn:focus-visible {
    outline: var(--focus-ring);
    outline-offset: 2px;
}

.filters-reset-btn:active {
    background: #2a2a2a;
}

.filters-popover-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: #4a9eff;
    margin: 0;
}

.filters-saved-badge {
    font-size: 12px;
    padding: 4px 10px;
    border-radius: 12px;
    background: rgba(74, 158, 255, 0.15);
    color: #4a9eff;
    border: 1px solid rgba(74, 158, 255, 0.3);
    font-weight: 500;
    white-space: nowrap;
}

.filters-saved-badge.is-hidden {
    display: none;
}

.filters-popover-close {
    background: transparent;
    border: none;
    color: #e0e0e0;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    padding: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background 0.2s, color 0.2s;
}

.filters-popover-close:hover {
    background: #3a3a3a;
    color: #fff;
}

.filters-popover-close:focus-visible {
    outline: var(--focus-ring);
    outline-offset: 2px;
}

.filters-popover-content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.filters-popover-footer {
    display: flex;
    justify-content: flex-end;
    padding: var(--card-padding) calc(var(--card-padding) + 4px);
    border-top: 1px solid #3a3a3a;
    gap: 12px;
}

.filters-popover-footer button:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.filters-module-nav {
    display: flex;
    flex-direction: column;
    width: 140px;
    border-right: 1px solid #3a3a3a;
    background: #1f1f1f;
    padding: 12px 0;
    gap: 4px;
}

.filters-module-btn {
    padding: 10px 16px;
    background: transparent;
    border: none;
    color: #b0b0b0;
    text-align: left;
    cursor: pointer;
    font-size: 0.9rem;
    transition: background 0.2s, color 0.2s;
    border-left: 3px solid transparent;
}

.filters-module-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    color: #e0e0e0;
}

.filters-module-btn[aria-current="true"],
.filters-module-btn[aria-selected="true"] {
    background: rgba(74, 158, 255, 0.15);
    color: #4a9eff;
    border-left-color: #4a9eff;
    font-weight: 500;
}

.filters-module-btn:focus-visible {
    outline: var(--focus-ring);
    outline-offset: -2px;
}

.filters-module-panels {
    flex: 1;
    padding: var(--card-padding);
    overflow-y: auto;
    padding-right: calc(var(--card-padding) + 12px); /* SH-WEB-T34: Account for scrollbar width (8px) + extra padding */
    overscroll-behavior: contain;
    scrollbar-gutter: stable; /* Reserve space for scrollbar to prevent layout shift */
    /* Scrollbar styling unified above (see unified scrollbar section) */
}

.filters-module-panel {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.filters-module-control {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.filters-module-control label {
    font-size: 0.9rem;
    color: #b0b0b0;
}

.filters-module-control select {
    padding: 8px 12px;
    background: #2a2a2a;
    border: 1px solid #3a3a3a;
    border-radius: 4px;
    color: #e0e0e0;
    font-size: 0.9rem;
    min-width: 200px;
}

.filters-module-control select:focus {
    outline: none;
    border-color: #4a9eff;
}

.filters-module-control select:focus-visible {
    outline: var(--focus-ring);
    outline-offset: 2px;
}

.filters-module-toggle-group {
    display: flex;
    gap: 4px;
    margin-top: 4px;
}

.filters-module-toggle-group .filters-toggle-btn {
    padding: 6px 12px;
    background: #2a2a2a;
    border: 1px solid #3a3a3a;
    border-radius: 4px;
    color: #e0e0e0;
    font-size: 0.85rem;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.2s, border-color 0.2s;
    min-width: 60px;
}

.filters-module-toggle-group .filters-toggle-btn:hover {
    background: #3a3a3a;
    border-color: #4a9eff;
}

.filters-module-toggle-group .filters-toggle-btn[aria-pressed="true"],
.filters-module-toggle-group .filters-toggle-btn.toggle-btn--active {
    background: #4a9eff;
    color: white;
    border-color: #4a9eff;
}

.filters-module-toggle-group .filters-toggle-btn[aria-pressed="true"]:hover,
.filters-module-toggle-group .filters-toggle-btn.toggle-btn--active:hover {
    background: #3a8eef;
}

.filters-module-toggle-group .filters-toggle-btn:active {
    background: #2a7edf;
}

.filters-module-toggle-group .filters-toggle-btn:focus-visible {
    outline: var(--focus-ring);
    outline-offset: 2px;
}

.filters-module-empty {
    padding: var(--card-padding);
    text-align: center;
    color: #888;
    font-size: 0.9rem;
    font-style: italic;
}

.filters-popover-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    backdrop-filter: blur(2px);
}

/* Unsaved Changes Modal */
.filters-unsaved-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10050;
}

.filters-unsaved-dialog {
    width: min(560px, calc(100% - 32px));
    background: #1f1f1f;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    box-shadow: 0 12px 48px rgba(0, 0, 0, 0.55);
    padding: calc(var(--card-padding) + 2px);
}

.unsaved-changes-modal-content {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.unsaved-changes-text {
    color: #e0e0e0;
    font-size: 0.95rem;
    line-height: 1.5;
    margin: 0;
}

.filters-unsaved-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 14px;
}

.filters-unsaved-actions .toggle-btn {
    min-width: 100px;
}

.filters-unsaved-actions .btn-primary {
    background: #4a9eff;
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.filters-unsaved-actions .btn-primary:hover {
    background: #3a8eef;
}

.filters-unsaved-actions .btn-primary:focus-visible {
    outline: var(--focus-ring);
    outline-offset: 2px;
}

/* SH-WEB-TXNEWS-OEMBED-STYLE-01: oEmbed card polish for X News panel */
.xnews-oembed-item {
    margin: 12px 0;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.02);
    overflow: hidden;
}

.xnews-oembed-inner {
    padding: 12px;
    max-width: 100%;
    overflow: hidden;
}

.xnews-oembed-inner blockquote.twitter-tweet {
    margin: 0 !important;
    max-width: 100% !important;
}

.xnews-oembed-inner iframe,
.xnews-oembed-inner .twitter-tweet,
.xnews-oembed-inner .twitter-tweet-rendered {
    max-width: 100% !important;
}

.xnews-oembed-item--fallback .mono {
    display: block;
    margin-bottom: 8px;
}

/* SH-WEB-TXNEWS-OEMBED-POLISH-02: SaaS layout polish for X embeds */
.xnews-oembed-item {
    padding: 14px;
    display: flex;
    justify-content: center;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
}

.xnews-oembed-inner {
    width: 100%;
    max-width: 620px;
    margin: 0 auto;
}

#panel-xnews .panel-body {
    padding: 6px 6px 12px;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
}

/* SH-WEB-TXNEWS-OEMBED-FIT-03: better fit inside panel */
.xnews-oembed-item {
    margin: 10px 0;
    padding: 10px;
}

.xnews-oembed-inner {
    max-width: clamp(560px, 92%, 820px);
}

#panel-xnews .panel-body,
#panel-x-signals .panel-body,
#panel-x-news .panel-body {
    padding-left: 10px;
    padding-right: 10px;
}

/* SH-WEB-TXNEWS-OEMBED-HOLDLAST-04: panel-native embed + refreshing badge */
.xnews-oembed-item {
    width: 100%;
    box-sizing: border-box;
}

.xnews-oembed-inner {
    width: 100%;
    margin-left: auto;
    margin-right: auto;
}

.xnews-refreshing {
    position: sticky;
    top: 8px;
    float: right;
    margin: 8px 10px 0 0;
    padding: 6px 10px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.10);
    background: rgba(0, 0, 0, 0.35);
    color: rgba(255, 255, 255, 0.75);
    font-size: 12px;
    line-height: 1;
    z-index: 5;
    pointer-events: none;
}

/* SH-WEB-PREVIEWDASH-XPANEL-HEIGHT-05: reduce X panel height on desktop to avoid empty space */
@media (min-width: 900px) {
    #panel-xnews {
        min-height: 360px;
        max-height: 520px;
    }

    #panel-xnews .panel-body {
        overflow-y: auto;
    }
}
/* SH-WEB-TWHALES-EMPTY-COLLAPSE-01: collapse empty intermediate whales layers to remove useless vertical space */
/* SH-WEB-TWHALES-SPACE-ALIGN-12: remove extra gap when status/hint are empty */
#whales-status:empty,
#whales-hint:empty {
  display: none !important;
}

/* Safety: if present but whitespace-only, keep it visually collapsed via zero height */
#whales-status,
#whales-hint {
  min-height: 0;
  margin: 0;
  padding: 0;
}
/* SH-WEB-TWHALES-FLUSH-GAP-17: permanently hide unused whales status/hint layers to prevent layout gaps */
#whales-status,
#whales-hint {
  display: none !important;
}
