/* === Design System === */
:root {
    --bg-body: #0c0c14;
    --bg-card: #151520;
    --bg-card-top: #191926;
    --bg-elevated: #1e1e2c;
    --bg-metric: #111118;
    --bg-hover: #1a1a28;
    --border: #242436;
    --border-subtle: #1c1c2e;
    --border-hover: #5a8fff;
    --text-primary: #f2f2f8;
    --text-secondary: #b0b0c4;
    --text-muted: #7a7a95;
    --green: #00d26a;
    --green-dim: #00b85c;
    --green-bg: rgba(0, 210, 106, 0.08);
    --green-border: rgba(0, 210, 106, 0.18);
    --red: #ff4757;
    --red-dim: #e6394a;
    --red-bg: rgba(255, 71, 87, 0.08);
    --red-border: rgba(255, 71, 87, 0.18);
    --blue: #5a8fff;
    --blue-dim: #4a7de6;
    --blue-bg: rgba(90, 143, 255, 0.08);
    --blue-border: rgba(90, 143, 255, 0.18);
    --purple: #a78bfa;
    --purple-bg: rgba(167, 139, 250, 0.08);
    --yellow: #fbbf24;
    --yellow-bg: rgba(251, 191, 36, 0.08);
    --yellow-border: rgba(251, 191, 36, 0.18);
    --radius: 14px;
    --radius-sm: 10px;
    --radius-xs: 6px;
    --spacing: 14px;
    --header-h: 54px;
    --toolbar-h: 44px;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 20px rgba(0,0,0,0.35);
    --shadow-lg: 0 8px 40px rgba(0,0,0,0.5);
    --shadow-glow-blue: 0 0 24px rgba(90,143,255,0.12);
    --shadow-glow-green: 0 0 24px rgba(0,210,106,0.10);
    --shadow-glow-red: 0 0 24px rgba(255,71,87,0.10);
    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);

    /* Animation timing (SSOT — mirrored in app.js ANIM_* constants) */
    --anim-flip: 400ms;
    --anim-row-highlight: 400ms;
    --anim-row-fade: 800ms;
    --anim-flash: 1500ms;
}

/* === Accessibility: Reduced Motion === */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* Visually hidden (accessible labels) */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* === Reset + Base === */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
    font-family: var(--font);
    background: var(--bg-body);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Ambient glow */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 700px;
    background: radial-gradient(ellipse 70% 50% at 50% -10%, rgba(90,143,255,0.05) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

a { color: var(--blue); text-decoration: none; transition: color var(--transition); }
a:hover { color: #7aa5ff; }

/* Scrollbar */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #2e2e44; }

/* ============================================
   HEADER
   ============================================ */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 0 28px;
    height: var(--header-h);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 50;
    backdrop-filter: blur(20px) saturate(1.3);
    background: rgba(12, 12, 20, 0.88);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.app-header h1 {
    font-size: 1.05rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    background: linear-gradient(135deg, #5a8fff 0%, #a78bfa 50%, #5a8fff 100%);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: shimmer 8s linear infinite;
}

@keyframes shimmer {
    0% { background-position: 0% center; }
    100% { background-position: 200% center; }
}

.live-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px 3px 8px;
    background: var(--green-bg);
    border: 1px solid var(--green-border);
    border-radius: 20px;
}

.live-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--green);
    box-shadow: 0 0 8px rgba(0, 210, 106, 0.6);
    animation: pulse 2s ease-in-out infinite;
}

.live-dot.disconnected {
    background: var(--red);
    box-shadow: 0 0 8px rgba(255, 71, 87, 0.6);
    animation: none;
}

.live-label {
    font-size: 0.62rem;
    font-weight: 700;
    color: var(--green);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.live-dot.disconnected ~ .live-label { color: var(--red); }

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.3; transform: scale(0.75); }
}

/* Logout button */
.btn-logout {
    background: none;
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 4px 14px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.65rem;
    font-weight: 600;
    font-family: var(--font);
    letter-spacing: 0.03em;
    transition: all var(--transition);
}

.btn-logout:hover {
    color: var(--red);
    border-color: var(--red-border);
    background: var(--red-bg);
}

/* Tab Navigation */
.tab-nav {
    display: flex;
    gap: 2px;
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 3px;
}

