/* ================================================================
   RAJYA SABHA INTELLIGENCE DASHBOARD — REIMAGINED STYLE SYSTEM
   Market-Explorer-Inspired · 3-Panel Layout · Gold Gradient Theme
   ================================================================ */

/* ===== Design Tokens (Sleek Monochrome & Silver Palette) ===== */
:root {
    --bg:             #060507;
    --panel:          rgba(15, 14, 18, 0.85);
    --panel-2:        rgba(25, 24, 28, 0.9);
    --panel-solid:    #0f0e12;
    --border:         rgba(255, 255, 255, 0.05);
    --border-light:   rgba(255, 255, 255, 0.08);
    --glass:          rgba(255, 255, 255, 0.02);
    --glass-border:   rgba(255, 255, 255, 0.04);
    --text:           #ffffff;
    --text-dim:       #b0b0b8;
    --text-faint:     #5e5f68;
    --silver:         #cfc9c2;
    --silver-dim:     #6a6b75;
    --silver-glow:    rgba(255, 255, 255, 0.08);
    --green:          #7a9b7e;
    --red:            #b86b5a;
    --red-dim:        #8a4a3a;
    --mono:           'JetBrains Mono', 'SF Mono', 'Roboto Mono', ui-monospace, monospace;
    --sans:           'Inter', system-ui, -apple-system, sans-serif;
    --radius:         8px;
    --radius-sm:      4px;
}

/* ===== Reset & Scrollbars ===== */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

/* Custom scrollbars globally */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.35);
    border-radius: 10px;
}
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    border: 1px solid rgba(0, 0, 0, 0.2);
    transition: background 0.2s;
}
::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.24);
}
::-webkit-scrollbar-corner {
    background: transparent;
}

/* Firefox standard scrollbars */
* {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.12) rgba(0, 0, 0, 0.35);
}

html, body {
    height: 100%;
    overflow: hidden;
    background: var(--bg);
    color: var(--text);
    font-family: var(--mono);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    color-scheme: dark;
}

body {
    background: radial-gradient(ellipse 120% 80% at 50% -10%, rgba(255,255,255,0.02) 0%, transparent 60%),
                radial-gradient(ellipse 80% 80% at 0% 100%, rgba(255,255,255,0.01) 0%, transparent 55%),
                #060507;
}

/* ===== Background Layers ===== */
.bg-wrapper {
    position: fixed; inset: 0;
    overflow: hidden; pointer-events: none; z-index: 0;
}
.bg-grain {
    position: absolute; inset: 0; opacity: 0.035;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
}
.bg-grid {
    position: absolute; inset: 0;
    background-image:
        linear-gradient(rgba(255,255,255,0.015) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.015) 1px, transparent 1px);
    background-size: 72px 72px;
    mask-image: radial-gradient(ellipse 80% 80% at 50% 50%, black 20%, transparent 80%);
    -webkit-mask-image: radial-gradient(ellipse 80% 80% at 50% 50%, black 20%, transparent 80%);
}
.bg-orb {
    position: absolute; border-radius: 50%;
    filter: blur(100px); pointer-events: none; z-index: 0;
}
.bg-orb-a {
    width: 55vw; height: 55vw;
    background: radial-gradient(circle, rgba(255,255,255,0.03) 0%, transparent 70%);
    top: -15vw; right: -10vw;
    animation: orbDrift 22s ease-in-out infinite alternate;
}
.bg-orb-b {
    width: 45vw; height: 45vw;
    background: radial-gradient(circle, rgba(255,255,255,0.02) 0%, transparent 70%);
    bottom: -10vw; left: -8vw;
    animation: orbDrift 28s ease-in-out infinite alternate-reverse;
}
.bg-orb-c {
    width: 30vw; height: 30vw;
    background: radial-gradient(circle, rgba(255,255,255,0.01) 0%, transparent 70%);
    top: 40%; left: 40%;
    animation: orbDrift 18s ease-in-out infinite alternate;
}
@keyframes orbDrift {
    0%   { transform: translate(0, 0) scale(1); }
    100% { transform: translate(2vw, 2vh) scale(1.05); }
}

