@import url('https://fonts.googleapis.com/css2?family=Lexend:wght@300;400;500;600;700;800&display=swap');
@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;600;700&display=swap');

:root {
    --bg: #0A0A0A;
    --bg-secondary: #141414;
    --bg-tertiary: #1E1E1E;
    --bg-elevated: #262626;
    --border: #262626;
    --border-subtle: #1E1E1E;
    --text: #FAFAFA;
    --text-muted: #A3A3A3;
    --text-dim: #666666;
    --accent: #4D52B8;
    --accent-hover: #6670D5;
    --accent-soft: rgba(77, 82, 184, 0.15);
    --green: #53BD4B;
    --yellow: #FAC637;
    --red: #D84545;
    --orange: #FF7A52;
    --purple: #B054D1;
    --cyan: #26C7DB;
    --blue: #28B6F6;
    --pink: #EC4899;
    --teal: #14B8A6;
    --radius: 10px;
    --radius-sm: 6px;
    --radius-lg: 14px;
    --font-mono: 'JetBrains Mono', 'SF Mono', monospace;
}

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

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Lexend', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ── Header ─────────────────────────────── */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 28px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left { display: flex; align-items: center; gap: 14px; }
.header-right { display: flex; align-items: center; gap: 10px; }

h1 {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.03em;
    color: var(--text);
}

.stat {
    font-family: var(--font-mono);
    font-size: 14px;
    font-weight: 600;
    color: var(--accent);
}

.stat-label {
    font-size: 12px;
    color: var(--text-muted);
    margin-right: 12px;
}

.header-select {
    margin-left: 8px;
    padding: 4px 8px;
    font-size: 12px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: inherit;
    cursor: pointer;
}

/* ── Badges ──────────────────────────────── */
.badge {
    font-size: 11px;
    font-weight: 500;
    padding: 2px 8px;
    border-radius: 10px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.badge-loading { background: var(--yellow); color: #000; }
.badge-ready { background: var(--green); color: #000; }
.badge-error { background: var(--red); color: #fff; }
.badge-syncing { background: var(--cyan); color: #000; }

/* ── Sync button ────────────────────────── */
.sync-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 2px;
    margin-left: 6px;
    color: var(--muted);
    display: inline-flex;
    align-items: center;
    vertical-align: middle;
    transition: color 0.2s;
}
.sync-btn:hover { color: var(--fg); }
.sync-btn svg { width: 14px; height: 14px; }
.sync-btn.spinning svg { animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Sync overlay ────────────────────────── */
.overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(13, 17, 23, 0.95);
    z-index: 200;
}

.overlay.hidden { display: none; }

.sync-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 40px 48px;
    text-align: center;
    min-width: 480px;
}

.sync-card h2 {
    font-size: 20px;
    margin-bottom: 24px;
    font-weight: 500;
}

.progress-bar-container {
    width: 100%;
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 16px;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--accent-hover));
    border-radius: 4px;
    transition: width 0.3s ease;
}

.sync-details {
    color: var(--text-muted);
    font-size: 13px;
    margin-bottom: 20px;
}

.sync-stats {
    display: flex;
    gap: 24px;
    justify-content: center;
}

.sync-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.sync-stat span {
    font-family: var(--font-mono);
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
}

.sync-stat label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 2px;
}

/* ── Tabs ────────────────────────────────── */
.tabs {
    display: flex;
    gap: 0;
    padding: 0 24px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
}

.tab {
    padding: 11px 18px;
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-muted);
    font-family: 'Lexend', sans-serif;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    letter-spacing: -0.01em;
}

.tab:hover { color: var(--text); }
.tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
    font-weight: 600;
}

.tab-content { display: none; padding: 24px 28px; }
.tab-content.active { display: block; }

/* ── Search ──────────────────────────────── */
.search-bar {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 16px;
}

.search-filters {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

input[type="text"], select {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    padding: 8px 12px;
    font-size: 13px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.15s;
}

input[type="text"]:focus, select:focus {
    border-color: var(--accent);
}

input[type="text"] { width: 100%; }
select { min-width: 120px; }

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 13px;
    color: var(--text-muted);
    cursor: pointer;
}

.btn {
    padding: 8px 16px;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    background: var(--bg-tertiary);
    color: var(--text);
}

.btn-primary {
    background: var(--accent);
    color: #000;
    border-color: var(--accent);
}

.btn-primary:hover {
    background: var(--accent-hover);
}

.btn-icon {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 20px;
    cursor: pointer;
    padding: 4px 8px;
}

