/* =====================================================
   2MWeb Analytics — Feuille de style principale
   Design system : dark theme + accents bleus OKLCH
   ===================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Space+Grotesk:wght@500;600;700&display=swap');

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

:root {
    /* Couleurs principales */
    --primary:     #3b82f6;
    --primary-dark:#2563eb;
    --accent:      #06b6d4;
    --background:  #0a0e1a;
    --surface:     #111827;
    --surface-2:   #1a2236;
    --surface-3:   #1e2d45;
    --border:      rgba(255,255,255,0.08);
    --border-hover:rgba(255,255,255,0.15);

    /* Texte */
    --text:        #f1f5f9;
    --text-muted:  #94a3b8;
    --text-faint:  #475569;

    /* Statuts */
    --success:     #10b981;
    --warning:     #f59e0b;
    --danger:      #ef4444;
    --info:        #06b6d4;

    /* Graphiques */
    --chart-1:     #3b82f6;
    --chart-2:     #06b6d4;
    --chart-3:     #8b5cf6;
    --chart-4:     #f59e0b;
    --chart-5:     #10b981;

    /* Effets */
    --radius:      0.75rem;
    --radius-sm:   0.5rem;
    --radius-lg:   1rem;
    --shadow-card: 0 4px 24px rgba(0,0,0,0.4);
    --shadow-glow: 0 0 40px rgba(59,130,246,0.15);
    --gradient:    linear-gradient(135deg, #3b82f6, #06b6d4);

    /* Layout */
    --sidebar-w:   260px;
    --topbar-h:    64px;
}

html, body {
    font-family: 'Inter', system-ui, sans-serif;
    background: var(--background);
    color: var(--text);
    min-height: 100vh;
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5 {
    font-family: 'Space Grotesk', system-ui, sans-serif;
    letter-spacing: -0.02em;
    line-height: 1.2;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* === SCROLLBAR === */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

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

.main-content {
    flex: 1;
    margin-left: var(--sidebar-w);
    padding-top: var(--topbar-h);
    min-width: 0;
    transition: margin-left 0.3s ease;
}

.page-body {
    padding: 1.5rem 2rem;
    max-width: 1600px;
}

/* === SIDEBAR === */
.sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: var(--sidebar-w);
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 100;
    overflow-y: auto;
    transition: transform 0.3s ease;
}

.sidebar-logo {
    padding: 1.25rem 1.25rem 1rem;
    border-bottom: 1px solid var(--border);
}

.sidebar-logo .logo-mark {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    text-decoration: none;
}

.sidebar-logo .logo-icon {
    width: 36px; height: 36px;
    background: var(--gradient);
    border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    font-size: 1rem;
    box-shadow: var(--shadow-glow);
    flex-shrink: 0;
}

.sidebar-logo .logo-text {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.02em;
}

.sidebar-logo .logo-sub {
    font-size: 0.65rem;
    color: var(--text-muted);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-weight: 500;
}

/* Client selector */
.client-selector {
    padding: 0.875rem 1rem;
    border-bottom: 1px solid var(--border);
}

.client-selector label {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
    display: block;
    margin-bottom: 0.4rem;
}

.client-selector select {
    width: 100%;
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 0.45rem 0.75rem;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.8rem;
    cursor: pointer;
    outline: none;
}

.client-selector select:focus {
    border-color: var(--primary);
}

/* Nav */
.sidebar-nav {
    flex: 1;
    padding: 0.75rem 0.75rem;
}

.nav-section-title {
    font-size: 0.6rem;
    font-weight: 600;
    color: var(--text-faint);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    padding: 0.75rem 0.5rem 0.35rem;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.55rem 0.75rem;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.82rem;
    font-weight: 500;
    transition: all 0.15s ease;
    margin-bottom: 1px;
}

.nav-item:hover {
    background: rgba(255,255,255,0.05);
    color: var(--text);
    text-decoration: none;
}

.nav-item.active {
    background: rgba(59,130,246,0.15);
    color: var(--primary);
    font-weight: 600;
}

.nav-item .nav-icon {
    font-size: 0.95rem;
    width: 18px;
    text-align: center;
    flex-shrink: 0;
}

.nav-item .nav-badge {
    margin-left: auto;
    background: var(--danger);
    color: #fff;
    font-size: 0.6rem;
    font-weight: 700;
    padding: 0.1em 0.4em;
    border-radius: 999px;
    min-width: 18px;
    text-align: center;
}

/* === TOPBAR === */
.topbar {
    position: fixed;
    top: 0;
    left: var(--sidebar-w);
    right: 0;
    height: var(--topbar-h);
    background: rgba(10, 14, 26, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 2rem;
    gap: 1rem;
    z-index: 50;
}

.topbar-search {
    flex: 1;
    max-width: 360px;
    position: relative;
}

.topbar-search input {
    width: 100%;
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 0.45rem 0.75rem 0.45rem 2.25rem;
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 0.82rem;
    outline: none;
    transition: border-color 0.15s;
}

.topbar-search input::placeholder { color: var(--text-faint); }
.topbar-search input:focus { border-color: var(--primary); }

.topbar-search .search-icon {
    position: absolute;
    left: 0.7rem; top: 50%;
    transform: translateY(-50%);
    color: var(--text-faint);
    font-size: 0.8rem;
}

.topbar-spacer { flex: 1; }

.topbar-live {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--surface-2);
    border: 1px solid var(--border);
    padding: 0.35rem 0.875rem;
    border-radius: 999px;
    font-size: 0.78rem;
    color: var(--text-muted);
}

.topbar-live .live-dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: var(--success);
    animation: pulse-dot 1.6s ease-in-out infinite;
}

