/* ── Dashboard ── */

.dashboard-section {
    margin-bottom: 16px;
}

.dashboard-section-header {
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 6px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    user-select: none;
}
.dashboard-section-toggle {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    flex: 1;
    min-width: 0;
}

.dashboard-section-chevron {
    font-size: 0.6rem;
    color: var(--text-secondary);
    width: 10px;
    display: inline-block;
    transition: transform 0.2s ease;
}

.dashboard-section-count {
    background: var(--border-color);
    color: var(--text-secondary);
    border-radius: 10px;
    padding: 0 6px;
    font-size: 0.75rem;
    font-weight: 600;
}


.dashboard-subsection {
    margin-bottom: 10px;
    padding-left: 16px;
}

.dashboard-subsection .dashboard-section-content {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(500px, 100%), 1fr));
    gap: 4px;
}

.dashboard-subsection .dashboard-section-content .dashboard-target {
    margin-bottom: 0;
    min-width: 0;
}
.dashboard-subsection .dashboard-section-header {
    font-size: 0.72rem;
}

.dashboard-stop-all {
    margin-left: auto;
    padding: 2px 8px;
    font-size: 0.7rem;
    white-space: nowrap;
    flex: 0 0 auto;
}

.dashboard-poll-wrap {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 3px;
}

.dashboard-poll-slider {
    width: 48px;
    height: 12px;
    accent-color: var(--primary-color);
    cursor: pointer;
}

.dashboard-poll-value {
    font-size: 0.6rem;
    color: var(--text-secondary);
    min-width: 18px;
}

.dashboard-target {
    display: grid;
    grid-template-columns: 1fr auto auto;
    align-items: center;
    gap: 12px;
    padding: 6px 12px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    margin-bottom: 4px;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.dashboard-target:hover {
    box-shadow: 0 2px 8px var(--shadow-color);
}

.dashboard-card-link:hover {
    border-color: var(--primary-color);
    box-shadow: 0 4px 12px var(--shadow-color);
}

.dashboard-target-info {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
    overflow: hidden;
}

.dashboard-target-icon {
    font-size: 1rem;
    flex-shrink: 0;
    color: var(--primary-text-color);
}

.dashboard-target-info > div {
    min-width: 0;
    overflow: hidden;
}

.dashboard-target-name {
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    display: flex;
    align-items: center;
    gap: 4px;
}

.dashboard-target-name-text {
    overflow: hidden;
    text-overflow: ellipsis;
}

.dashboard-card-link {
    cursor: pointer;
}

.dashboard-target-name .health-dot {
    margin-right: 0;
    flex-shrink: 0;
}

.dashboard-target-subtitle {
    font-size: 0.7rem;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dashboard-target-metrics {
    display: grid;
    grid-template-columns: auto 72px 36px;
    gap: 8px;
    align-items: center;
}

.dashboard-metric {
    text-align: center;
    overflow: hidden;
}

.dashboard-metric-value {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--primary-text-color);
    line-height: 1.2;
    font-family: var(--font-mono, monospace);
    white-space: nowrap;
}

.dashboard-metric-label {
    font-size: 0.6rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.dashboard-fps-metric {
    display: flex;
    align-items: center;
    gap: 6px;
    overflow: hidden;
}

.dashboard-fps-sparkline {
    position: relative;
    width: 100px;
    height: 36px;
}

.dashboard-fps-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 44px;
    flex-shrink: 0;
    line-height: 1.1;
}

.dashboard-fps-target {
    font-weight: 400;
    opacity: 0.5;
    font-size: 0.75rem;
}

.dashboard-fps-avg {
    display: block;
    font-size: 0.6rem;
    font-weight: 400;
    opacity: 0.45;
    line-height: 1.1;
    color: var(--primary-color);
}

.dashboard-target-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.dashboard-action-btn {
    background: none;
    border: none;
    width: 28px;
    height: 28px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 4px;
    transition: color 0.2s, background 0.2s;
}

.dashboard-action-btn.start {
    color: var(--primary-color);
}

.dashboard-action-btn.start:hover {
    background: color-mix(in srgb, var(--primary-color) 12%, transparent);
}

.dashboard-action-btn.stop {
    color: var(--warning-color, #ffc107);
}

.dashboard-action-btn.stop:hover {
    background: rgba(255, 193, 7, 0.12);
}

.dashboard-autostart-btn {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.8rem;
    width: 24px;
    height: 24px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 4px;
    transition: color 0.2s, background 0.2s;
}

.dashboard-autostart-btn:hover {
    color: var(--warning-color, #ffc107);
    background: rgba(255, 193, 7, 0.1);
}

.dashboard-autostart-btn.active {
    color: var(--warning-color, #ffc107);
}

.dashboard-status-dot {
    font-size: 1rem;
    line-height: 1;
}

.dashboard-status-dot.active {
    color: var(--primary-color);
    animation: pulse 2s infinite;
}

.dashboard-no-targets {
    text-align: center;
    padding: 32px 16px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.dashboard-badge-stopped {
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 600;
    background: var(--border-color);
    color: var(--text-secondary);
    flex-shrink: 0;
}

.dashboard-badge-active {
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: 600;
    background: var(--primary-color);
    color: var(--primary-contrast);
    flex-shrink: 0;
}

.dashboard-automation {
    max-width: 500px;
}

.dashboard-automation .dashboard-target-metrics {
    min-width: 48px;
}

/* ── Integrations grid ── */
.dashboard-integrations-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 4px;
}

.dashboard-autostart-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 4px;
}

.dashboard-autostart {
    grid-template-columns: 1fr auto;
    margin-bottom: 0;
}

.dashboard-autostart .dashboard-target-info > div {
    min-width: 0;
}

@media (max-width: 768px) {
    .dashboard-target {
        grid-template-columns: 1fr auto;
        gap: 6px;
    }

    .dashboard-target-metrics {
        display: none;
    }
}

/* ===== PERFORMANCE CHARTS ===== */

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

@media (max-width: 900px) {
    .perf-charts-grid {
        grid-template-columns: 1fr;
    }
}

/* ── Per-metric accent colors ── */
.perf-chart-card {
    --perf-accent: var(--primary-color);
    --perf-accent-glow: transparent;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-top: 3px solid var(--perf-accent);
    border-radius: 6px;
    padding: 10px 0 0;
    min-width: 0;
    position: relative;
    transition: box-shadow var(--duration-normal) ease;
}

.perf-chart-card:hover {
    box-shadow: 0 0 16px var(--perf-accent-glow);
}

.perf-chart-card[data-metric="cpu"] {
    --perf-accent: #FF6B6B;
    --perf-accent-glow: rgba(255, 107, 107, 0.12);
}

.perf-chart-card[data-metric="ram"] {
    --perf-accent: #A855F7;
    --perf-accent-glow: rgba(168, 85, 247, 0.12);
}

.perf-chart-card[data-metric="gpu"] {
    --perf-accent: #10B981;
    --perf-accent-glow: rgba(16, 185, 129, 0.12);
}

.perf-chart-wrap {
    position: relative;
    height: 100px;
    overflow: hidden;
}

/* Subtle gradient wash in chart background */
.perf-chart-wrap::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, var(--perf-accent-glow), transparent 60%);
    pointer-events: none;
    z-index: 0;
}

.perf-chart-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0;
    padding: 0 12px;
}