/* Frame Border */
.frame {
    position: fixed;
    inset: 0;
    border: 1px solid rgba(255,255,255,0.05);
    pointer-events: none;
    z-index: 50;
}

/* ===== Mobile Block ===== */
#mobile-block {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: var(--bg);
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2rem;
    gap: 1rem;
}
#mobile-block .mobile-glyph {
    font-size: 3rem;
    color: var(--silver);
    filter: drop-shadow(0 0 12px var(--silver-glow));
}
#mobile-block h2 {
    font-family: var(--mono);
    font-size: 1.2rem;
    color: var(--silver);
    letter-spacing: 0.05em;
}
#mobile-block p {
    color: var(--text-dim);
    max-width: 340px;
    line-height: 1.6;
    font-family: var(--sans);
}

@media (max-width: 1199px) {
    #mobile-block { display: flex; }
    .app { display: none !important; }
}

/* ===== App Shell — 2-Panel Layout ===== */
.app {
    position: relative;
    z-index: 1;
    height: 100vh;
    width: 100vw;
    display: grid;
    grid-template-columns: 1fr 310px;
    grid-template-rows: 48px 1fr 28px;
    grid-template-areas:
        "header header"
        "main detail"
        "footer footer";
    gap: 0;
}

/* ===== HEADER ===== */
.header {
    grid-area: header;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    border-bottom: 1px solid var(--glass-border);
    background: rgba(10, 9, 12, 0.8);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: 0 1px 0 rgba(255,255,255,0.03), inset 0 -1px 0 rgba(0,0,0,0.4);
    z-index: 10;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.65rem;
}
.logo-mark {
    font-size: 1.5rem;
    color: var(--silver);
    opacity: 0.9;
    line-height: 1;
    filter: drop-shadow(0 0 6px rgba(255,255,255,0.15));
    animation: logoPulse 4s ease-in-out infinite;
}
@keyframes logoPulse {
    0%, 100% { filter: drop-shadow(0 0 6px rgba(255,255,255,0.1)); }
    50%      { filter: drop-shadow(0 0 12px rgba(255,255,255,0.25)); }
}
.logo-text {
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.22em;
    color: #dfdfdf;
}
.logo-text span { color: var(--silver); }

.header-center {
    display: flex;
    align-items: center;
}
.header-tag {
    font-size: 10px;
    letter-spacing: 0.2em;
    color: var(--text-dim);
    border: 1px solid var(--glass-border);
    background: var(--glass);
    padding: 4px 14px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    gap: 7px;
}
.header-tag .dot {
    width: 5px; height: 5px;
    border-radius: 50%;
    background: var(--silver);
    box-shadow: 0 0 6px var(--silver);
    animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse {
    0%,100% { opacity: 1; box-shadow: 0 0 6px var(--silver); }
    50%     { opacity: 0.6; box-shadow: 0 0 12px var(--silver); }
}

.header-stats {
    display: flex;
    gap: 22px;
    align-items: center;
}
.hstat { text-align: right; }
.hstat .v {
    font-size: 13px;
    font-weight: 700;
    color: var(--silver);
    letter-spacing: 0.02em;
}
.hstat .l {
    font-size: 8px;
    letter-spacing: 0.18em;
    color: var(--text-faint);
    margin-top: 1px;
}

/* ===== CONTROL DECK (Header search & sort) ===== */
.control-deck {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px 20px;
    background: rgba(15, 14, 18, 0.4);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}

.deck-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.main-title-wrap {
    flex-shrink: 0;
}
.main-title {
    font-size: 13px;
    letter-spacing: 0.18em;
    color: var(--text);
    font-weight: 700;
}
.main-title span {
    color: var(--silver);
}

.search-wrap {
    position: relative;
    flex: 1;
    max-width: 400px;
}
.search-input {
    width: 100%;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.06);
    color: var(--text);
    font-family: var(--mono);
    font-size: 11.5px;
    padding: 10px 14px 10px 36px;
    border-radius: 8px;
    outline: none;
    transition: all 0.25s ease;
}
.search-input::placeholder {
    color: var(--text-faint);
}
.search-input:focus {
    border-color: rgba(255, 255, 255, 0.2);
    background: rgba(255, 255, 255, 0.04);
    box-shadow: 0 0 12px rgba(255, 255, 255, 0.03);
}
.search-icon {
    position: absolute;
    left: 12px; top: 50%;
    transform: translateY(-50%);
    color: var(--text-faint);
    font-size: 14px;
    pointer-events: none;
    transition: color 0.2s;
}
.search-input:focus + .search-icon {
    color: var(--text);
}