.tab-btn {
    padding: 4px 13px;
    border: none;
    border-radius: var(--radius-xs);
    background: transparent;
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    font-family: var(--font);
}

.tab-btn:hover { color: var(--text-primary); background: rgba(255,255,255,0.05); }

.tab-btn.active {
    background: var(--blue);
    color: #fff;
    box-shadow: 0 2px 10px rgba(90, 143, 255, 0.35);
}

/* Search */
.header-search {
    position: relative;
    width: 300px;
}

.header-search .search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
    transition: color var(--transition);
}

.header-search input {
    width: 100%;
    padding: 7px 14px 7px 36px;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.78rem;
    font-family: var(--font);
    outline: none;
    transition: all var(--transition);
}

.header-search input::placeholder { color: var(--text-muted); }
.header-search input:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(90, 143, 255, 0.08);
    background: var(--bg-card);
}

/* ============================================
   TOOLBAR
   ============================================ */
.toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 28px;
    border-bottom: 1px solid var(--border);
    background: rgba(12, 12, 20, 0.7);
    backdrop-filter: blur(12px);
    flex-wrap: wrap;
    position: sticky;
    top: var(--header-h);
    z-index: 40;
}

.time-filters {
    display: flex;
    gap: 2px;
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 3px;
}

.time-btn {
    padding: 4px 13px;
    border: none;
    border-radius: var(--radius-xs);
    background: transparent;
    color: var(--text-muted);
    font-size: 0.72rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
}

.time-btn:hover { color: var(--text-primary); background: rgba(255,255,255,0.05); }

.time-btn.active {
    background: var(--blue);
    color: #fff;
    box-shadow: 0 2px 10px rgba(90, 143, 255, 0.35);
}

.toolbar select {
    background: rgba(255,255,255,0.03);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    padding: 5px 28px 5px 12px;
    border-radius: var(--radius-sm);
    font-size: 0.74rem;
    font-weight: 500;
    font-family: var(--font);
    cursor: pointer;
    outline: none;
    transition: all var(--transition);
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%237a7a95' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
}

.toolbar select:hover { border-color: #333348; color: var(--text-primary); }
.toolbar select:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(90,143,255,0.08); }
.toolbar select option {
    background: var(--bg-card);
    color: var(--text-primary);
}

/* ============================================
   STATS BAR
   ============================================ */
.stats-bar {
    display: flex;
    gap: 6px;
    padding: 10px 28px;
    border-bottom: 1px solid var(--border);
    font-size: 0.75rem;
    color: var(--text-secondary);
    background: rgba(12, 12, 20, 0.6);
    overflow-x: auto;
    position: relative;
    z-index: 1;
    backdrop-filter: blur(8px);
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    padding: 6px 16px 6px 10px;
    background: rgba(255,255,255,0.02);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-subtle);
    transition: all var(--transition);
}

.stat-item:hover {
    border-color: var(--border);
    background: rgba(255,255,255,0.04);
}

.stat-item .stat-label {
    color: var(--text-muted);
    font-size: 0.64rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.stat-item .stat-value {
    color: var(--text-primary);
    font-weight: 700;
    font-size: 0.82rem;
    font-variant-numeric: tabular-nums;
}

.stat-item .stat-value.pnl-pos { color: var(--green); }
.stat-item .stat-value.pnl-neg { color: var(--red); }

.stat-item .stat-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 7px;
    flex-shrink: 0;
}

.stat-icon.icon-tokens { background: var(--blue-bg); color: var(--blue); }
.stat-icon.icon-alerts { background: var(--purple-bg); color: var(--purple); }
.stat-icon.icon-volume { background: var(--yellow-bg); color: var(--yellow); }
.stat-icon.icon-pnl { background: var(--green-bg); color: var(--green); }
.stat-icon.icon-pnl.negative { background: var(--red-bg); color: var(--red); }
.stat-icon.icon-wallets { background: rgba(255,255,255,0.04); color: var(--text-secondary); }

/* ============================================
   CARD GRID
   ============================================ */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(440px, 1fr));
    gap: 18px;
    padding: 22px 28px;
    position: relative;
    z-index: 1;
}

/* ============================================
   TOKEN CARD
   ============================================ */
.token-card {
    background: linear-gradient(180deg, var(--bg-card-top) 0%, var(--bg-card) 100%);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    cursor: pointer;
    box-shadow: 0 1px 4px rgba(0,0,0,0.15);
}