.topbar-btn {
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text-muted);
    width: 36px; height: 36px;
    border-radius: var(--radius-sm);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    font-size: 0.9rem;
    transition: all 0.15s;
    position: relative;
}

.topbar-btn:hover {
    background: var(--surface-3);
    color: var(--text);
    border-color: var(--border-hover);
}

.topbar-btn .badge {
    position: absolute;
    top: -3px; right: -3px;
    width: 8px; height: 8px;
    background: var(--danger);
    border-radius: 50%;
    border: 2px solid var(--background);
}

.topbar-date {
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text-muted);
    padding: 0.4rem 0.875rem;
    border-radius: var(--radius-sm);
    font-size: 0.78rem;
    cursor: pointer;
    display: flex; align-items: center; gap: 0.4rem;
    transition: all 0.15s;
}

.topbar-date:hover {
    border-color: var(--border-hover);
    color: var(--text);
}

/* === PAGE HEADER === */
.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 1.75rem;
    gap: 1rem;
}

.page-header-left .page-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0.2rem;
}

.page-header-left .page-subtitle {
    font-size: 0.82rem;
    color: var(--text-muted);
}

.page-header-actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

/* === CARDS / PANELS === */
.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    box-shadow: var(--shadow-card);
}

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

.panel-title {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
}

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

.panel-action {
    font-size: 0.75rem;
    color: var(--primary);
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
    font-family: inherit;
}

.panel-action:hover { text-decoration: underline; }

/* Glass card */
.glass {
    background: linear-gradient(135deg, rgba(255,255,255,0.06), rgba(59,130,246,0.04));
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-card);
}

/* === KPI CARDS === */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.kpi-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    position: relative;
    overflow: hidden;
    transition: border-color 0.15s, transform 0.15s;
}

.kpi-card:hover {
    border-color: rgba(59,130,246,0.3);
    transform: translateY(-1px);
    box-shadow: var(--shadow-glow);
}

.kpi-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(59,130,246,0.04), transparent);
    pointer-events: none;
}

.kpi-label {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 0.5rem;
}

