/* Accounts Section */
.accounts-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    position: relative;
    z-index: 1;
}

.accounts-header h2 {
    font-family: var(--font-display);
    font-size: 20px;
    font-weight: 500;
    letter-spacing: 0.01em;
    color: var(--text-primary);
}

.accounts-header::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, var(--border-subtle), transparent);
}

.account-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: 16px;
    padding: 18px 20px;
    margin-bottom: 12px;
    position: relative;
    z-index: 1;
    transition: all 0.2s ease;
    overflow: hidden;
}

.account-accent {
    position: absolute;
    top: 16px;
    bottom: 16px;
    left: 0;
    width: 3px;
    border-radius: 0 2px 2px 0;
}

.account-card:active {
    transform: scale(0.99);
    background: var(--bg-card-elevated);
}

.account-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.account-name {
    font-family: var(--font-body);
    font-size: 15px;
    font-weight: 500;
    letter-spacing: 0.01em;
}

.account-badge {
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 500;
    padding: 5px 10px;
    border-radius: 8px;
    letter-spacing: 0.02em;
}

.badge-wrapper {
    position: relative;
    display: inline-flex;
}

.top-performer-star {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 16px;
    height: 16px;
    color: var(--gold);
    filter: drop-shadow(0 0 4px rgba(201, 169, 98, 0.6));
    animation: starPulse 2s ease-in-out infinite;
}

@keyframes starPulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.15); opacity: 0.85; }
}

.account-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px 12px;
}

.account-stat {
    display: flex;
    flex-direction: column;
}

.account-stat-label {
    font-size: 9px;
    font-weight: 400;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-tertiary);
    margin-bottom: 4px;
}

.account-stat-value {
    font-size: 13px;
    font-weight: 500;
    letter-spacing: -0.01em;
    color: var(--text-primary);
}

.account-stat-value.positive { color: var(--positive); }
.account-stat-value.negative { color: var(--negative); }

.account-stat-prev {
    font-size: 10px;
    font-weight: 400;
    color: var(--text-tertiary);
    margin-left: 4px;
}

/* Utilities */
.hidden {
    display: none !important;
}

.text-positive { color: var(--positive); }
.text-negative { color: var(--negative); }

/* Animations */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

.dashboard.animate .hero-card {
    animation: fadeInUp 0.5s ease-out forwards;
    -webkit-backface-visibility: hidden;
}

.dashboard.animate .chart-section {
    animation: fadeInUp 0.5s ease-out 0.1s forwards;
    -webkit-backface-visibility: hidden;
    opacity: 0;
}

.dashboard.animate .accounts-header {
    animation: fadeInUp 0.5s ease-out 0.2s forwards;
    -webkit-backface-visibility: hidden;
    opacity: 0;
}

.dashboard.animate .account-card {
    animation: fadeInUp 0.4s ease-out forwards;
    -webkit-backface-visibility: hidden;
    opacity: 0;
}

.dashboard.animate .account-card:nth-child(1) { animation-delay: 0.25s; }
.dashboard.animate .account-card:nth-child(2) { animation-delay: 0.35s; }
.dashboard.animate .account-card:nth-child(3) { animation-delay: 0.45s; }

/* Expandable Account Cards */
.account-card {
    cursor: pointer;
}

.account-card.expanded {
    background: var(--bg-card-elevated);
}

.account-expand-section {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

/* Animated separator line */
.account-expand-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: var(--border-subtle);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.account-card.expanded .account-expand-section::before {
    opacity: 1;
}

.account-expand-section > div {
    overflow: hidden;
}

.account-card.expanded .account-expand-section {
    grid-template-rows: 1fr;
}

/* Inner wrapper handles padding so it animates with content */
.account-expand-inner {
    padding-top: 16px;
    margin-top: 16px;
    opacity: 0;
    transform: translateY(-8px);
    transition: opacity 0.3s ease 0.1s, transform 0.3s ease 0.1s;
}

.account-card.expanded .account-expand-inner {
    opacity: 1;
    transform: translateY(0);
}

.account-expand-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.account-expand-stat {
    text-align: center;
}

.account-expand-value {
    font-size: 15px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.account-expand-label {
    font-size: 9px;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

/* Sparklines */
.account-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sparkline-container {
    width: 60px;
    height: 24px;
    position: relative;
}

.sparkline-svg {
    width: 100%;
    height: 100%;
}

.sparkline-line {
    fill: none;
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.sparkline-line.positive { stroke: var(--positive); }
.sparkline-line.negative { stroke: var(--negative); }
.sparkline-line.neutral { stroke: var(--text-tertiary); }

.sparkline-area {
    opacity: 0.15;
}

.sparkline-area.positive { fill: var(--positive); }
.sparkline-area.negative { fill: var(--negative); }
.sparkline-area.neutral { fill: var(--text-tertiary); }

.dashboard.animate .goal-card {
    animation: fadeInUp 0.5s ease-out 0.05s forwards;
    -webkit-backface-visibility: hidden;
    opacity: 0;
}

.dashboard.animate .heatmap-section {
    animation: fadeInUp 0.5s ease-out 0.15s forwards;
    -webkit-backface-visibility: hidden;
    opacity: 0;
}