.token-card[draggable="true"] {
    -webkit-user-drag: element;
}

.token-card:hover {
    border-color: rgba(90, 143, 255, 0.2);
    box-shadow: var(--shadow-md), var(--shadow-glow-blue);
    transform: translateY(-3px);
}

/* PnL accent stripe */
.token-card.pnl-positive { border-top: 2px solid var(--green); }
.token-card.pnl-positive:hover { box-shadow: var(--shadow-md), var(--shadow-glow-green); }
.token-card.pnl-negative { border-top: 2px solid var(--red); }
.token-card.pnl-negative:hover { box-shadow: var(--shadow-md), var(--shadow-glow-red); }
.token-card.pnl-neutral { border-top: 2px solid var(--border); }

/* Flash on SSE update */
.token-card.flash {
    border-color: var(--blue);
    box-shadow: 0 0 32px rgba(90, 143, 255, 0.2);
}

/* --- Card Header --- */
.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px 10px;
    gap: 8px;
    border-bottom: 1px solid rgba(255,255,255,0.03);
}

.card-token-info {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

/* Chart link on card header */
a.card-chart-link {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    color: inherit;
    text-decoration: none;
    cursor: pointer;
    border-radius: var(--radius-xs);
    padding: 4px 6px;
    margin: -4px -6px;
    transition: background var(--transition);
}
a.card-chart-link:hover {
    background: rgba(255, 255, 255, 0.04);
    color: inherit;
}
a.card-chart-link:hover .symbol {
    color: var(--blue);
}

.token-img-wrap {
    position: relative;
    width: 38px;
    height: 38px;
    flex-shrink: 0;
}

.token-img {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    object-fit: cover;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: 2px solid rgba(255,255,255,0.08);
    background: var(--bg-elevated);
}

.token-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.9rem;
    color: #fff;
    flex-shrink: 0;
    text-transform: uppercase;
    letter-spacing: -0.02em;
}

.token-img:hover {
    position: absolute;
    width: 130px;
    height: 130px;
    border-radius: 12px;
    z-index: 1000;
    box-shadow: var(--shadow-lg);
    top: -10px;
    left: -10px;
    border: none;
}

.card-token-info .symbol {
    font-weight: 800;
    font-size: 0.92rem;
    white-space: nowrap;
    letter-spacing: -0.01em;
}

.card-token-info .name {
    color: var(--text-muted);
    font-size: 0.7rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 140px;
}

.card-addr {
    font-family: var(--font-mono);
    font-size: 0.6rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition);
    padding: 2px 7px;
    border-radius: 4px;
    background: rgba(255,255,255,0.03);
    border: 1px solid transparent;
}

.card-addr:hover {
    color: var(--blue);
    background: var(--blue-bg);
    border-color: var(--blue-border);
}

.card-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