.kpi-value {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.85rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.03em;
    line-height: 1;
    margin-bottom: 0.5rem;
}

.kpi-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.delta {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.2em 0.55em;
    border-radius: 999px;
}

.delta-up   { background: rgba(16,185,129,0.15); color: var(--success); }
.delta-down { background: rgba(239,68,68,0.15);  color: var(--danger); }

.kpi-spark { height: 32px; }

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

/* === TABLES === */
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
}

.data-table thead th {
    padding: 0.625rem 0.875rem;
    text-align: left;
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.data-table tbody tr {
    border-bottom: 1px solid rgba(255,255,255,0.04);
    transition: background 0.1s;
}

.data-table tbody tr:last-child { border-bottom: none; }
.data-table tbody tr:hover { background: rgba(255,255,255,0.03); }

.data-table tbody td {
    padding: 0.7rem 0.875rem;
    color: var(--text);
    vertical-align: middle;
}

.data-table td.muted { color: var(--text-muted); }
.data-table td.mono  { font-family: 'SFMono-Regular', Consolas, monospace; font-size: 0.78rem; }

/* === BADGES === */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.15em 0.55em;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 600;
}

.badge-success  { background: rgba(16,185,129,0.15); color: var(--success); }
.badge-warning  { background: rgba(245,158,11,0.15);  color: var(--warning); }
.badge-danger   { background: rgba(239,68,68,0.15);   color: var(--danger); }
.badge-info     { background: rgba(6,182,212,0.15);   color: var(--info); }
.badge-primary  { background: rgba(59,130,246,0.15);  color: var(--primary); }
.badge-muted    { background: rgba(255,255,255,0.08); color: var(--text-muted); }

/* === BUTTONS === */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    border: 1px solid transparent;
    outline: none;
    white-space: nowrap;
}

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

.btn-primary:hover {
    background: var(--primary-dark);
    border-color: var(--primary-dark);
    text-decoration: none;
}

.btn-secondary {
    background: var(--surface-2);
    color: var(--text-muted);
    border-color: var(--border);
}

.btn-secondary:hover {
    background: var(--surface-3);
    color: var(--text);
    border-color: var(--border-hover);
    text-decoration: none;
}

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
    border-color: transparent;
}

.btn-ghost:hover {
    background: rgba(255,255,255,0.05);
    color: var(--text);
    text-decoration: none;
}

.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.75rem; }

/* === PROGRESS BARS === */
.progress-bar {
    height: 6px;
    background: rgba(255,255,255,0.08);
    border-radius: 3px;
    overflow: hidden;
}

.progress-bar-fill {
    height: 100%;
    border-radius: 3px;
    background: var(--gradient);
    transition: width 0.6s ease;
}

/* === TABS === */
.tabs {
    display: flex;
    gap: 0.25rem;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.25rem;
    margin-bottom: 1.25rem;
}

.tab-btn {
    padding: 0.45rem 1rem;
    border-radius: calc(var(--radius-sm) - 2px);
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.15s;
    border: none;
    background: none;
    font-family: inherit;
}

.tab-btn.active,
.tab-btn:hover {
    background: var(--surface-3);
    color: var(--text);
}

.tab-btn.active {
    background: var(--surface);
    color: var(--text);
    box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}

/* === LIVE FEED === */
.live-feed-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.625rem 0;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    animation: slide-in 0.3s ease-out;
}

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

.live-feed-flag { font-size: 1rem; flex-shrink: 0; margin-top: 1px; }

.live-feed-meta {
    flex: 1;
    min-width: 0;
}

