:root {
    --bg: #12161c;
    --surface: #1a1f28;
    --surface-hover: #242a34;
    --border: #2a3040;
    --text: #e6edf3;
    --text-secondary: #a8b2bd;
    --text-muted: #6e7a88;
    --primary: #e8542e;
    --primary-light: #e8542e15;
    --primary-dark: #c73e1d;
    --primary-glow: #e8542e40;
    --success: #4ade80;
    --success-light: #4ade8015;
    --warning: #facc15;
    --warning-light: #facc1515;
    --danger: #f87171;
    --danger-light: #f8717115;
    --info: #60a5fa;
    --info-light: #60a5fa15;
    --neutral: #6e7a88;
    --neutral-light: #242a34;
    --super-active: #00cec9;
    --super-active-light: #00cec915;
    --excellent: #a855f7;
    --excellent-light: #a855f715;
    --sidebar-width: 220px;
    --header-height: 60px;
    --shadow: rgba(0, 0, 0, 0.3);
}

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

body {
    font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Layout */
.app-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: var(--sidebar-width);
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 10;
}

.sidebar-brand {
    padding: 1.25rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.brand-icon {
    width: 32px;
    height: 32px;
    background: radial-gradient(circle, #e8542e 40%, #c73e1d);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 12px var(--primary-glow);
}

.brand-icon span {
    color: white;
    font-weight: 800;
    font-size: 13px;
}

.brand-name {
    color: var(--text);
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: -0.02em;
    display: block;
}

.brand-sub {
    color: var(--text-muted);
    font-size: 0.55rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    display: block;
}

.sidebar-nav {
    flex: 1;
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sidebar-footer {
    padding: 0.75rem;
    border-top: 1px solid var(--border);
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.55rem 0.75rem;
    border-radius: 8px;
    border-left: 2px solid transparent;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.8rem;
    transition: all 0.15s;
}

.nav-item:hover {
    background: var(--surface-hover);
    color: var(--text);
}

.nav-item.active {
    background: var(--primary-light);
    color: var(--primary);
    border-left-color: var(--primary);
    font-weight: 600;
}

.nav-icon {
    font-size: 1.1rem;
    width: 20px;
    text-align: center;
    color: var(--text-secondary);
}

.nav-item.active .nav-icon {
    color: var(--primary);
}

.nav-label {
    font-size: 0.8rem;
}

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 1.5rem 2rem;
    min-height: 100vh;
}

.page-header {
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.page-header h1 {
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.page-header p {
    color: var(--text-muted);
    font-size: 0.75rem;
    margin-top: 0.25rem;
}

/* Metric Cards */
.metric-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.metric-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1rem;
    position: relative;
    overflow: hidden;
}

.metric-card .label {
    color: var(--text-muted);
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 0.5rem;
}

.metric-card .value {
    color: var(--text);
    font-size: 1.6rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    font-variant-numeric: tabular-nums;
}

.metric-card .progress-bottom,
.card .progress-bottom {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 3px;
}

.metric-card .change {
    font-size: 0.7rem;
    font-weight: 600;
    margin-top: 0.4rem;
}

.metric-card .change.positive { color: var(--success); }
.metric-card .change.negative { color: var(--danger); }
.metric-card .change.warning { color: var(--warning); }

.signal-bars {
    display: flex;
    align-items: flex-end;
    gap: 2px;
    margin-top: 0.4rem;
}

.signal-bar {
    width: 3px;
    border-radius: 1px;
    background: var(--border);
}

.signal-bar.active-1 { height: 8px; }
.signal-bar.active-2 { height: 12px; }
.signal-bar.active-3 { height: 16px; }
.signal-bar.active-4 { height: 20px; }
.signal-bar.active-5 { height: 24px; }

.signal-bars .signal-label {
    font-size: 0.6rem;
    margin-left: 3px;
    font-weight: 500;
}

/* Content Cards */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.25rem;
    position: relative;
    overflow: hidden;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.card-title {
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
}

/* Group Cards */
.group-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.25rem;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    transition: border-color 0.15s;
}

.group-card:hover {
    border-color: #3a4050;
}

.group-card .top-border {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
}

.group-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.75rem;
}

.group-card-name {
    color: var(--text);
    font-size: 0.95rem;
    font-weight: 600;
}

.group-card-members {
    color: var(--text-muted);
    font-size: 0.65rem;
    margin-top: 2px;
}

.group-card-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
}