/* Badges */
.chain-badge,
.badge-new {
    display: inline-flex;
    align-items: center;
    padding: 3px 9px;
    border-radius: 6px;
    font-size: 0.58rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.badge-new {
    background: var(--green-bg);
    color: var(--green);
    border: 1px solid var(--green-border);
    animation: pulse-new 2s ease-in-out infinite;
}

@keyframes pulse-new {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.chain-solana { background: rgba(153,69,255,0.1); color: #b380ff; border: 1px solid rgba(153,69,255,0.2); }
.chain-base { background: rgba(0,82,255,0.1); color: #6699ff; border: 1px solid rgba(0,82,255,0.2); }
.chain-bsc { background: rgba(243,186,47,0.1); color: #F3BA2F; border: 1px solid rgba(243,186,47,0.2); }
.chain-ethereum { background: rgba(98,126,234,0.1); color: #99aaee; border: 1px solid rgba(98,126,234,0.2); }

/* --- Social Links (inline with token name) --- */
.social-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 4px;
    font-size: 0.65rem;
    color: var(--text-secondary);
    background: rgba(255,255,255,0.06);
    border: 1px solid var(--border);
    transition: all var(--transition);
    text-decoration: none;
    flex-shrink: 0;
    line-height: 1;
    margin-left: 4px;
}

a.social-link:hover {
    color: var(--blue);
    border-color: var(--blue-border);
    background: var(--blue-bg);
}

/* --- Tweet Preview Tooltip (rich embed) --- */
.tweet-preview {
    position: fixed;
    z-index: 200;
    pointer-events: none;
    opacity: 0;
    transform: translateY(4px);
    transition: opacity 0.18s ease, transform 0.18s ease;
    overflow: hidden;
    border-radius: 0 0 var(--radius) var(--radius);
}

.tweet-preview.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.tweet-card {
    background: #16181c;
    border: 1px solid #2f3336;
    border-radius: 0 0 var(--radius) var(--radius);
    box-shadow: 0 8px 28px rgba(0,0,0,0.65);
    overflow-y: auto;
    max-height: inherit;
}

.tweet-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 14px 14px 0;
}

.tweet-card-identity {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

img.tweet-card-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    flex-shrink: 0;
    object-fit: cover;
    background: linear-gradient(135deg, #1d9bf0 0%, #1a8cd8 100%);
}

div.tweet-card-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: linear-gradient(135deg, #1d9bf0 0%, #1a8cd8 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.85rem;
    color: #fff;
    flex-shrink: 0;
    letter-spacing: -0.02em;
}

.tweet-card-author {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.tweet-card-name {
    font-size: 0.82rem;
    font-weight: 700;
    color: #e7e9ea;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.tweet-card-handle {
    font-size: 0.72rem;
    color: #71767b;
    line-height: 1.3;
}

.tweet-follow-link {
    color: #1d9bf0 !important;
    font-weight: 700;
    font-size: 0.72rem;
}
.tweet-follow-link:hover { color: #1a8cd8 !important; text-decoration: underline; }

.tweet-card-logo {
    color: #e7e9ea;
    flex-shrink: 0;
    margin-left: 8px;
    margin-top: 2px;
}

.tweet-card-text {
    font-size: 0.84rem;
    color: #e7e9ea;
    line-height: 1.55;
    padding: 12px 14px;
    overflow-y: auto;
    word-wrap: break-word;
}

.tweet-card-text a {
    color: #1d9bf0;
}

.tweet-card-readmore {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 14px;
    margin: 0 14px 14px;
    background: transparent;
    border: 1px solid #536471;
    border-radius: 20px;
    color: #1d9bf0 !important;
    font-size: 0.78rem;
    font-weight: 700;
    text-decoration: none;
    transition: background 0.2s;
    cursor: pointer;
}

.tweet-card-readmore:hover {
    background: rgba(29, 155, 240, 0.1);
    color: #1d9bf0 !important;
}

.tweet-card-readmore svg {
    flex-shrink: 0;
}

.tweet-loading {
    width: 22px;
    height: 22px;
    border: 2px solid #2f3336;
    border-top-color: #1d9bf0;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 24px auto;
}

/* --- Metric Grid --- */
.card-metrics {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1px;
    background: var(--border);
    margin: 10px 16px 0;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1px solid var(--border);
}

.metric {
    background: var(--bg-metric);
    padding: 10px 6px;
    text-align: center;
    transition: background var(--transition);
}

.metric:hover { background: var(--bg-hover); }

.metric .metric-label {
    font-size: 0.55rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 600;
    margin-bottom: 3px;
}

.metric .metric-value {
    font-size: 0.8rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    line-height: 1.2;
}

/* PnL styling */
.pnl-pos { color: var(--green); }
.pnl-neg { color: var(--red); }

.pnl-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 6px;
    font-size: 0.78rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    line-height: 1.3;
}

.pnl-badge.pos { background: var(--green-bg); color: var(--green); border: 1px solid var(--green-border); }
.pnl-badge.neg { background: var(--red-bg); color: var(--red); border: 1px solid var(--red-border); }
.pnl-badge.neutral { background: rgba(255,255,255,0.03); color: var(--text-muted); border: 1px solid var(--border); }

/* uPnL indicators */
.upnl-indicator {
    font-size: 0.52rem;
    font-weight: 700;
    color: var(--purple);
    margin-left: 2px;
    vertical-align: super;
    opacity: 0.85;
}

/* Per-wallet TXs count */
.wallet-txs {
    display: inline-flex;
    align-items: center;
    gap: 1px;
    margin-left: 5px;
    padding: 0px 4px;
    font-size: 0.5rem;
    font-weight: 600;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 3px;
    border: 1px solid rgba(255, 255, 255, 0.04);
    vertical-align: middle;
}
.wallet-txs .tx-buys { color: var(--green); font-weight: 800; }
.wallet-txs .tx-sells { color: var(--red); font-weight: 800; }

/* Muted dash for empty values */
.val-empty { color: var(--text-muted); opacity: 0.4; }

/* --- Summary Pills --- */
.tx-summary {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    flex-wrap: wrap;
}

.tx-summary:empty { display: none; }

.tx-counts {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.count-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.64rem;
    font-weight: 600;
    letter-spacing: 0.01em;
}

.pill-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    flex-shrink: 0;
}

.dot-green { background: var(--green); }
.dot-red { background: var(--red); }
.dot-yellow { background: var(--yellow); }

.pill-holder { background: var(--green-bg); color: var(--green); border: 1px solid var(--green-border); }
.pill-flipped { background: var(--red-bg); color: var(--red); border: 1px solid var(--red-border); }
.pill-neutral { background: rgba(255,255,255,0.03); color: var(--text-secondary); border: 1px solid var(--border); }
.pill-mention { background: var(--yellow-bg); color: var(--yellow); border: 1px solid var(--yellow-border); }

.holder-count { color: var(--green); font-weight: 700; }
.flipped-count { color: var(--red); font-weight: 700; }

/* --- Wallet Table --- */
.card-wallets {
    margin: 6px 12px;
    overflow: visible;
    background: rgba(0,0,0,0.12);
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255,255,255,0.03);
}

.wallet-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.72rem;
}

.wallet-table td:last-child { text-align: right; padding-right: 14px; }

.wallet-table th {
    text-align: left;
    padding: 7px 10px;
    color: var(--text-muted);
    font-size: 0.54rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    background: rgba(0,0,0,0.08);
}

.wallet-table td {
    padding: 7px 10px;
    color: var(--text-primary);
    border-bottom: 1px solid rgba(255,255,255,0.025);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
    font-size: 0.75rem;
}

.wallet-table tr:last-child td { border-bottom: none; }

/* Holder rows: subtle green tint */
.wallet-table tr.row-holder { border-left: 3px solid var(--green); background: rgba(0, 210, 106, 0.03); }
.wallet-table tr.row-holder:hover td { background: rgba(0, 210, 106, 0.06); }

/* Flipped rows: subtle red tint */
.wallet-table tr.row-flipped { border-left: 3px solid var(--red); background: rgba(255, 71, 87, 0.03); }
.wallet-table tr.row-flipped:hover td { background: rgba(255, 71, 87, 0.06); }

.wallet-table tr.row-holder td:first-child,
.wallet-table tr.row-flipped td:first-child { padding-left: 10px; }

/* Per-row status badge (flipped only) */
.wallet-status {
    display: inline-block;
    margin-left: 6px;
    padding: 1px 5px;
    border-radius: 3px;
    font-size: 0.46rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    vertical-align: middle;
}
.wallet-status.status-sold {
    background: var(--red-bg);
    color: var(--red);
    border: 1px solid var(--red-border);
}

/* Integrated section labels (inside thead) */
.section-label {
    padding: 6px 12px !important;
    font-size: 0.54rem !important;
    font-weight: 700 !important;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}
.section-label-holder {
    color: var(--green) !important;
    background: rgba(0, 210, 106, 0.06) !important;
    border-bottom: 1px solid var(--green-border) !important;
}
.section-label-flipped {
    color: var(--red) !important;
    background: rgba(255, 71, 87, 0.06) !important;
    border-bottom: 1px solid var(--red-border) !important;
}
.section-label-mention {
    color: var(--yellow) !important;
    background: rgba(251, 191, 36, 0.06) !important;
    border-bottom: 1px solid var(--yellow-border) !important;
}
.section-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    display: inline-block;
    margin-right: 5px;
    vertical-align: middle;
}

.wallet-table tr:hover td { background: rgba(255,255,255,0.025); }

.wallet-table .wallet-addr {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    color: var(--text-primary);
}

.wallet-table .wallet-alias {
    color: var(--blue);
    font-weight: 700;
    display: inline-block;
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: middle;
}

/* Row animations */
@keyframes slideInLeft {
    from { opacity: 0; transform: translateX(-16px); }
    to { opacity: 1; transform: translateX(0); }
}

.wallet-row-new td {
    animation: slideInLeft 0.3s ease-out;
    background: var(--blue-bg);
}

.wallet-row-fade td {
    transition: background 0.8s ease-out;
    background: transparent;
}

.wallet-row-sellout td {
    background: var(--red-bg);
    transition: background 0.3s ease-in;
}

@keyframes slideOutRight {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(16px); }
}

.wallet-row-exit td {
    animation: slideOutRight 0.3s ease-in forwards;
}

/* Toggle buttons */
.wallet-toggle {
    width: 100%;
    padding: 7px 12px;
    background: transparent;
    border: none;
    border-top: 1px solid rgba(255,255,255,0.03);
    color: var(--text-muted);
    font-size: 0.6rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    border-radius: 0 0 calc(var(--radius-sm) - 1px) calc(var(--radius-sm) - 1px);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    font-family: var(--font);
}

.wallet-toggle:hover {
    color: var(--blue);
    background: rgba(90, 143, 255, 0.04);
}

.wallets-collapsed .wallet-table tr:nth-child(n+4) { display: none; }
.flipped-hidden .wallet-table { display: none; }

/* Mention rows */
.wallet-table tr.row-mention { border-left: 3px solid var(--yellow); }
.wallet-table tr.row-mention td:first-child { padding-left: 10px; }
.mention-count { color: var(--yellow); font-weight: 700; }

.mention-text {
    max-width: 220px;
    color: var(--text-secondary);
    font-size: 0.68rem;
    white-space: pre-line;
    line-height: 1.4;
}

/* === Channel Dots & Pills === */
.channel-dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
    vertical-align: middle;
    margin-right: 2px;
}