.sort-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}
.view-toggle {
    display: flex;
    gap: 2px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    padding: 2px;
}
.view-toggle button {
    background: transparent;
    border: none;
    color: var(--text-dim);
    font-family: var(--mono);
    font-size: 9px;
    letter-spacing: 0.08em;
    padding: 6px 12px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}
.view-toggle button.active {
    background: var(--text);
    color: var(--bg);
    font-weight: 700;
    box-shadow: 0 2px 8px rgba(255, 255, 255, 0.1);
}
.view-toggle button:not(.active):hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.04);
}

/* Horizontal Party Quick Filters */
.party-track-wrap {
    display: flex;
    align-items: center;
    width: 100%;
}
.party-track {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    width: 100%;
    padding: 2px 0 6px 0;
}
.party-track::-webkit-scrollbar {
    height: 4px;
}
.party-track::-webkit-scrollbar-track {
    background: transparent;
}
.party-track::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

.party-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 20px;
    cursor: pointer;
    font-size: 10.5px;
    color: var(--text-dim);
    transition: all 0.2s ease;
    user-select: none;
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
    white-space: nowrap;
}
/* Color graded indicator bar inside the chip */
.party-chip::before {
    content: '';
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 2px;
    width: var(--share, 0%);
    background: var(--party-color, var(--text));
    opacity: 0.25;
    transition: width 0.4s ease;
}
.party-chip:hover {
    background: rgba(255, 255, 255, 0.04);
    border-color: rgba(255, 255, 255, 0.08);
    transform: translateY(-1px);
    color: var(--text);
}
.party-chip.active {
    background: rgba(255, 255, 255, 0.07);
    border-color: var(--party-color, var(--text));
    color: var(--text);
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.03);
}
.party-chip.active::before {
    width: 100%;
    opacity: 0.6;
}
.party-chip-swatch {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    display: inline-block;
}
.party-chip-name {
    font-weight: 500;
}
.party-chip-count {
    font-size: 9px;
    color: var(--text-faint);
    background: rgba(255, 255, 255, 0.04);
    padding: 1px 5px;
    border-radius: 10px;
}
.party-chip.active .party-chip-count {
    color: var(--text-dim);
    background: rgba(0, 0, 0, 0.2);
}


/* ===== MAIN CONTENT — Member Directory ===== */
.main {
    grid-area: main;
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background: rgba(8, 7, 6, 0.3);
}

.main-header {
    padding: 10px 20px 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--glass-border);
    background: rgba(12, 10, 8, 0.3);
    flex-shrink: 0;
}
.main-title {
    font-size: 12px;
    letter-spacing: 0.18em;
    color: var(--text);
    font-weight: 700;
}
.main-title span { color: var(--silver); }
.main-sub {
    font-size: 10px;
    color: var(--text-faint);
    letter-spacing: 0.05em;
}

/* Member List */
.member-list {
    flex: 1;
    overflow-y: auto;
    padding: 6px 8px;
}


.member-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 6px;
    cursor: pointer;
    transition: background 0.12s, transform 0.12s;
    border-bottom: 1px solid rgba(255,255,255,0.02);
    user-select: none;
}
.member-row:hover {
    background: rgba(212,184,150,0.04);
    transform: translateX(2px);
}
.member-row:active {
    transform: scale(0.995);
}