.perf-chart-label {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    color: var(--perf-accent);
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Accent dot before label */
.perf-chart-label::before {
    content: '';
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--perf-accent);
    box-shadow: 0 0 6px var(--perf-accent);
    flex-shrink: 0;
}

.perf-chart-subtitle {
    position: absolute;
    top: 0;
    left: 12px;
    font-size: 0.6rem;
    font-weight: 400;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: calc(100% - 4px);
    pointer-events: none;
    z-index: 1;
}

/* ── Value display ── */
.perf-chart-value {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--perf-accent);
    font-family: var(--font-mono, monospace);
    display: flex;
    align-items: baseline;
    gap: 6px;
}

/* App value shown as subdued tag in "both" mode */
.perf-chart-value .perf-val-app {
    font-size: 0.65rem;
    font-weight: 500;
    color: var(--text-secondary);
    background: var(--hover-bg);
    padding: 2px 5px;
    border-radius: 3px;
    letter-spacing: 0.2px;
    vertical-align: middle;
    display: inline-flex;
    align-items: center;
}

.perf-chart-label .color-picker-swatch {
    width: 12px;
    height: 12px;
    vertical-align: middle;
}

.perf-chart-unavailable {
    text-align: center;
    padding: 20px 0;
    color: var(--text-secondary);
    font-size: 0.8rem;
}

/* ── Mode toggle ── */
.perf-mode-toggle {
    display: inline-flex;
    gap: 0;
    margin-left: auto;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    overflow: hidden;
}

.perf-mode-btn {
    background: transparent;
    border: none;
    color: var(--text-secondary);
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    padding: 2px 8px;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.perf-mode-btn:not(:last-child) {
    border-right: 1px solid var(--border-color);
}

.perf-mode-btn:hover {
    background: var(--hover-bg);
}

.perf-mode-btn.active {
    background: var(--primary-color);
    color: #fff;
}