.channel-summary {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    flex-wrap: wrap;
}

.channel-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.68rem;
    color: var(--text-muted);
    white-space: nowrap;
    background: var(--bg-metric);
    padding: 4px 10px;
    border-radius: 20px;
    border: 1px solid var(--border);
    transition: border-color var(--transition);
}

.channel-pill:hover {
    border-color: var(--border-hover);
}

.channel-name {
    color: var(--text-secondary);
    font-weight: 600;
}

.channel-stat {
    color: var(--text-primary);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    background: rgba(255,255,255,0.04);
    padding: 1px 6px;
    border-radius: 10px;
}

.channel-hold {
    color: var(--text-muted);
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    font-size: 0.62rem;
    opacity: 0.8;
}

/* Section spacing */
.card-wallets + .card-wallets { margin-top: 6px; }
.card-wallets:last-of-type { margin-bottom: 4px; }

/* --- Card Footer --- */
.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 16px;
    font-size: 0.64rem;
    color: var(--text-muted);
    border-top: 1px solid rgba(255,255,255,0.04);
    background: rgba(0, 0, 0, 0.06);
    margin-top: 4px;
}

.card-footer .footer-time {
    display: flex;
    align-items: center;
    gap: 5px;
}

.card-footer a {
    font-size: 0.66rem;
    font-weight: 600;
    color: var(--text-muted);
    transition: all var(--transition);
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: var(--radius-xs);
}