.member-sno {
    font-size: 9px;
    color: var(--text-faint);
    width: 24px;
    text-align: center;
    flex-shrink: 0;
    letter-spacing: 0.05em;
}
.member-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    box-shadow: 0 0 6px rgba(0,0,0,0.3);
}
.member-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.member-name {
    font-family: var(--sans);
    font-size: 12.5px;
    font-weight: 600;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.2;
}
.member-meta {
    font-size: 9.5px;
    color: var(--text-faint);
    letter-spacing: 0.03em;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.member-meta .party-tag {
    color: var(--text-dim);
    font-weight: 500;
}

.member-wealth {
    font-family: var(--mono);
    font-size: 11px;
    font-weight: 600;
    color: var(--silver);
    flex-shrink: 0;
    text-align: right;
    min-width: 80px;
    letter-spacing: 0.02em;
}

.member-badge {
    font-size: 9px;
    padding: 3px 8px;
    border-radius: 999px;
    flex-shrink: 0;
    font-weight: 600;
    letter-spacing: 0.03em;
    min-width: 62px;
    text-align: center;
    white-space: nowrap;
}
.member-badge.danger {
    color: #e85a4a;
    background: rgba(232, 90, 74, 0.10);
    border: 1px solid rgba(232, 90, 74, 0.25);
    box-shadow: 0 0 8px rgba(232, 90, 74, 0.06);
}
.member-badge.warn {
    color: #d4a24a;
    background: rgba(212, 162, 74, 0.08);
    border: 1px solid rgba(212, 162, 74, 0.20);
}
.member-badge.clean {
    color: var(--text-faint);
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.04);
}

.no-results {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    gap: 10px;
    color: var(--text-faint);
    font-size: 12px;
    letter-spacing: 0.1em;
}
.no-results .no-results-icon {
    font-size: 2rem;
    opacity: 0.4;
}

/* ===== DETAIL PANEL (Right) ===== */
.detail-panel {
    grid-area: detail;
    border-left: 1px solid var(--glass-border);
    padding: 14px 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    overflow-y: auto;
    background: rgba(12, 10, 8, 0.6);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}


/* Compact Stats Grid */
.compact-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}
.compact-stat {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 10px 10px 8px;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s, transform 0.2s;
}
.compact-stat:hover {
    border-color: rgba(255,255,255,0.12);
    background: rgba(255,255,255,0.04);
    transform: translateY(-1px);
}
.compact-stat::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 2px;
    background: var(--stat-accent, var(--silver));
    opacity: 0.4;
    transition: opacity 0.2s;
}
.compact-stat:hover::after { opacity: 0.8; }
.compact-stat .stat-icon {
    font-size: 10px;
    position: absolute;
    top: 6px; right: 8px;
    opacity: 0.35;
}
.compact-stat .stat-val {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
    line-height: 1.15;
}
.compact-stat .stat-label {
    font-size: 8px;
    color: var(--text-faint);
    letter-spacing: 0.12em;
    margin-top: 2px;
}
.compact-stat .stat-sub {
    font-size: 8.5px;
    color: var(--text-dim);
    margin-top: 1px;
}
.compact-stat.full-width {
    grid-column: 1 / -1;
}

/* Compact Chart Cards */
.compact-chart-card {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.compact-chart-card.donut-layout {
    flex-direction: row;
    align-items: center;
    gap: 8px;
}
.compact-chart-card canvas {
    flex-shrink: 0;
}

/* Legend (shared) */
.legend-list {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1px;
    overflow: hidden;
    min-width: 0;
}
.legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 9.5px;
    color: var(--text-dim);
    line-height: 1.35;
    white-space: nowrap;
    overflow: hidden;
    padding: 1px 4px;
    margin: -1px -4px;
    border-radius: 3px;
    cursor: pointer;
    transition: background 0.15s;
}
.legend-item:hover { background: rgba(255,255,255,0.04); }
.legend-dot {
    width: 6px; height: 6px;
    border-radius: 2px;
    flex-shrink: 0;
}
.legend-name {
    overflow: hidden;
    text-overflow: ellipsis;
}
.legend-val {
    margin-left: auto;
    font-size: 9px;
    color: var(--text-faint);
    flex-shrink: 0;
    padding-left: 4px;
}