.live-feed-event {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.live-feed-page {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-family: monospace;
}

.live-feed-time {
    font-size: 0.68rem;
    color: var(--text-faint);
    flex-shrink: 0;
    padding-top: 2px;
}

/* === ANOMALY CARDS === */
.anomaly-card {
    display: flex;
    gap: 0.875rem;
    padding: 1rem;
    background: var(--surface-2);
    border-radius: var(--radius-sm);
    border-left: 3px solid transparent;
    margin-bottom: 0.75rem;
}

.anomaly-card.danger   { border-left-color: var(--danger); }
.anomaly-card.warning  { border-left-color: var(--warning); }
.anomaly-card.success  { border-left-color: var(--success); }
.anomaly-card.info     { border-left-color: var(--info); }

.anomaly-icon { font-size: 1.25rem; flex-shrink: 0; }

.anomaly-content .anomaly-title {
    font-size: 0.83rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.2rem;
}

.anomaly-content .anomaly-desc {
    font-size: 0.76rem;
    color: var(--text-muted);
    line-height: 1.5;
}

/* === GOAL ITEM === */
.goal-item {
    margin-bottom: 1rem;
}

.goal-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.35rem;
    font-size: 0.8rem;
}

.goal-name { color: var(--text); font-weight: 500; }
.goal-stats { color: var(--text-muted); }

/* === CHART CONTAINERS === */
.chart-wrap {
    position: relative;
    width: 100%;
}

.chart-wrap canvas {
    max-width: 100%;
}

/* === WORLD MAP === */
.world-map-wrap {
    position: relative;
    overflow: hidden;
    border-radius: var(--radius-sm);
    background: var(--surface-2);
}

/* === GRADIENT TEXT === */
.gradient-text {
    background: var(--gradient);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

/* === STATS ROW === */
.stats-row {
    display: flex;
    gap: 1.5rem;
    padding: 0.875rem 0;
    border-top: 1px solid var(--border);
}

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

.stat-label {
    font-size: 0.68rem;
    font-weight: 600;
    color: var(--text-faint);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 0.2rem;
}

.stat-value {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text);
}

/* === MOBILE TOGGLE === */
.sidebar-toggle {
    display: none;
    position: fixed;
    bottom: 1.25rem;
    left: 1.25rem;
    z-index: 200;
    width: 48px; height: 48px;
    background: var(--primary);
    border: none;
    border-radius: 50%;
    color: #fff;
    font-size: 1.2rem;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(59,130,246,0.4);
}

/* === SWITCHES === */
.switch {
    position: relative;
    display: inline-block;
    width: 36px; height: 20px;
}

.switch input { opacity: 0; width: 0; height: 0; }

.switch-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: rgba(255,255,255,0.15);
    border-radius: 10px;
    transition: 0.2s;
}

.switch-slider::before {
    content: '';
    position: absolute;
    width: 14px; height: 14px;
    left: 3px; top: 3px;
    background: #fff;
    border-radius: 50%;
    transition: 0.2s;
}

.switch input:checked + .switch-slider { background: var(--primary); }
.switch input:checked + .switch-slider::before { transform: translateX(16px); }

/* === MISC === */
.divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 1rem 0;
}

.text-muted { color: var(--text-muted); }
.text-faint { color: var(--text-faint); }
.text-success { color: var(--success); }
.text-danger  { color: var(--danger); }
.text-warning { color: var(--warning); }
.text-primary { color: var(--primary); }

.font-mono { font-family: 'SFMono-Regular', Consolas, monospace; }
.font-sm   { font-size: 0.78rem; }
.font-xs   { font-size: 0.68rem; }

.flex { display: flex; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.mt-4 { margin-top: 1rem; }
.mt-2 { margin-top: 0.5rem; }

/* === ANIMATIONS === */
@keyframes pulse-dot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%       { opacity: 0.5; transform: scale(1.3); }
}

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

@keyframes slide-in {
    from { opacity: 0; transform: translateX(-10px); }
    to   { opacity: 1; transform: translateX(0); }
}

.animate-fade-up  { animation: fade-up 0.4s ease-out both; }
.animate-slide-in { animation: slide-in 0.3s ease-out both; }