.card-footer a:hover {
    color: var(--blue);
    background: var(--blue-bg);
}

/* ============================================
   LOADING / EMPTY
   ============================================ */
.loading {
    grid-column: 1 / -1;
    text-align: center;
    padding: 80px 20px;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 500;
}

.loading-spinner {
    display: inline-block;
    width: 28px;
    height: 28px;
    border: 2px solid var(--border);
    border-top-color: var(--blue);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 14px;
}

@keyframes spin { to { transform: rotate(360deg); } }

.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 80px 20px;
}

.empty-state-icon {
    font-size: 2rem;
    margin-bottom: 12px;
    opacity: 0.4;
}

.empty-state-text {
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* ============================================
   LOAD MORE
   ============================================ */
.load-more {
    display: flex;
    justify-content: center;
    padding: 24px 28px 56px;
    position: relative;
    z-index: 1;
}

.load-more button {
    padding: 10px 48px;
    background: rgba(255,255,255,0.03);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    border-radius: 24px;
    font-size: 0.76rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    font-family: var(--font);
    letter-spacing: 0.02em;
}

.load-more button:hover {
    border-color: var(--blue);
    color: var(--blue);
    box-shadow: var(--shadow-glow-blue);
    transform: translateY(-1px);
}

.load-more button:disabled {
    opacity: 0.25;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* ============================================
   SCROLL TO TOP
   ============================================ */
.scroll-top {
    position: fixed;
    bottom: 28px;
    right: 28px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 40;
    pointer-events: none;
    backdrop-filter: blur(8px);
}

.scroll-top.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: all;
}

.scroll-top:hover {
    border-color: var(--blue);
    color: var(--blue);
    box-shadow: var(--shadow-glow-blue);
    transform: translateY(-2px);
}

/* ============================================
   TOAST
   ============================================ */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--bg-elevated);
    color: var(--text-primary);
    padding: 10px 24px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    font-size: 0.78rem;
    font-weight: 500;
    z-index: 100;
    opacity: 0;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s;
    backdrop-filter: blur(12px);
    box-shadow: var(--shadow-lg);
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* ============================================
   UTILITIES
   ============================================ */