/* Compact Age Bars */
.compact-age-wrap {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.age-bar-row {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    padding: 2px 0;
    transition: opacity 0.15s;
}
.compact-age-wrap:hover .age-bar-row { opacity: 0.5; }
.compact-age-wrap:hover .age-bar-row:hover { opacity: 1; }
.age-bar-label {
    font-size: 9px;
    color: var(--text-dim);
    width: 36px;
    flex-shrink: 0;
    text-align: right;
}
.age-bar-track {
    flex: 1;
    height: 10px;
    background: rgba(255,255,255,0.025);
    border-radius: 3px;
    overflow: hidden;
}
.age-bar-fill {
    height: 100%;
    border-radius: 3px;
    width: 0;
    transition: width 1s cubic-bezier(0.22, 0.61, 0.36, 1);
}
.age-bar-fill.go { width: var(--w); }
.age-bar-count {
    font-size: 9px;
    color: var(--text-faint);
    width: 22px;
    text-align: right;
    flex-shrink: 0;
}

/* ===== FOOTER ===== */
.footer {
    grid-area: footer;
    display: flex;
    align-items: center;
    gap: 0;
    border-top: 1px solid var(--glass-border);
    overflow: hidden;
    background: rgba(14, 12, 10, 0.5);
    padding: 0 16px;
}

.ticker-mask {
    flex: 1;
    overflow: hidden;
    mask-image: linear-gradient(to right, transparent, black 4%, black 96%, transparent);
    -webkit-mask-image: linear-gradient(to right, transparent, black 4%, black 96%, transparent);
}
.ticker-track {
    display: flex;
    gap: 48px;
    white-space: nowrap;
    animation: tickerScroll 80s linear infinite;
    will-change: transform;
}
.ticker-track:hover { animation-play-state: paused; }
.ticker-track span {
    font-size: 9.5px;
    color: var(--text-dim);
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
.ticker-track span strong {
    color: var(--silver);
    font-weight: 600;
}
.ticker-sep {
    color: var(--text-faint);
    font-size: 7px;
}
@keyframes tickerScroll {
    from { transform: translateX(0); }
    to   { transform: translateX(-50%); }
}

/* ===== Clickable Elements ===== */
.clickable { cursor: pointer; }

/* ===== Party dot inline ===== */
.pdot {
    display: inline-block;
    width: 5px; height: 5px;
    border-radius: 50%;
    margin-right: 4px;
    vertical-align: middle;
    flex-shrink: 0;
}

/* ===== Detail Overlay ===== */
#detail-overlay {
    position: fixed;
    inset: 0;
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.25s, visibility 0.25s;
}
#detail-overlay.detail-hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.detail-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.detail-card {
    position: relative;
    background: rgba(16, 14, 11, 0.96);
    border: 1px solid rgba(200, 160, 110, 0.16);
    border-radius: 14px;
    max-width: 500px;
    width: 92%;
    max-height: 78vh;
    overflow-y: auto;
    padding: 22px 24px 24px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.55),
                0 0 0 1px rgba(200, 160, 110, 0.04) inset,
                0 0 80px rgba(201, 149, 107, 0.04);
    transform: translateY(0) scale(1);
    transition: transform 0.3s cubic-bezier(0.22, 0.61, 0.36, 1);
}
.detail-hidden .detail-card {
    transform: translateY(16px) scale(0.97);
}



.detail-close {
    position: absolute;
    top: 10px; right: 12px;
    background: none;
    border: 1px solid rgba(200, 160, 110, 0.1);
    color: var(--text-dim);
    font-size: 1.1rem;
    cursor: pointer;
    width: 28px; height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    transition: color 0.2s, background 0.2s, border-color 0.2s;
}
.detail-close:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.2);
}

/* ===== Detail Card Content ===== */
.detail-tag {
    font-family: var(--mono);
    font-size: 9px;
    letter-spacing: 0.14em;
    color: var(--silver);
    opacity: 0.7;
    margin-bottom: 4px;
}
.detail-title {
    font-family: var(--mono);
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.3;
    margin-bottom: 10px;
    padding-right: 30px;
}

.detail-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 16px;
}
.detail-chip {
    font-size: 10px;
    font-weight: 500;
    color: var(--text-dim);
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(200, 160, 110, 0.1);
    padding: 3px 9px;
    border-radius: 14px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-family: var(--mono);
}