.btn-icon:hover { color: var(--text); }

/* ── Results ─────────────────────────────── */
.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
    font-size: 12px;
    color: var(--text-muted);
}

.event-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* ── Type colors ─────────────────────────── */
.type-ai { color: var(--purple); }
.type-converse { color: #58d68d; }
.type-user { color: var(--green); }
.type-error { color: var(--red); }
.type-nav { color: var(--cyan); }
.type-auth { color: var(--yellow); }
.type-system { color: var(--orange); }
.type-default { color: var(--accent); }

/* ── Event cards (shared) ────────────────── */
.ev-card {
    padding: 8px 12px;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    border-left: 3px solid var(--border);
    cursor: pointer;
    transition: background 0.1s, border-color 0.1s;
}
.ev-card:hover { background: var(--bg-tertiary); border-left-color: var(--text-dim); }

.ev-card-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 4px;
}
.ev-card-type {
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.03em;
}
.ev-card-time {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-dim);
    margin-left: auto;
}
.ev-card-sub {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ev-badge {
    font-size: 9px;
    font-weight: 600;
    padding: 1px 5px;
    border-radius: 3px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.ev-badge-new { background: var(--accent); color: #000; }
.ev-badge-error { background: var(--red); color: #fff; }

/* ── GRAPHQL cards ───────────────────────── */
.ev-gql-request { border-left-color: var(--cyan); }
.ev-gql-request:hover { border-left-color: #66e0d0; }
.ev-gql-response { border-left-color: #4ea8de; }
.ev-gql-response:hover { border-left-color: #6db8e8; }
.ev-gql-error { border-left-color: var(--red); }
.ev-gql-error:hover { border-left-color: #ff7b73; }

.type-gql-req { color: var(--cyan); }
.type-gql-resp { color: #4ea8de; }

.gql-kind {
    font-family: var(--font-mono);
    font-size: 9px;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 3px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.gql-query { background: rgba(57, 210, 192, 0.15); color: var(--cyan); }
.gql-mutation { background: rgba(210, 153, 34, 0.2); color: var(--yellow); }

.gql-op {
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 600;
    color: var(--text);
}

.gql-vars {
    color: var(--text-dim);
    font-size: 11px;
}

.gql-shape {
    color: var(--text-muted);
    font-size: 11px;
}

/* GQL detail */
.gql-detail-op {
    display: flex;
    align-items: center;
    gap: 10px;
}
.gql-kind-badge {
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 3px;
    letter-spacing: 0.05em;
}
.gql-detail-op-name {
    font-family: var(--font-mono);
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
}

.gql-vars-grid {
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.gql-var {
    display: flex;
    gap: 8px;
    align-items: baseline;
    font-family: var(--font-mono);
    font-size: 12px;
}
.gql-var-key {
    color: var(--cyan);
    font-weight: 600;
    min-width: 60px;
}
.gql-var-val { color: var(--text-muted); }

.gql-query-text {
    font-family: var(--font-mono);
    font-size: 11px;
    line-height: 1.5;
    padding: 10px;
    background: var(--bg);
    border-radius: 4px;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 300px;
    overflow-y: auto;
    color: var(--text-muted);
}

/* GQL errors */
.gql-errors-section {
    background: rgba(248, 81, 73, 0.06);
    border: 1px solid rgba(248, 81, 73, 0.2);
    border-radius: var(--radius);
    padding: 10px;
}
.gql-error-item {
    margin-bottom: 6px;
}
.gql-error-item:last-child { margin-bottom: 0; }
.gql-error-msg {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--red);
    line-height: 1.4;
}
.gql-error-path {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--text-dim);
    margin-top: 2px;
}

/* GQL response data tree */
.gql-resp-tree {
    font-family: var(--font-mono);
    font-size: 12px;
    line-height: 1.5;
    background: var(--bg);
    border-radius: 4px;
    padding: 10px;
    max-height: 500px;
    overflow-y: auto;
}
.gql-indent { padding-left: 16px; }
.gql-field { margin: 1px 0; }
.gql-arr-item { margin: 1px 0; }
.gql-key { color: var(--accent); }
.gql-key::after { content: ': '; color: var(--text-dim); }
.gql-str { color: #a5d6a7; }
.gql-num { color: var(--yellow); font-weight: 600; }
.gql-bool { color: var(--purple); font-weight: 600; }
.gql-null { color: var(--text-dim); font-style: italic; }
.gql-typename {
    font-size: 10px;
    color: var(--text-dim);
    background: var(--bg-tertiary);
    padding: 0 4px;
    border-radius: 2px;
}
.gql-bracket { color: var(--text-dim); font-size: 11px; }
.gql-idx {
    color: var(--text-dim);
    font-size: 10px;
    margin-right: 6px;
}
.gql-idx::after { content: ':'; }
.gql-more {
    color: var(--text-dim);
    font-style: italic;
    font-size: 11px;
}

/* ── AI_REQUEST card ─────────────────────── */
.ev-ai-request { border-left-color: var(--purple); }
.ev-ai-request:hover { border-left-color: #d1a0ff; }

.ev-ai-row {
    display: flex;
    align-items: center;
    gap: 12px;
    font-family: var(--font-mono);
    font-size: 12px;
}
.ai-model {
    color: var(--purple);
    font-weight: 600;
    white-space: nowrap;
}
.ai-tokens { color: var(--text-muted); }
.ai-duration { color: var(--cyan); }
.ai-cost {
    color: var(--yellow);
    font-weight: 600;
}
.ai-finish { color: var(--text-dim); font-size: 10px; }
.finish-ok { color: var(--green); }
.finish-warn { color: var(--orange); }

/* ── USER_CONVERSES card ─────────────────── */
.ev-user-converses { border-left-color: #58d68d; }
.ev-user-converses:hover { border-left-color: #82e0aa; }

.uc-flow-row {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-mono);
    font-size: 12px;
    flex-wrap: wrap;
}
.uc-flow {
    color: #58d68d;
    font-weight: 600;
}
.uc-turn { color: var(--text-dim); font-size: 11px; }
.uc-cost { color: var(--yellow); font-weight: 600; }
.uc-dur { color: var(--cyan); }
.uc-ttft { color: var(--text-muted); font-size: 11px; }
.uc-tokens { color: var(--text-dim); font-size: 11px; }

.uc-input {
    margin-top: 4px;
    font-size: 12px;
    color: var(--text);
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
    padding-left: 1px;
}

/* ── Detail panel sections ───────────────── */
.detail-section {
    margin-bottom: 16px;
}
.detail-section-title {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 6px;
}
.detail-mono {
    font-family: var(--font-mono);
    font-size: 12px;
}
.detail-dim { color: var(--text-muted); }

/* Detail context bar */
.detail-context {
    padding-bottom: 12px;
    margin-bottom: 16px;
    border-bottom: 1px solid var(--border);
}
.detail-context-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
    margin-bottom: 6px;
}
.ctx-item {
    display: flex;
    align-items: center;
    gap: 4px;
}
.ctx-label {
    font-size: 10px;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.ctx-value {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-muted);
}
.ctx-mono { font-family: var(--font-mono); }
.ctx-clickable {
    color: var(--accent);
    cursor: pointer;
}
.ctx-clickable:hover { text-decoration: underline; }
.detail-time-full {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-dim);
}

/* AI_REQUEST detail */
.ai-detail-model {
    display: flex;
    align-items: baseline;
    gap: 10px;
}
.ai-model-name {
    font-family: var(--font-mono);
    font-size: 16px;
    font-weight: 700;
    color: var(--purple);
}
.ai-model-provider {
    font-size: 12px;
    color: var(--text-muted);
}

.ai-detail-stats {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    gap: 8px;
}
.stat-block {
    background: var(--bg-tertiary);
    border-radius: 4px;
    padding: 8px 10px;
    text-align: center;
}
.stat-value {
    font-family: var(--font-mono);
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
}
.stat-label {
    font-size: 10px;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-top: 2px;
}

.ai-messages {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.ai-msg {
    border-radius: 4px;
    overflow: hidden;
}
.ai-msg-role {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 3px 8px;
    background: var(--bg-tertiary);
    color: var(--text-dim);
}
.ai-msg-user .ai-msg-role { color: var(--green); }
.ai-msg-text {
    font-family: var(--font-mono);
    font-size: 11px;
    line-height: 1.5;
    padding: 8px;
    background: var(--bg);
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 300px;
    overflow-y: auto;
}
.ai-response-text {
    font-family: var(--font-mono);
    font-size: 11px;
    line-height: 1.5;
    padding: 10px;
    background: var(--bg);
    border-radius: 4px;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 400px;
    overflow-y: auto;
}

/* USER_CONVERSES detail */
.uc-detail-flow {
    display: flex;
    align-items: baseline;
    gap: 10px;
    flex-wrap: wrap;
}
.uc-detail-flow-name {
    font-size: 16px;
    font-weight: 700;
    color: #58d68d;
}
.uc-detail-flow-id {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-muted);
}
.uc-detail-selection {
    font-size: 11px;
    color: var(--text-dim);
    background: var(--bg-tertiary);
    padding: 2px 6px;
    border-radius: 3px;
}

.uc-input-display {
    font-size: 14px;
    line-height: 1.5;
    color: var(--text);
    padding: 10px;
    background: var(--bg);
    border-radius: 4px;
    border-left: 3px solid #58d68d;
}

.uc-cost-table {
    display: flex;
    flex-direction: column;
    gap: 3px;
}
.uc-cost-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-mono);
    font-size: 11px;
    padding: 4px 0;
    position: relative;
}
.uc-cost-bar {
    position: absolute;
    left: 0; top: 0; bottom: 0;
    background: rgba(210, 153, 34, 0.08);
    border-radius: 2px;
    pointer-events: none;
}
.uc-cost-desc {
    color: var(--text-muted);
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    position: relative;
    z-index: 1;
}
.uc-cost-val {
    color: var(--yellow);
    font-weight: 600;
    white-space: nowrap;
    position: relative;
    z-index: 1;
}

.uc-response-html {
    font-family: var(--font-mono);
    font-size: 11px;
    line-height: 1.5;
    padding: 10px;
    background: var(--bg);
    border-radius: 4px;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 400px;
    overflow-y: auto;
}

.uc-caps {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
}
.uc-cap-tag {
    font-family: var(--font-mono);
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 3px;
    background: var(--bg-tertiary);
    color: var(--text-muted);
}
.uc-cap-connector {
    background: rgba(88, 166, 255, 0.1);
    color: var(--accent);
}

/* Raw JSON toggle */
.detail-raw-toggle {
    cursor: pointer;
    user-select: none;
}
.detail-raw-toggle:hover { color: var(--text-muted); }
.toggle-arrow { font-size: 9px; margin-left: 4px; }
.detail-raw-body {
    font-family: var(--font-mono);
    font-size: 11px;
    line-height: 1.5;
    padding: 10px;
    background: var(--bg);
    border-radius: 4px;
    white-space: pre-wrap;
    word-break: break-all;
    max-height: 600px;
    overflow-y: auto;
}

/* ── Types grid ──────────────────────────── */
.types-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 8px;
}

.type-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    cursor: pointer;
    transition: background 0.1s;
}

.type-card:hover { background: var(--bg-tertiary); }

.type-name {
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 600;
}

.type-count {
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--text-muted);
}

/* ── Detail panel ────────────────────────── */
.detail-panel {
    position: fixed;
    right: 0;
    top: 0;
    bottom: 0;
    width: 50%;
    max-width: 700px;
    background: var(--bg-secondary);
    border-left: 1px solid var(--border);
    z-index: 150;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.2s ease;
}

.detail-panel.visible {
    transform: translateX(0);
}

.detail-panel.hidden { transform: translateX(100%); }

.detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
}

.detail-header h3 { font-size: 14px; font-weight: 600; }

.detail-body {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
}

.detail-body pre {
    font-family: var(--font-mono);
    font-size: 12px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-all;
}

.detail-field {
    margin-bottom: 12px;
}

.detail-field-label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 2px;
}

.detail-field-value {
    font-family: var(--font-mono);
    font-size: 12px;
}

.detail-field-value.clickable {
    color: var(--accent);
    cursor: pointer;
}

.detail-field-value.clickable:hover {
    text-decoration: underline;
}

/* ── Dashboard ───────────────────────────── */

.dash-section {
    margin-bottom: 24px;
}

.dash-title {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.dash-title-count {
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 400;
}

.dash-subtitle {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin: 12px 0 6px 0;
}

.dash-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
    margin-bottom: 14px;
}

.dash-card {
    background: var(--bg-secondary);
    border-radius: var(--radius);
    padding: 14px 16px;
    border: 1px solid var(--border);
    transition: border-color 0.15s;
}

.dash-card:hover { border-color: var(--text-dim); }

.dash-card-value {
    font-family: var(--font-mono);
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
    line-height: 1.2;
    letter-spacing: -0.02em;
}

.dash-card-label {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
    font-weight: 400;
}

.dash-card-cost .dash-card-value { color: var(--yellow); }
.dash-card-error .dash-card-value { color: var(--red); }

/* ── Activity: Hero Stats ──────────────── */
.hero-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 14px;
    margin-bottom: 24px;
}

.hero-stat {
    background: linear-gradient(135deg, var(--bg-secondary) 0%, var(--bg-tertiary) 100%);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 20px 22px;
    position: relative;
    overflow: hidden;
}

.hero-stat::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    border-radius: 4px 0 0 4px;
}

.hero-stat-value {
    font-family: var(--font-mono);
    font-size: 30px;
    font-weight: 700;
    line-height: 1.1;
}

.hero-stat-label {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 6px;
}

.hero-stat-sub {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-dim);
    margin-top: 6px;
}