.token-card.search-hidden { display: none; }

/* Sold-out tokens: all wallets flipped, no holders remaining */
.token-card.sold-out { display: none; }

/* Card entrance */
@keyframes cardIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.token-card { animation: cardIn 0.3s ease-out both; }
.token-card.no-entrance { animation: none; }
.token-card:nth-child(1) { animation-delay: 0.02s; }
.token-card:nth-child(2) { animation-delay: 0.04s; }
.token-card:nth-child(3) { animation-delay: 0.06s; }
.token-card:nth-child(4) { animation-delay: 0.08s; }
.token-card:nth-child(5) { animation-delay: 0.10s; }
.token-card:nth-child(6) { animation-delay: 0.12s; }

/* ============================================
   CONFIG / SETTINGS
   ============================================ */
.config-container {
    max-width: 800px;
    margin: 24px auto;
    padding: 0 28px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.config-panel {
    background: linear-gradient(180deg, var(--bg-card-top) 0%, var(--bg-card) 100%);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.config-panel-header {
    padding: 16px 18px 12px;
    border-bottom: 1px solid rgba(255,255,255,0.04);
}

.config-panel-title {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.config-panel-desc {
    font-size: 0.68rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.config-items {
    padding: 6px 0;
}

.config-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 18px;
    background: var(--bg-metric);
    border-bottom: 1px solid rgba(255,255,255,0.025);
    transition: background var(--transition);
}

.config-item:last-child { border-bottom: none; }
.config-item:hover { background: var(--bg-hover); }

.config-item-info {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.config-item-id {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--text-secondary);
}

.config-item-name {
    font-size: 0.76rem;
    font-weight: 600;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.config-remove-btn {
    background: none;
    border: 1px solid transparent;
    color: var(--text-muted);
    cursor: pointer;
    padding: 4px 10px;
    border-radius: var(--radius-xs);
    font-size: 0.68rem;
    font-weight: 600;
    font-family: var(--font);
    transition: all var(--transition);
}

.config-remove-btn:hover {
    color: var(--red);
    background: var(--red-bg);
    border-color: var(--red-border);
}

.config-empty {
    padding: 16px 18px;
    color: var(--text-muted);
    font-size: 0.72rem;
    font-style: italic;
}

.config-add-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 18px;
    border-top: 1px solid rgba(255,255,255,0.04);
    background: rgba(0,0,0,0.06);
}

.config-add-row input {
    flex: 1;
    padding: 7px 14px;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.76rem;
    font-family: var(--font);
    outline: none;
    transition: all var(--transition);
    min-width: 0;
}

.config-add-row input::placeholder { color: var(--text-muted); }
.config-add-row input:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(90, 143, 255, 0.08);
    background: var(--bg-card);
}

.config-add-btn {
    padding: 7px 18px;
    background: var(--green-bg);
    color: var(--green);
    border: 1px solid var(--green-border);
    border-radius: var(--radius-sm);
    font-size: 0.72rem;
    font-weight: 700;
    cursor: pointer;
    font-family: var(--font);
    transition: all var(--transition);
    white-space: nowrap;
}

.config-add-btn:hover {
    background: rgba(0, 210, 106, 0.15);
    box-shadow: var(--shadow-glow-green);
}

.config-search-btn {
    padding: 7px 18px;
    background: var(--blue-bg);
    color: var(--blue);
    border: 1px solid var(--blue-border);
    border-radius: var(--radius-sm);
    font-size: 0.72rem;
    font-weight: 700;
    cursor: pointer;
    font-family: var(--font);
    transition: all var(--transition);
    white-space: nowrap;
}

.config-search-btn:hover {
    background: rgba(90, 143, 255, 0.15);
    box-shadow: var(--shadow-glow-blue);
}

.config-search-area {
    border-top: 1px solid rgba(255,255,255,0.04);
    background: rgba(0,0,0,0.08);
    padding: 10px 18px;
}

.config-search-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.config-search-row input {
    flex: 1;
    padding: 7px 14px;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.76rem;
    font-family: var(--font);
    outline: none;
    transition: all var(--transition);
    min-width: 0;
}

.config-search-row input::placeholder { color: var(--text-muted); }
.config-search-row input:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(90, 143, 255, 0.08);
    background: var(--bg-card);
}

.config-search-go {
    padding: 7px 14px;
    background: var(--blue-bg);
    color: var(--blue);
    border: 1px solid var(--blue-border);
    border-radius: var(--radius-sm);
    font-size: 0.72rem;
    font-weight: 700;
    cursor: pointer;
    font-family: var(--font);
    transition: all var(--transition);
}

.config-search-go:hover {
    background: rgba(90, 143, 255, 0.15);
}

.config-search-results {
    margin-top: 8px;
}

.config-search-result {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: var(--radius-xs);
    cursor: pointer;
    transition: background var(--transition);
}

.config-search-result:hover {
    background: var(--bg-hover);
}

.config-search-result-name {
    font-size: 0.76rem;
    font-weight: 600;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    min-width: 0;
}

.config-search-result-id {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    color: var(--text-muted);
    flex-shrink: 0;
}

.config-search-type {
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 2px 7px;
    border-radius: var(--radius-xs);
    flex-shrink: 0;
}

.config-search-type-channel {
    color: var(--blue);
    background: var(--blue-bg);
}

.config-search-type-group {
    color: var(--purple);
    background: var(--purple-bg);
}

.config-search-type-user {
    color: var(--green);
    background: var(--green-bg);
}

.config-search-loading {
    padding: 10px 12px;
    font-size: 0.72rem;
    color: var(--text-muted);
    font-style: italic;
}

/* Channel filter toggles in settings */
.config-filter-section {
    background: linear-gradient(180deg, var(--bg-card-top) 0%, var(--bg-card) 100%);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}

.config-filter-header {
    padding: 16px 18px 12px;
    border-bottom: 1px solid rgba(255,255,255,0.04);
}

.config-filter-title {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.config-filter-desc {
    font-size: 0.68rem;
    color: var(--text-muted);
    line-height: 1.4;
}

.config-filter-items {
    padding: 8px 0;
}

.config-filter-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 18px;
    cursor: pointer;
    transition: background var(--transition);
}

.config-filter-item:hover { background: var(--bg-hover); }

.config-filter-item input[type="checkbox"] {
    accent-color: var(--blue);
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.config-filter-item label {
    font-size: 0.76rem;
    color: var(--text-primary);
    cursor: pointer;
    font-weight: 500;
}

.config-filter-item .filter-id {
    font-family: var(--font-mono);
    font-size: 0.66rem;
    color: var(--text-muted);
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 900px) {
    .card-grid {
        grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
        padding: 16px;
        gap: 12px;
    }
    .app-header, .toolbar, .stats-bar { padding-left: 16px; padding-right: 16px; }
}

@media (max-width: 480px) {
    .card-grid {
        grid-template-columns: 1fr;
        padding: 10px;
        gap: 10px;
    }
    .toolbar { padding: 8px 12px; }
    .stats-bar { padding: 8px 12px; }
    .card-metrics { grid-template-columns: repeat(2, 1fr); }
    .header-search { width: 160px; }
    .app-header { padding: 0 12px; }
    .config-container { padding: 0 12px; }
    .config-add-row { flex-wrap: wrap; }
    .config-search-row { flex-wrap: wrap; }
}

/* Telegram connection panel */
.tg-step { display: none; }
.tg-step.active { display: block; }
.tg-back-row { padding: 6px 16px 0; }
.tg-error { font-size: 12px; color: var(--red); padding: 4px 16px 0; display: none; }
.tg-error.visible { display: block; }