.detail-section {
    border-top: 1px solid var(--border);
    padding-top: 12px;
    margin-top: 12px;
}
.detail-section h4 {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-dim);
    margin-bottom: 10px;
    letter-spacing: 0.02em;
    font-family: var(--sans);
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 8px;
    margin-bottom: 10px;
}
.detail-stat {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 8px 10px;
    text-align: center;
}
.detail-stat.highlight { border-color: rgba(212, 184, 150, 0.2); background: rgba(212, 184, 150, 0.04); }
.detail-stat.warn { border-color: rgba(184, 107, 90, 0.2); background: rgba(184, 107, 90, 0.04); }
.detail-stat.danger { border-color: rgba(140, 60, 50, 0.25); background: rgba(140, 60, 50, 0.06); }

.detail-stat-val {
    font-family: var(--mono);
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text);
    display: block;
    line-height: 1.2;
}
.detail-stat-val small {
    font-size: 10px;
    font-weight: 500;
    color: var(--text-dim);
}
.detail-stat-label {
    font-size: 8.5px;
    color: var(--text-faint);
    margin-top: 2px;
    display: block;
    letter-spacing: 0.03em;
}

/* Asset stacked bar */
.detail-bar-visual {
    display: flex;
    height: 10px;
    border-radius: 5px;
    overflow: hidden;
    margin-bottom: 6px;
    background: rgba(255,255,255,0.02);
}
.detail-bar-seg { height: 100%; transition: width 0.5s; }
.detail-bar-legend {
    display: flex;
    gap: 14px;
    font-size: 9px;
    color: var(--text-faint);
    margin-bottom: 4px;
}
.detail-bar-legend span { display: inline-flex; align-items: center; gap: 4px; }

/* List items */
.detail-list { display: flex; flex-direction: column; gap: 1px; }
.detail-list-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: var(--radius-sm);
    transition: background 0.15s;
    font-size: 11px;
}
.detail-list-item:hover { background: rgba(255, 255, 255, 0.025); }
.detail-rank {
    font-family: var(--mono);
    font-size: 9px;
    font-weight: 600;
    color: var(--text-faint);
    width: 16px;
    text-align: center;
    flex-shrink: 0;
}
.detail-list-name {
    color: var(--text-dim);
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-family: var(--sans);
}
.detail-list-val {
    font-family: var(--mono);
    font-size: 10px;
    color: var(--text-faint);
    flex-shrink: 0;
    white-space: nowrap;
}

/* Clean / no-cases badge */
.detail-clean {
    font-size: 11px;
    color: var(--green);
    background: rgba(122, 155, 126, 0.06);
    border: 1px solid rgba(122, 155, 126, 0.15);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    text-align: center;
}

/* Party-colored accent line at top of detail card */
.detail-card::before {
    content: '';
    position: absolute;
    top: 0; left: 24px; right: 24px;
    height: 2px;
    background: var(--detail-accent, var(--silver));
    border-radius: 0 0 2px 2px;
    opacity: 0.6;
}

/* ===== Utility Animations ===== */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(-8px); }
    to   { opacity: 1; transform: translateX(0); }
}

.member-row {
    opacity: 0;
    animation: fadeUp 0.3s ease forwards;
}

/* Stagger first 20 rows only for performance */
.member-row:nth-child(1)  { animation-delay: 0.02s; }
.member-row:nth-child(2)  { animation-delay: 0.04s; }
.member-row:nth-child(3)  { animation-delay: 0.06s; }
.member-row:nth-child(4)  { animation-delay: 0.08s; }
.member-row:nth-child(5)  { animation-delay: 0.10s; }
.member-row:nth-child(6)  { animation-delay: 0.12s; }
.member-row:nth-child(7)  { animation-delay: 0.14s; }
.member-row:nth-child(8)  { animation-delay: 0.16s; }
.member-row:nth-child(9)  { animation-delay: 0.18s; }
.member-row:nth-child(10) { animation-delay: 0.20s; }
.member-row:nth-child(n+11) { animation-delay: 0.22s; }

.compact-stat {
    opacity: 0;
    animation: fadeUp 0.4s ease forwards;
}
.compact-stat:nth-child(1) { animation-delay: 0.1s; }
.compact-stat:nth-child(2) { animation-delay: 0.18s; }
.compact-stat:nth-child(3) { animation-delay: 0.26s; }
.compact-stat:nth-child(4) { animation-delay: 0.34s; }
.compact-stat:nth-child(5) { animation-delay: 0.42s; }