.group-card-stats .label {
    color: var(--text-muted);
    font-size: 0.55rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.group-card-stats .value {
    font-size: 1rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.metric-sm {
    font-size: 1rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--text);
}

.group-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    color: white;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 0.15rem 0.45rem;
    border-radius: 5px;
    font-size: 0.55rem;
    font-weight: 600;
}

.badge .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.badge-success { background: var(--success-light); color: var(--success); }
.badge-success .dot { background: var(--success); box-shadow: 0 0 4px #4ade8060; }
.badge-warning { background: var(--warning-light); color: var(--warning); }
.badge-warning .dot { background: var(--warning); box-shadow: 0 0 4px #facc1560; }
.badge-danger { background: var(--danger-light); color: var(--danger); }
.badge-danger .dot { background: var(--danger); box-shadow: 0 0 4px #f8717160; }
.badge-primary { background: var(--primary-light); color: var(--primary); }
.badge-primary .dot { background: var(--primary); box-shadow: 0 0 4px var(--primary-glow); }
.badge-info { background: var(--info-light); color: var(--info); }
.badge-info .dot { background: var(--info); box-shadow: 0 0 4px #60a5fa60; }
.badge-neutral { background: var(--neutral-light); color: var(--text-secondary); }
.badge-neutral .dot { background: var(--text-secondary); box-shadow: 0 0 4px #6e7a8860; }
.badge-excellent { background: var(--excellent-light); color: var(--excellent); }
.badge-excellent .dot { background: var(--excellent); box-shadow: 0 0 4px #a855f760; }
.badge-positive { background: var(--success-light); color: var(--success); }
.badge-positive .dot { background: var(--success); box-shadow: 0 0 4px #4ade8060; }
.badge-negative { background: var(--danger-light); color: var(--danger); }
.badge-negative .dot { background: var(--danger); box-shadow: 0 0 4px #f8717160; }
.badge-attention { background: var(--warning-light); color: var(--warning); }
.badge-attention .dot { background: var(--warning); box-shadow: 0 0 4px #facc1560; }
.topic-tag-1 { background: rgba(232, 84, 46, 0.12); color: #e8542e; }
.topic-tag-2 { background: rgba(250, 204, 21, 0.12); color: #facc15; }
.topic-tag-3 { background: rgba(96, 165, 250, 0.12); color: #60a5fa; }
.topic-tag-4 { background: rgba(74, 222, 128, 0.12); color: #4ade80; }
.topic-tag-5 { background: rgba(168, 85, 247, 0.12); color: #a855f7; }
.topic-tag-6 { background: rgba(251, 146, 60, 0.12); color: #fb923c; }
.topic-tag-7 { background: rgba(45, 212, 191, 0.12); color: #2dd4bf; }
.topic-tag-8 { background: rgba(244, 114, 182, 0.12); color: #f472b6; }

.tag {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 8px;
    font-size: 0.7rem;
    font-weight: 500;
}

/* Toolbar */
.toolbar {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    margin-bottom: 1.25rem;
}

.filter-select, .filter-input {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 0.4rem 0.8rem;
    border-radius: 8px;
    font-size: 0.7rem;
    font-family: inherit;
}

.filter-select:focus, .filter-input:focus {
    outline: none;
    border-color: var(--primary);
}

.btn {
    padding: 0.4rem 0.8rem;
    border-radius: 8px;
    font-size: 0.7rem;
    border: none;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s;
}

.btn-primary {
    background: var(--primary);
    color: white;
    font-weight: 600;
    box-shadow: 0 0 12px var(--primary-glow);
}

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

.btn-ghost {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-secondary);
}

.btn-ghost:hover {
    background: var(--surface-hover);
    color: var(--text);
}

.btn-danger {
    background: var(--danger-light);
    border: 1px solid #f8717130;
    color: var(--danger);
}

/* Table */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    color: var(--text-muted);
    font-size: 0.6rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    text-align: left;
    padding: 0.5rem 0.75rem;
    font-weight: 600;
    border-bottom: 1px solid var(--border);
}

.data-table td {
    padding: 0.65rem 0.75rem;
    border-bottom: 1px solid #2a304060;
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
}

.data-table tr:last-child td {
    border-bottom: none;
}

.data-table td.name {
    color: var(--text);
    font-weight: 600;
}

/* Loading / Empty */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}

.loading {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}

/* Progress Bar */
.progress-bar {
    height: 3px;
    background: var(--border);
    border-radius: 2px;
    overflow: hidden;
}

.progress-bar .fill {
    height: 100%;
    border-radius: 2px;
}

/* Sparkline */
.sparkline {
    display: flex;
    align-items: flex-end;
    gap: 2px;
    height: 24px;
}

.sparkline .spark-bar {
    flex: 1;
    border-radius: 2px 2px 0 0;
    min-width: 0;
}

/* Status Bar */
.status-bar {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.55rem 1rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.5rem;
    font-size: 0.7rem;
}

.status-bar .sep {
    color: var(--border);
}

.status-bar .live {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.status-bar .live-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 6px #4ade8060;
}

.status-bar .live-text {
    color: var(--success);
    font-weight: 600;
}

/* Feed */
.feed-item {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    padding-bottom: 0.6rem;
    border-bottom: 1px solid #2a304040;
}

.feed-item:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.feed-time {
    color: var(--text-muted);
    font-size: 0.6rem;
    font-family: monospace;
    min-width: 38px;
    margin-top: 2px;
}

/* Grid helpers */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 0.75rem; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.75rem; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.75rem; }
.grid-5 { display: grid; grid-template-columns: repeat(5, 1fr); gap: 0.75rem; }
.grid-1-5-1 { display: grid; grid-template-columns: 1.5fr 1fr; gap: 0.75rem; }

/* Period selector */
.period-selector {
    display: flex;
    gap: 0.25rem;
    margin-bottom: 1.5rem;
    background: var(--neutral-light);
    border-radius: 8px;
    padding: 0.25rem;
    width: fit-content;
}

.period-btn {
    padding: 0.4rem 1rem;
    border: none;
    border-radius: 6px;
    background: transparent;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
}

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

.period-btn.active {
    background: var(--surface);
    color: var(--text);
    box-shadow: 0 1px 3px var(--shadow);
}

/* Group Cards Selector */
.group-cards {
    display: flex;
    gap: 0.75rem;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin-bottom: 1.5rem;
    padding-bottom: 0.25rem;
}

.group-card.active {
    border-color: var(--primary);
    background: var(--primary-light);
}

.group-card.active .group-card-name {
    color: var(--primary);
}

/* Heatmap */
.heatmap-grid {
    display: grid;
    grid-template-columns: 40px repeat(24, 1fr);
    gap: 2px;
    font-size: 0.65rem;
}

.heatmap-label {
    display: flex;
    align-items: center;
    color: var(--text-muted);
    font-weight: 500;
}

.heatmap-hour-label {
    text-align: center;
    color: var(--text-muted);
    font-weight: 500;
    font-size: 0.6rem;
}

.heatmap-cell {
    aspect-ratio: 1;
    border-radius: 3px;
    min-height: 16px;
}

.heatmap-footer {
    display: flex;
    gap: 1.5rem;
    margin-top: 0.75rem;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.heatmap-footer strong {
    color: var(--text);
}

/* Sentiment Gauge */
.gauge-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1rem 0;
}

.gauge {
    width: 160px;
    height: 80px;
    position: relative;
    overflow: hidden;
}

.gauge-bg {
    width: 160px;
    height: 160px;
    border-radius: 50%;
    background: conic-gradient(
        var(--danger) 0deg,
        var(--warning) 90deg,
        var(--success) 180deg
    );
    mask: radial-gradient(circle at center, transparent 55px, black 56px);
    -webkit-mask: radial-gradient(circle at center, transparent 55px, black 56px);
}

.gauge-needle {
    position: absolute;
    bottom: 0;
    left: 50%;
    width: 3px;
    height: 60px;
    background: var(--text);
    transform-origin: bottom center;
    border-radius: 2px;
    margin-left: -1.5px;
}

.gauge-value {
    font-size: 1.5rem;
    font-weight: 700;
    margin-top: 0.5rem;
}

.gauge-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.sentiment-counters {
    display: flex;
    gap: 1.5rem;
    margin-top: 1rem;
    font-size: 0.8rem;
}

.sentiment-counter {
    text-align: center;
}

.sentiment-counter .count {
    font-weight: 700;
    font-size: 1.1rem;
}

.sentiment-counter .label {
    color: var(--text-muted);
    font-size: 0.7rem;
    text-transform: uppercase;
}

/* Lurker Boxes */
.lurker-boxes {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
}

.lurker-box {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1rem;
    text-align: center;
}

.lurker-box .count {
    font-size: 1.75rem;
    font-weight: 700;
}

.lurker-box .pct {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.lurker-box .label {
    font-size: 0.7rem;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-top: 0.25rem;
}

.lurker-box.lurker-total .count { color: var(--primary); }
.lurker-box.lurker-recent .count { color: var(--warning); }
.lurker-box.lurker-active .count { color: var(--success); }

/* Evolution Bars */
.evolution-bars {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.evolution-week {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
}

.evolution-week .week-label {
    width: 80px;
    color: var(--text-muted);
    flex-shrink: 0;
}

.evolution-bar-track {
    flex: 1;
    display: flex;
    gap: 2px;
    height: 20px;
}

.evolution-bar {
    height: 100%;
    border-radius: 3px;
    min-width: 2px;
}

.evolution-bar.joins { background: var(--success); }
.evolution-bar.leaves { background: var(--danger); }

.evolution-week .week-count {
    width: 60px;
    text-align: right;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* Stat Box (for churn, participation) */
.stat-highlight {
    text-align: center;
    padding: 1rem 0;
}

.stat-highlight .big-number {
    font-size: 2.5rem;
    font-weight: 700;
    line-height: 1;
}

.stat-highlight .big-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 0.25rem;
}

.stat-row {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-top: 1rem;
    font-size: 0.8rem;
}

.stat-row .stat-item {
    text-align: center;
}

.stat-row .stat-item .value {
    font-weight: 600;
}

.stat-row .stat-item .label {
    color: var(--text-muted);
    font-size: 0.7rem;
    text-transform: uppercase;
}

/* Period Comparison */
.comparison-table {
    width: 100%;
    border-collapse: collapse;
}

.comparison-table th {
    padding: 0.75rem;
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    text-align: center;
}

.comparison-table th:first-child {
    text-align: left;
}

.comparison-table td {
    padding: 0.75rem;
    border-bottom: 1px solid var(--border);
    font-size: 0.85rem;
    text-align: center;
}

.comparison-table td:first-child {
    text-align: left;
    font-weight: 500;
}

.trend-up { color: var(--success); }
.trend-down { color: var(--danger); }
.trend-flat { color: var(--text-muted); }

/* Member Cards */
.member-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 1rem;
}

.member-card {
    background: var(--surface);
    border-radius: 12px;
    border: 1px solid var(--border);
    padding: 1.25rem;
}

.member-card-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.member-avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    color: white;
    flex-shrink: 0;
}

img.member-avatar-img {
    object-fit: cover;
    background: none;
}

.member-info {
    flex: 1;
    min-width: 0;
}

.member-name {
    font-weight: 600;
    font-size: 0.95rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.member-phone {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.member-group {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.1rem;
}

.engagement-section {
    margin-top: 0.75rem;
    margin-bottom: 1rem;
}

.engagement-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.35rem;
}

.engagement-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.engagement-value {
    font-size: 0.75rem;
    font-weight: 600;
}

.engagement-bar {
    width: 100%;
    height: 6px;
    background: var(--border);
    border-radius: 3px;
    overflow: hidden;
}

.engagement-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.3s ease;
}

.member-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    margin-bottom: 1rem;
    border-top: 1px solid var(--border);
    padding-top: 0.75rem;
}

.member-stat {
    text-align: center;
}

.member-stat-icon {
    font-size: 1rem;
    color: var(--text-muted);
    margin-bottom: 0.25rem;
}

.member-stat-value {
    font-weight: 700;
    font-size: 1.1rem;
}

.member-stat-label {
    font-size: 0.65rem;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.05em;
}

.btn-whatsapp {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.6rem;
    border: 1px solid var(--success);
    border-radius: 8px;
    background: transparent;
    color: var(--success);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.15s;
}

.btn-whatsapp:hover {
    background: var(--success);
    color: white;
}

.member-count-text {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

/* Member Cards - Redesign */
.member-card .level-border {
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    width: 3px;
}

.member-card-body {
    display: flex;
    gap: 0.75rem;
}

/* Engagement Distribution Bar */
.engagement-segments {
    display: flex;
    height: 8px;
    border-radius: 4px;
    overflow: hidden;
    gap: 2px;
}

.engagement-legend {
    display: flex;
    gap: 1.5rem;
    margin-top: 0.5rem;
    flex-wrap: wrap;
}

.engagement-legend-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.engagement-legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 2px;
}

.engagement-legend-text {
    color: var(--text-muted);
    font-size: 0.6rem;
}

.member-card { cursor: pointer; transition: opacity 0.2s, filter 0.2s; }

.member-left {
    opacity: 0.5;
    filter: grayscale(60%);
}

.left-badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    font-size: 0.65rem;
    font-weight: 600;
    background: rgba(214,48,49,0.15);
    color: #d63031;
    margin-left: 0.4rem;
    vertical-align: middle;
}

.left-date {
    color: #d63031;
    font-size: 0.75rem;
}

.group-count-badge {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    font-size: 0.65rem;
    font-weight: 600;
    background: rgba(9,132,227,0.15);
    color: #0984e3;
    margin-left: 0.4rem;
    vertical-align: middle;
}

.member-avatar-placeholder {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    color: white;
    flex-shrink: 0;
}

.engagement-tag {
    display: inline-block;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 600;
}

.member-groups-breakdown {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.group-breakdown-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.8rem;
    padding: 0.35rem 0.5rem;
    background: rgba(108,92,231,0.04);
    border-radius: 6px;
}

.group-breakdown-row .group-name {
    flex: 1;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.filter-toggle {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    cursor: pointer;
    white-space: nowrap;
}

.filter-toggle input[type="checkbox"] {
    accent-color: var(--primary);
}

/* ===== Engagement Tags ===== */
.tag-legend {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
}

.tag-legend-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.badge-super-active { background: rgba(0,206,201,0.15); color: #00cec9; }
.badge-engaged { background: rgba(0,184,148,0.15); color: #00b894; }
.badge-cooling { background: rgba(253,203,110,0.15); color: #fdcb6e; }
.badge-inactive { background: rgba(225,112,85,0.15); color: #e17055; }
.badge-lost { background: rgba(99,110,114,0.2); color: #636e72; }

/* ===== Filters Toolbar ===== */
.filters-bar {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
    align-items: center;
}

.period-tabs {
    display: flex;
    gap: 0.25rem;
    background: var(--surface);
    border-radius: 8px;
    padding: 0.25rem;
    border: 1px solid var(--border);
}

.period-tab {
    padding: 0.35rem 0.65rem;
    border-radius: 6px;
    font-size: 0.8rem;
    cursor: pointer;
    color: var(--text-muted);
    background: transparent;
    border: none;
    transition: all 0.2s;
}

.period-tab:hover { color: var(--text); }
.period-tab.active { background: var(--primary); color: white; }

/* ===== Extra Metrics ===== */
.extra-metrics {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    margin-bottom: 1rem;
    border-top: 1px solid var(--border);
    padding-top: 0.75rem;
}

.extra-metric {
    background: rgba(108,92,231,0.05);
    border: 1px solid rgba(108,92,231,0.12);
    border-radius: 8px;
    padding: 0.6rem;
    text-align: center;
}

.extra-metric-value { font-weight: 700; font-size: 1rem; }
.extra-metric-label { color: var(--text-muted); font-size: 0.65rem; margin-top: 0.15rem; text-transform: uppercase; }

.trend-badge {
    font-size: 0.7rem;
    font-weight: 600;
    margin-left: 0.25rem;
}

.trend-badge.up { color: var(--success); }
.trend-badge.down { color: var(--danger); }
.trend-badge.flat { color: var(--text-muted); }

/* ===== Expandable Detail Panel ===== */
.member-detail-overlay {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 420px;
    background: var(--bg);
    border-left: 1px solid var(--border);
    padding: 1.5rem;
    overflow-y: auto;
    z-index: 100;
    box-shadow: -4px 0 20px rgba(0,0,0,0.3);
}

.detail-close {
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    padding: 0.35rem 0.75rem;
    cursor: pointer;
    font-size: 0.85rem;
    margin-bottom: 1rem;
}

.detail-section-title {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 1.25rem 0 0.75rem;
}

.activity-chart {
    display: flex;
    align-items: flex-end;
    gap: 2px;
    height: 80px;
    margin-bottom: 0.5rem;
}

.chart-bar {
    flex: 1;
    background: var(--primary);
    border-radius: 2px 2px 0 0;
    min-height: 2px;
    opacity: 0.7;
    transition: opacity 0.15s;
}

.chart-bar:hover { opacity: 1; }

.chart-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.group-list { display: flex; flex-direction: column; gap: 0.4rem; }

.group-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.75rem;
    background: rgba(108,92,231,0.05);
    border-radius: 8px;
    font-size: 0.85rem;
}

.group-item-msgs { color: var(--text-muted); font-size: 0.8rem; }

.group-item-detail {
    background: rgba(108,92,231,0.05);
    border-radius: 8px;
    padding: 0.75rem;
}

.group-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.group-item-name { font-weight: 600; font-size: 0.85rem; }

.group-item-engagement { margin-bottom: 0.5rem; }

.group-item-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.25rem;
    text-align: center;
}

/* ===== Churn Alert ===== */
.churn-alert {
    background: rgba(225,112,85,0.08);
    border: 1px solid rgba(225,112,85,0.25);
    border-radius: 12px;
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}

.churn-icon {
    width: 40px;
    height: 40px;
    background: rgba(225,112,85,0.15);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.1rem;
    color: #e17055;
    flex-shrink: 0;
}

.churn-text { flex: 1; }
.churn-text strong { color: #e17055; }
.churn-text p { color: var(--text-muted); font-size: 0.85rem; margin-top: 0.2rem; }

.churn-card {
    background: var(--surface);
    border: 1px solid rgba(225,112,85,0.2);
    border-radius: 12px;
    padding: 1rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.churn-info { flex: 1; }
.churn-name { font-weight: 600; font-size: 0.9rem; }
.churn-detail { color: var(--text-muted); font-size: 0.8rem; }
.churn-was { color: #fdcb6e; font-size: 0.75rem; }

.churn-action {
    padding: 0.35rem 0.65rem;
    background: rgba(225,112,85,0.12);
    border: 1px solid rgba(225,112,85,0.3);
    border-radius: 6px;
    color: #e17055;
    font-size: 0.75rem;
    text-decoration: none;
    white-space: nowrap;
}

.churn-action:hover {
    background: rgba(225,112,85,0.25);
}

/* ===== Detail panel backdrop ===== */
.detail-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 99;
}

/* ===== Group detail member grid ===== */
.group-member-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1rem;
}


select {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
}

/* Activity Feed */
.activity-feed { max-height: 400px; overflow-y: auto; }
.feed-icon { width: 24px; text-align: center; font-size: 1.1rem; }
.feed-description { flex: 1; }
.feed-participant-joined .feed-icon { color: var(--success); }
.feed-participant-left .feed-icon { color: var(--danger); }
.feed-group-updated .feed-icon { color: var(--primary); }

/* ===== Ranked Hot Topics ===== */
.ranked-topics { padding: 0.5rem 0; }
.ranked-topic {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
}
.ranked-topic:last-child { border-bottom: none; }
.rt-rank {
    width: 28px; height: 28px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 0.78rem; flex-shrink: 0; margin-top: 2px;
}
.rt-rank.r1 { background: var(--primary-light); color: var(--primary); }
.rt-rank.r2 { background: var(--warning-light); color: var(--warning); }
.rt-rank.r3 { background: var(--info-light); color: var(--info); }
.rt-rank.r4 { background: var(--success-light); color: var(--success); }
.rt-rank.r5 { background: var(--excellent-light); color: var(--excellent); }
.rt-rank.r6 { background: rgba(251, 146, 60, 0.12); color: #fb923c; }
.rt-rank.r7 { background: rgba(45, 212, 191, 0.12); color: #2dd4bf; }
.rt-rank.r8 { background: rgba(244, 114, 182, 0.12); color: #f472b6; }
.rt-content { flex: 1; min-width: 0; }
.rt-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.15rem; }
.rt-name { font-size: 0.88rem; font-weight: 600; }
.rt-count { font-size: 0.78rem; color: var(--text-muted); font-weight: 600; white-space: nowrap; }
.rt-desc { font-size: 0.8rem; color: var(--text-secondary); line-height: 1.45; margin-bottom: 0.4rem; }
.rt-bar { height: 5px; background: var(--neutral-light); border-radius: 3px; overflow: hidden; }
.rt-bar-fill { height: 100%; border-radius: 3px; transition: width 0.4s ease; }

/* ===== Topic Pills ===== */
.topic-pills { display: flex; gap: 0.35rem; flex-wrap: wrap; }
.topic-pill { padding: 0.15rem 0.5rem; border-radius: 10px; font-size: 0.7rem; font-weight: 500; }

/* ===== Summary Items (Home widget) ===== */
.summary-item { padding: 0.75rem 0; border-bottom: 1px solid var(--border); }
.summary-item:last-child { border-bottom: none; }
.summary-item-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.35rem; }
.summary-item-group { font-weight: 600; font-size: 0.88rem; }
.summary-item-time { font-size: 0.72rem; color: var(--text-muted); }
.summary-item-text { font-size: 0.82rem; color: var(--text-secondary); line-height: 1.5; }

/* ===== Insight Cards (Resumos page) ===== */
.insight-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 0.75rem; margin-bottom: 1.25rem; }
.insight-card { background: var(--surface); border-radius: 12px; padding: 1rem; border: 1px solid var(--border); }
.insight-card .ic-value { font-size: 1.4rem; font-weight: 700; }
.insight-card .ic-label { font-size: 0.68rem; text-transform: uppercase; color: var(--text-muted); margin-bottom: 0.3rem; }

.insight-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; margin-bottom: 1.25rem; }
.insight-box { background: var(--surface); border-radius: 12px; padding: 1rem; border: 1px solid var(--border); display: flex; align-items: center; gap: 0.75rem; }
.insight-box-icon { width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 1.1rem; flex-shrink: 0; }
.insight-box-text strong { display: block; font-size: 0.88rem; }
.insight-box-text span { font-size: 0.78rem; color: var(--text-muted); }

/* ===== Resumo List (Resumos page) ===== */
.resumo-entry { padding: 1rem; border-bottom: 1px solid var(--border); display: flex; gap: 1rem; align-items: flex-start; }
.resumo-entry:last-child { border-bottom: none; }
.resumo-content { flex: 1; }
.resumo-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.3rem; }
.resumo-group-name { font-weight: 600; font-size: 0.88rem; }
.resumo-time { font-size: 0.72rem; color: var(--text-muted); }
.resumo-text { font-size: 0.82rem; color: var(--text-secondary); line-height: 1.5; margin-bottom: 0.35rem; }
.resumo-footer { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }

/* ===== Temperatura do Grupo ===== */
.temp-bar {
    width: 100%;
    height: 10px;
    background: var(--neutral-light);
    border-radius: 5px;
    overflow: hidden;
    margin-top: 0.75rem;
}

.temp-bar-fill {
    height: 100%;
    border-radius: 5px;
    transition: width 0.4s ease;
}

/* ===== Score de Engajamento Sparkline ===== */
.sparkline-container {
    padding: 0.5rem 0;
}

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

.sparkline-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.7rem;
    color: var(--text-muted);
    padding: 0 0.25rem;
}

/* ===== Futuros Líderes ===== */
.leader-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.leader-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem;
    border-radius: 8px;
    background: var(--neutral-light);
}

.leader-info {
    flex: 1;
    min-width: 0;
}

.leader-name {
    font-weight: 600;
    font-size: 0.85rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.leader-growth {
    font-size: 0.72rem;
    font-weight: 500;
}

.leader-trend {
    font-weight: 700;
    font-size: 0.85rem;
    white-space: nowrap;
}

/* ===== Predição de Churn ===== */
.churn-empty-state {
    text-align: center;
    padding: 2rem 1rem;
}

.churn-risk-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.churn-risk-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem;
    border-radius: 8px;
    background: var(--neutral-light);
}

.churn-risk-info {
    flex: 1;
    min-width: 0;
}

/* ===== Tempo de Vida do Membro ===== */
.lifespan-buckets {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 1rem;
}

.lifespan-bucket {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
}

.lifespan-bucket-bar {
    flex: 1;
    height: 8px;
    background: var(--neutral-light);
    border-radius: 4px;
    overflow: hidden;
}

.lifespan-bucket-fill {
    height: 100%;
    background: var(--primary);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.lifespan-bucket-label {
    width: 70px;
    flex-shrink: 0;
    color: var(--text-muted);
    font-size: 0.75rem;
}

.lifespan-bucket-count {
    width: 70px;
    flex-shrink: 0;
    text-align: right;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* ===== Participação por Grupo ===== */
/* ===== Links Compartilhados ===== */
.domain-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.35rem 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.8rem;
}

.domain-row:last-child { border-bottom: none; }

.domain-name {
    color: var(--text);
    font-weight: 500;
}

.domain-count {
    color: var(--text-muted);
    font-size: 0.75rem;
}

/* ===== Quem Saiu ===== */
.leaver-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.leaver-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem;
    border-radius: 8px;
    background: var(--neutral-light);
}

.leaver-info {
    flex: 1;
    min-width: 0;
}

/* ===== Recomendações ===== */
.recommendation-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.recommendation-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem;
    border-radius: 8px;
    background: var(--neutral-light);
}

.rec-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1rem;
    flex-shrink: 0;
}

.rec-content {
    flex: 1;
    min-width: 0;
}

.rec-title {
    font-weight: 600;
    font-size: 0.85rem;
}

.rec-desc {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 0.1rem;
}

/* ===== Alertas Automáticos ===== */
.alert-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.alert-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem;
    border-radius: 8px;
    background: var(--neutral-light);
}

.alert-severity {
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    white-space: nowrap;
}

.alert-content {
    flex: 1;
    min-width: 0;
}

/* Trend Cards */
.trend-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.25rem;
}

.trend-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.75rem;
}

.trend-card .value {
    color: var(--text);
    font-size: 1.8rem;
    font-weight: 800;
    letter-spacing: -0.04em;
    font-variant-numeric: tabular-nums;
}

.inline-progress {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.inline-progress .bar {
    width: 40px;
    height: 4px;
    background: var(--border);
    border-radius: 2px;
    overflow: hidden;
}

.inline-progress .bar .fill {
    height: 100%;
    border-radius: 2px;
}

/* Summary Cards */
.summary-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.25rem;
    position: relative;
    overflow: hidden;
}

.summary-card.alert {
    border-color: #f8717130;
}

.summary-card .top-border {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
}

.summary-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.summary-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
}

.summary-content {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem;
    color: var(--text-secondary);
    font-size: 0.8rem;
    line-height: 1.6;
    margin-bottom: 0.75rem;
}

.summary-content strong {
    color: var(--text);
    font-weight: 500;
}

.topic-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.topic-tag {
    padding: 0.2rem 0.6rem;
    border-radius: 6px;
    font-size: 0.65rem;
    font-weight: 500;
}

/* Pagination */
.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    margin-top: 1.5rem;
    padding: 0.75rem 0;
}

.pagination-btn {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    padding: 0.4rem 0.7rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.75rem;
    font-family: inherit;
    transition: all 0.15s ease;
}

.pagination-btn:hover:not(:disabled):not(.pagination-active) {
    background: var(--surface-hover);
    color: var(--text);
}

.pagination-btn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.pagination-active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.pagination-ellipsis {
    color: var(--text-muted);
    padding: 0 0.3rem;
    font-size: 0.75rem;
}