/* === RESPONSIVE === */
@media (max-width: 1200px) {
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
    .grid-5 { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 900px) {
    .grid-3 { grid-template-columns: 1fr; }
    .grid-2 { grid-template-columns: 1fr; }
    .kpi-grid { grid-template-columns: repeat(2, 1fr); }

    .sidebar {
        transform: translateX(-100%);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
    }

    .topbar {
        left: 0;
    }

    .sidebar-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .page-header {
        flex-direction: column;
    }
}

@media (max-width: 600px) {
    .page-body { padding: 1rem; }
    .kpi-grid { grid-template-columns: 1fr; }
    .topbar { padding: 0 1rem; }
    .topbar-search { max-width: 200px; }
}

/* === VITALS === */
.vitals-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 1rem;
    margin-bottom: 1rem;
}

.vital-card {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 1rem;
    text-align: center;
}

.vital-name {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-bottom: 0.4rem;
}

.vital-value {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0.35rem;
}

.vital-score {
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.2em 0.5em;
    border-radius: 999px;
    display: inline-block;
}

.vital-good    { background: rgba(16,185,129,0.15); color: var(--success); }
.vital-medium  { background: rgba(245,158,11,0.15);  color: var(--warning); }
.vital-bad     { background: rgba(239,68,68,0.15);   color: var(--danger); }

/* === HEATMAP SVG === */
.heatmap-cell {
    cursor: pointer;
    transition: opacity 0.15s;
}
.heatmap-cell:hover { opacity: 0.8; }

/* === COHORT TABLE === */
.cohort-table td {
    width: 60px;
    text-align: center;
    font-size: 0.72rem;
    font-weight: 500;
    padding: 0.3rem;
    border-radius: 3px;
}

/* === TIMELINE === */
.funnel-step {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.875rem 0;
    border-bottom: 1px solid var(--border);
}

.funnel-step:last-child { border-bottom: none; }

.funnel-bar-wrap {
    flex: 1;
    height: 24px;
    background: rgba(255,255,255,0.06);
    border-radius: 4px;
    overflow: hidden;
}

.funnel-bar-fill {
    height: 100%;
    background: var(--gradient);
    border-radius: 4px;
    transition: width 0.8s ease;
}

/* === GOOGLE ANALYTICS TUTORIAL PAGE === */
.tutorial-content {
    max-width: 860px;
}

.tutorial-step {
    display: flex;
    gap: 1.25rem;
    margin-bottom: 2rem;
}

.step-number {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: var(--gradient);
    color: #fff;
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 700;
    font-size: 0.9rem;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    margin-top: 2px;
}

.step-body h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.5rem;
}

.step-body p, .step-body li {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.65;
}

.step-body ul {
    padding-left: 1.25rem;
    margin-top: 0.5rem;
}

.code-block {
    background: #0d1117;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 1rem 1.25rem;
    font-family: 'SFMono-Regular', Consolas, monospace;
    font-size: 0.78rem;
    color: #e6edf3;
    overflow-x: auto;
    margin: 0.75rem 0;
    line-height: 1.7;
}

.code-block .comment { color: #8b949e; }
.code-block .keyword { color: #ff7b72; }
.code-block .string  { color: #a5d6ff; }
.code-block .func    { color: #d2a8ff; }
.code-block .var     { color: #ffa657; }

.info-box {
    background: rgba(59,130,246,0.08);
    border: 1px solid rgba(59,130,246,0.25);
    border-radius: var(--radius-sm);
    padding: 0.875rem 1rem;
    margin: 0.75rem 0;
    font-size: 0.82rem;
    color: var(--text-muted);
    line-height: 1.6;
}

.info-box strong { color: var(--primary); }

/* === TOPBAR USER MENU === */
#userMenu.open { display: block !important; }

/* === SITES GRID === */
@media (max-width: 900px) {
    .grid-3 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 600px) {
    .grid-3 { grid-template-columns: 1fr; }
}