/* Hero interactivity */
.hero-stat {
    cursor: pointer;
    transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
}
.hero-stat:hover {
    border-color: var(--text-dim);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
.hero-stat.hero-active {
    border-color: var(--text-muted);
    box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}

/* Hero color variants */
.hero-users::before { background: var(--cyan); }
.hero-users .hero-stat-value { color: var(--cyan); }
.hero-users.hero-active { border-color: var(--cyan); }
.hero-opens::before { background: var(--accent); }
.hero-opens .hero-stat-value { color: var(--accent); }
.hero-opens.hero-active { border-color: var(--accent); }
.hero-convos::before { background: var(--green); }
.hero-convos .hero-stat-value { color: var(--green); }
.hero-convos.hero-active { border-color: var(--green); }
.hero-social::before { background: var(--purple); }
.hero-social .hero-stat-value { color: var(--purple); }
.hero-social.hero-active { border-color: var(--purple); }
.hero-shares::before { background: var(--orange); }
.hero-shares .hero-stat-value { color: var(--orange); }
.hero-shares.hero-active { border-color: var(--orange); }
.hero-errors::before { background: var(--red); }
.hero-errors .hero-stat-value { color: var(--red); }
.hero-errors.hero-active { border-color: var(--red); }

/* ── Activity Detail Expand ──────────── */
.activity-detail-panel {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 24px 28px;
    margin-bottom: 24px;
    animation: detailSlideIn 0.2s ease-out;
    position: relative;
    border-left: 4px solid var(--border);
}
.activity-detail-panel.detail-users { border-left-color: var(--cyan); }
.activity-detail-panel.detail-opens { border-left-color: var(--accent); }
.activity-detail-panel.detail-convos { border-left-color: var(--green); }
.activity-detail-panel.detail-social { border-left-color: var(--purple); }
.activity-detail-panel.detail-shares { border-left-color: var(--orange); }
.activity-detail-panel.detail-errors { border-left-color: var(--red); }

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

.detail-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.detail-panel-title {
    font-size: 16px;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.detail-panel-close {
    background: none;
    border: none;
    color: var(--text-dim);
    font-size: 20px;
    cursor: pointer;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    transition: color 0.15s, background 0.15s;
}
.detail-panel-close:hover {
    color: var(--text);
    background: var(--bg-tertiary);
}

.detail-panel-metrics {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.detail-metric {
    background: var(--bg);
    border-radius: 8px;
    padding: 14px 12px;
    text-align: center;
}

.detail-metric-value {
    font-family: var(--font-mono);
    font-size: 22px;
    font-weight: 700;
    line-height: 1.2;
    color: var(--text);
}

.detail-metric-label {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 4px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.detail-metric-sub {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--text-dim);
    margin-top: 2px;
}

.detail-metric-highlight .detail-metric-value { color: var(--cyan); }
.detail-metric-accent .detail-metric-value { color: var(--accent); }
.detail-metric-green .detail-metric-value { color: var(--green); }
.detail-metric-purple .detail-metric-value { color: var(--purple); }
.detail-metric-orange .detail-metric-value { color: var(--orange); }
.detail-metric-yellow .detail-metric-value { color: var(--yellow); }
.detail-metric-red .detail-metric-value { color: var(--red); }

/* ── Activity: Metric Groups ───────────── */
.groups-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

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

.metric-group {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 18px 20px;
    border-left: 3px solid var(--border);
}

.mg-engagement { border-left-color: var(--cyan); }
.mg-social { border-left-color: #58d68d; }
.mg-sharing { border-left-color: var(--purple); }
.mg-growth { border-left-color: var(--accent); }
.mg-monetization { border-left-color: var(--yellow); }

.mg-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
}

.mg-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.mg-engagement .mg-dot { background: var(--cyan); }
.mg-social .mg-dot { background: #58d68d; }
.mg-sharing .mg-dot { background: var(--purple); }
.mg-growth .mg-dot { background: var(--accent); }
.mg-monetization .mg-dot { background: var(--yellow); }

.mg-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
}

.mg-count {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-dim);
    margin-left: auto;
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.metric {
    text-align: center;
    padding: 8px 4px;
    border-radius: 6px;
    background: var(--bg);
}

.metric-value {
    font-family: var(--font-mono);
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
    line-height: 1.2;
}

.metric-label {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 3px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.metric-accent { color: var(--cyan); }
.metric-green { color: var(--green); }
.metric-purple { color: var(--purple); }
.metric-yellow { color: var(--yellow); }
.metric-red { color: var(--red); }

/* ── Funnel visualization ──────────────── */
.funnel {
    display: flex;
    flex-direction: column;
    gap: 5px;
    margin-top: 14px;
}

.funnel-step {
    display: flex;
    align-items: center;
    gap: 10px;
}

.funnel-label {
    font-size: 11px;
    color: var(--text-muted);
    min-width: 110px;
    text-align: right;
    flex-shrink: 0;
}

.funnel-track {
    flex: 1;
    height: 26px;
    background: var(--bg);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}

.funnel-bar {
    height: 100%;
    border-radius: 4px;
    display: flex;
    align-items: center;
    padding: 0 10px;
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 600;
    min-width: fit-content;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.funnel-bar-purple { background: linear-gradient(90deg, rgba(188, 140, 255, 0.7), rgba(188, 140, 255, 0.4)); color: var(--purple); }
.funnel-bar-blue { background: linear-gradient(90deg, rgba(88, 166, 255, 0.7), rgba(88, 166, 255, 0.4)); color: var(--accent); }
.funnel-bar-green { background: linear-gradient(90deg, rgba(63, 185, 80, 0.7), rgba(63, 185, 80, 0.4)); color: var(--green); }

.funnel-value {
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 600;
    color: var(--text);
    min-width: 40px;
    text-align: right;
    flex-shrink: 0;
}

.funnel-pct {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--text-dim);
    min-width: 40px;
    flex-shrink: 0;
}

.dash-table {
    background: var(--bg-secondary);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    overflow: hidden;
}

.dash-table-header {
    display: flex;
    padding: 6px 12px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-dim);
    background: var(--bg-tertiary);
    border-bottom: 1px solid var(--border);
}

.dash-table-row {
    display: flex;
    padding: 5px 12px;
    font-size: 12px;
    border-bottom: 1px solid var(--border);
    transition: background 0.1s;
}

.dash-table-row:last-child { border-bottom: none; }
.dash-table-row-clickable { cursor: pointer; }
.dash-table-row-clickable:hover { background: var(--bg-tertiary); }

.col-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.col-num {
    width: 90px;
    text-align: right;
    font-family: var(--font-mono);
    font-size: 12px;
    flex-shrink: 0;
}

.mono { font-family: var(--font-mono); }
.cost-val { color: var(--yellow); font-weight: 600; }
.error-val { color: var(--red); font-weight: 600; }
.dim { color: var(--text-dim); }

.dash-empty {
    padding: 16px;
    text-align: center;
    color: var(--text-dim);
    font-size: 13px;
}

/* ── Session cards ──────────────────────────── */
.session-card {
    padding: 8px 12px;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    border-left: 3px solid var(--accent);
    cursor: pointer;
    transition: background 0.1s;
    margin-bottom: 4px;
}

.session-card:hover { background: var(--bg-tertiary); }
.session-card-error { border-left-color: var(--red); }

.session-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 4px;
}

.session-id {
    font-family: var(--font-mono);
    font-size: 12px;
    font-weight: 600;
    color: var(--accent);
}

.session-time {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-dim);
}

.session-card-stats {
    display: flex;
    gap: 10px;
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-muted);
}

.session-stat { white-space: nowrap; }

.session-card-types {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--text-dim);
    margin-top: 3px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ── Chart placeholders ─────────────────── */
.chart-placeholder {
    background: var(--bg-tertiary);
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    padding: 20px 24px;
    text-align: center;
    margin-bottom: 12px;
}
.chart-placeholder-label {
    font-family: var(--font-mono);
    font-size: 9px;
    font-weight: 700;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 4px;
}
.chart-placeholder-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 4px;
}
.chart-placeholder-data {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-dim);
}

/* ── Follow bar (explorer) ─────────────── */
.follow-bar {
    display: flex;
    gap: 8px;
    align-items: center;
    padding-top: 8px;
    border-top: 1px solid var(--border);
}
.follow-bar input[type="text"] {
    flex: 1;
    min-width: 200px;
}

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

::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }
