/* ─── Reset & Base ─────────────────────────────────────────── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #0b0e14;
  --bg-card: #12161f;
  --bg-card-hover: #171c28;
  --border: #1e2533;
  --text: #e6edf3;
  --text-secondary: #8b949e;
  --text-muted: #484f58;
  --accent: #7c6aef;
  --accent-glow: rgba(124, 106, 239, 0.2);
  --blue: #58a6ff;
  --green: #3fb950;
  --amber: #d29922;
  --red: #f85149;
  --purple: #bc8cff;
  --pink: #f778ba;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 4px 32px rgba(0,0,0,0.4);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

html { font-size: 15px; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ─── Header ───────────────────────────────────────────────── */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 32px;
  border-bottom: 1px solid var(--border);
  background: rgba(11, 14, 20, 0.8);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  position: sticky;
  top: 0;
  z-index: 100;
}

.logo { display: flex; align-items: center; gap: 14px; }
.logo-icon {
  width: 48px; height: 48px; border-radius: 14px;
  background: linear-gradient(135deg, var(--accent), #9d4edd);
  display: flex; align-items: center; justify-content: center;
  font-size: 24px;
  box-shadow: 0 4px 20px var(--accent-glow);
}
.logo-title { font-size: 1.3rem; font-weight: 800; letter-spacing: -0.5px; }
.logo-subtitle { font-size: 0.75rem; color: var(--text-secondary); font-weight: 500; letter-spacing: 1px; text-transform: uppercase; }

.header-right { display: flex; align-items: center; gap: 20px; }

.period-selector { display: flex; gap: 4px; background: var(--bg-card); border-radius: var(--radius-sm); padding: 4px; border: 1px solid var(--border); }
.period-btn {
  padding: 8px 16px; border: none; border-radius: 8px;
  background: transparent; color: var(--text-secondary);
  font-family: var(--font); font-size: 0.85rem; font-weight: 600;
  cursor: pointer; transition: all 0.2s ease;
}
.period-btn:hover { color: var(--text); background: rgba(255,255,255,0.05); }
.period-btn.active {
  background: var(--accent); color: #fff;
  box-shadow: 0 2px 12px var(--accent-glow);
}

.status-indicator { display: flex; align-items: center; gap: 8px; padding: 8px 14px; background: var(--bg-card); border-radius: var(--radius-sm); border: 1px solid var(--border); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); display: inline-block; }
.dot.pulse { animation: pulse 2s infinite; }
@keyframes pulse { 0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(63, 185, 80, 0.5); } 50% { opacity: 0.8; box-shadow: 0 0 0 6px rgba(63, 185, 80, 0); } }
.status-text { font-size: 0.8rem; font-weight: 600; color: var(--green); }

/* ─── Main ─────────────────────────────────────────────────── */
.main { padding: 28px 32px; max-width: 1440px; margin: 0 auto; }

/* ─── KPI Cards ────────────────────────────────────────────── */
.kpi-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 16px; margin-bottom: 24px; }

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
}
.kpi-card:hover { border-color: var(--accent); transform: translateY(-2px); box-shadow: var(--shadow); }
.kpi-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  opacity: 0;
  transition: opacity 0.3s ease;
}
.kpi-card:hover::before { opacity: 1; }

.kpi-icon {
  width: 50px; height: 50px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.kpi-icon-purple { background: rgba(124, 106, 239, 0.15); color: var(--accent); }
.kpi-icon-blue { background: rgba(88, 166, 255, 0.15); color: var(--blue); }
.kpi-icon-green { background: rgba(63, 185, 80, 0.15); color: var(--green); }
.kpi-icon-amber { background: rgba(210, 153, 34, 0.15); color: var(--amber); }
.kpi-icon-live { background: rgba(248, 81, 73, 0.15); color: var(--red); }

.kpi-card-live { border-color: rgba(248, 81, 73, 0.3); }
.kpi-card-live::before { opacity: 1; background: linear-gradient(90deg, transparent, var(--red), transparent); }
.kpi-badge-live {
  position: absolute; top: 14px; right: 14px;
  font-size: 0.72rem; font-weight: 700;
  padding: 4px 10px; border-radius: 20px;
  background: rgba(248, 81, 73, 0.15); color: var(--red);
  display: flex; align-items: center; gap: 6px; text-transform: uppercase;
}
.kpi-badge-live .dot { background: var(--red); width: 6px; height: 6px; }

.kpi-value { font-size: 2rem; font-weight: 800; letter-spacing: -1px; line-height: 1; }
.kpi-label { font-size: 0.85rem; color: var(--text-secondary); font-weight: 500; margin-top: 4px; }

.kpi-badge {
  position: absolute;
  top: 14px; right: 14px;
  font-size: 0.72rem; font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
  background: rgba(63, 185, 80, 0.15);
  color: var(--green);
}

/* ─── Map ──────────────────────────────────────────────────── */
.card-map { margin-bottom: 28px; }
.map-container {
  height: 380px; border-radius: 12px; overflow: hidden;
  border: 1px solid var(--border);
  z-index: 1;
}
.map-legend { display: flex; align-items: center; gap: 8px; }
.map-legend-dot { width: 10px; height: 10px; border-radius: 50%; animation: pulse 2s infinite; }
.map-legend-text { font-size: 0.85rem; color: var(--text-secondary); font-weight: 600; }

/* Map marker pulse */
.map-marker {
  width: 18px; height: 18px; border-radius: 50%;
  background: var(--accent); border: 3px solid rgba(124, 106, 239, 0.4);
  box-shadow: 0 0 12px var(--accent-glow);
  animation: markerPulse 2s infinite;
  cursor: pointer;
}
@keyframes markerPulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 12px var(--accent-glow); }
  50% { transform: scale(1.3); box-shadow: 0 0 24px rgba(124, 106, 239, 0.5); }
}

/* Yandex Maps balloon dark theme */
.ya-balloon {
  background: var(--bg-card); color: var(--text);
  border-radius: 12px; padding: 12px 16px;
  font-family: var(--font); font-size: 0.85rem;
  min-width: 160px;
}
.ya-balloon .popup-title { font-weight: 700; font-size: 0.95rem; margin-bottom: 6px; }
.ya-balloon .popup-detail { font-size: 0.8rem; color: var(--text-secondary); margin-bottom: 2px; }
.ya-balloon .popup-platform {
  display: inline-block; font-size: 0.7rem; padding: 2px 8px;
  border-radius: 6px; background: rgba(255,255,255,0.08);
  margin-top: 6px; font-weight: 600; text-transform: uppercase; color: var(--text-secondary);
}

/* ─── Cards ────────────────────────────────────────────────── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  transition: border-color 0.3s ease;
}
.card:hover { border-color: rgba(124, 106, 239, 0.3); }

.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.card-title { font-size: 1.05rem; font-weight: 700; }

/* ─── Charts Row ───────────────────────────────────────────── */
.charts-row { display: grid; grid-template-columns: 2fr 1fr; gap: 20px; margin-bottom: 28px; }

/* Timeline Chart */
.chart-container { height: 240px; display: flex; align-items: flex-end; gap: 4px; padding-top: 20px; }

.chart-bar-wrapper {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px;
  position: relative;
}
.chart-bar {
  width: 100%;
  border-radius: 6px 6px 2px 2px;
  background: linear-gradient(180deg, var(--accent), rgba(124, 106, 239, 0.4));
  min-height: 4px;
  transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  cursor: pointer;
}
.chart-bar:hover { filter: brightness(1.3); }
.chart-bar-label {
  font-size: 0.65rem; color: var(--text-muted); font-weight: 500;
  white-space: nowrap;
}
.chart-bar-value {
  position: absolute; top: -22px; left: 50%; transform: translateX(-50%);
  font-size: 0.7rem; font-weight: 700; color: var(--accent);
  opacity: 0; transition: opacity 0.2s ease;
}
.chart-bar-wrapper:hover .chart-bar-value { opacity: 1; }

.chart-empty {
  width: 100%; height: 200px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-muted); font-size: 0.9rem;
}

/* Platform Chart */
.platform-chart { display: flex; flex-direction: column; gap: 16px; }

.platform-item { display: flex; align-items: center; gap: 14px; }
.platform-icon {
  width: 42px; height: 42px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.2rem; font-weight: 700;
}
.platform-icon.ios { background: rgba(88, 166, 255, 0.15); color: var(--blue); }
.platform-icon.android { background: rgba(63, 185, 80, 0.15); color: var(--green); }
.platform-icon.unknown { background: rgba(139, 148, 158, 0.15); color: var(--text-secondary); }

.platform-info { flex: 1; }
.platform-name { font-weight: 700; font-size: 0.95rem; text-transform: capitalize; }
.platform-count { font-size: 0.8rem; color: var(--text-secondary); }

.platform-bar-bg {
  height: 8px; border-radius: 4px; background: rgba(255,255,255,0.06);
  overflow: hidden; margin-top: 6px;
}
.platform-bar-fill {
  height: 100%; border-radius: 4px;
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}
.platform-bar-fill.ios { background: linear-gradient(90deg, var(--blue), #8cc8ff); }
.platform-bar-fill.android { background: linear-gradient(90deg, var(--green), #7de68a); }
.platform-bar-fill.unknown { background: var(--text-muted); }

.platform-percent { font-weight: 800; font-size: 1.3rem; min-width: 50px; text-align: right; }

/* ─── Bottom Row ───────────────────────────────────────────── */
.bottom-row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 28px; }

/* Events Type Bars */
.events-bars { display: flex; flex-direction: column; gap: 12px; }

.event-bar-row { display: flex; align-items: center; gap: 12px; }
.event-bar-name {
  width: 160px; font-size: 0.85rem; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  display: flex; align-items: center; gap: 8px;
}
.event-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.event-bar-track { flex: 1; height: 28px; border-radius: 8px; background: rgba(255,255,255,0.04); overflow: hidden; position: relative; }
.event-bar-fill {
  height: 100%; border-radius: 8px;
  display: flex; align-items: center; padding-left: 10px;
  font-size: 0.75rem; font-weight: 700; color: #fff;
  transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
  min-width: 36px;
}

/* ─── Live Feed ────────────────────────────────────────────── */
.feed-list { max-height: 420px; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; }
.feed-list::-webkit-scrollbar { width: 4px; }
.feed-list::-webkit-scrollbar-track { background: transparent; }
.feed-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.feed-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.02);
  transition: background 0.2s ease;
  animation: feedSlideIn 0.4s ease;
}
.feed-item:hover { background: rgba(255,255,255,0.05); }
@keyframes feedSlideIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }

.feed-event-badge {
  padding: 4px 10px; border-radius: 6px;
  font-size: 0.72rem; font-weight: 700;
  white-space: nowrap;
  letter-spacing: 0.3px;
}
.feed-detail { flex: 1; font-size: 0.82rem; color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed-platform {
  font-size: 0.72rem; padding: 3px 8px; border-radius: 6px;
  background: rgba(255,255,255,0.06); color: var(--text-muted); font-weight: 600;
  text-transform: uppercase;
}
.feed-time { font-size: 0.72rem; color: var(--text-muted); white-space: nowrap; font-weight: 500; min-width: 55px; text-align: right; }
.feed-user {
  font-size: 0.72rem; padding: 3px 8px; border-radius: 6px;
  background: rgba(124, 106, 239, 0.15); color: var(--accent); font-weight: 700;
  white-space: nowrap; max-width: 120px; overflow: hidden; text-overflow: ellipsis;
  cursor: default;
}
.feed-user-guest {
  background: rgba(139, 148, 158, 0.1); color: var(--text-muted); font-weight: 600;
}
.feed-empty { padding: 40px; text-align: center; color: var(--text-muted); }

.refresh-btn {
  width: 32px; height: 32px; border-radius: 8px;
  border: 1px solid var(--border); background: transparent;
  color: var(--text-secondary); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s ease;
}
.refresh-btn:hover { border-color: var(--accent); color: var(--accent); transform: rotate(90deg); }

/* ─── Footer ───────────────────────────────────────────────── */
.footer { padding: 24px 32px; text-align: center; color: var(--text-muted); font-size: 0.8rem; border-top: 1px solid var(--border); }

/* ─── Responsive ───────────────────────────────────────────── */
@media (max-width: 1100px) { .kpi-grid { grid-template-columns: repeat(3, 1fr); } .charts-row { grid-template-columns: 1fr; } .bottom-row { grid-template-columns: 1fr; } .map-container { height: 300px; } }
@media (max-width: 700px) { .header { flex-direction: column; gap: 16px; padding: 16px; } .main { padding: 16px; } .kpi-grid { grid-template-columns: 1fr 1fr; } .period-selector { flex-wrap: wrap; } .event-bar-name { width: 120px; } .map-container { height: 240px; } }

/* ─── Login Overlay ────────────────────────────────────────── */
.login-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  transition: opacity 0.4s ease, visibility 0.4s ease;
}
.login-overlay.hidden { opacity: 0; visibility: hidden; pointer-events: none; }

.login-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 20px; padding: 48px 40px; text-align: center;
  width: 380px; max-width: 90vw;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.login-logo { font-size: 48px; margin-bottom: 16px; }
.login-title { font-size: 1.5rem; font-weight: 800; margin-bottom: 6px; }
.login-subtitle { font-size: 0.9rem; color: var(--text-secondary); margin-bottom: 28px; }
.login-form { display: flex; flex-direction: column; gap: 12px; }
.login-input {
  padding: 14px 18px; border-radius: 12px;
  border: 1px solid var(--border); background: rgba(255,255,255,0.04);
  color: var(--text); font-family: var(--font); font-size: 0.95rem;
  outline: none; transition: border-color 0.2s ease;
  text-align: center; letter-spacing: 2px;
}
.login-input:focus { border-color: var(--accent); }
.login-input::placeholder { letter-spacing: 0; color: var(--text-muted); }
.login-btn {
  padding: 14px; border-radius: 12px; border: none;
  background: linear-gradient(135deg, var(--accent), #9d4edd);
  color: #fff; font-family: var(--font); font-size: 1rem; font-weight: 700;
  cursor: pointer; transition: all 0.2s ease;
  box-shadow: 0 4px 16px var(--accent-glow);
}
.login-btn:hover { transform: translateY(-1px); box-shadow: 0 6px 24px rgba(124, 106, 239, 0.4); }
.login-btn:active { transform: translateY(0); }
.login-error {
  font-size: 0.82rem; color: var(--red); margin-top: 12px;
  min-height: 20px; font-weight: 600;
}

/* ─── Number Animation ─────────────────────────────────────── */
.number-animate { transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1); }

/* ─── Calendar Date Picker ─────────────────────────────────── */
.period-btn-calendar { font-size: 1.1rem; padding: 8px 12px; }
.header-right { position: relative; }

.calendar-popup {
  position: absolute; top: 100%; right: 0; margin-top: 8px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
  box-shadow: 0 16px 48px rgba(0,0,0,0.6);
  z-index: 200; width: 320px;
  animation: calFadeIn 0.2s ease;
}
.calendar-popup.hidden { display: none; }
@keyframes calFadeIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }

.calendar-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.cal-month-label { font-weight: 700; font-size: 0.95rem; text-transform: capitalize; }
.cal-nav-btn {
  width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--border);
  background: transparent; color: var(--text); font-size: 1.2rem;
  cursor: pointer; transition: all 0.2s ease;
  display: flex; align-items: center; justify-content: center;
}
.cal-nav-btn:hover { border-color: var(--accent); color: var(--accent); }

.cal-weekdays {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px;
  margin-bottom: 6px;
}
.cal-weekdays span {
  text-align: center; font-size: 0.7rem; font-weight: 700;
  color: var(--text-muted); text-transform: uppercase; padding: 4px 0;
}

.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }

.cal-day {
  aspect-ratio: 1; display: flex; align-items: center; justify-content: center;
  font-size: 0.82rem; font-weight: 600; border-radius: 8px;
  cursor: pointer; transition: all 0.15s ease; color: var(--text);
  border: none; background: transparent;
  font-family: var(--font);
}
.cal-day:hover { background: rgba(124, 106, 239, 0.15); color: var(--accent); }
.cal-day.today { border: 1px solid var(--accent); }
.cal-day.other-month { color: var(--text-muted); opacity: 0.4; }
.cal-day.selected { background: var(--accent); color: #fff; border-radius: 8px; }
.cal-day.in-range { background: rgba(124, 106, 239, 0.12); color: var(--accent); border-radius: 2px; }
.cal-day.range-start { border-radius: 8px 2px 2px 8px; background: var(--accent); color: #fff; }
.cal-day.range-end { border-radius: 2px 8px 8px 2px; background: var(--accent); color: #fff; }
.cal-day.future { opacity: 0.25; pointer-events: none; }

.cal-footer {
  display: flex; align-items: center; justify-content: space-between;
  margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border);
}
.cal-range-label { font-size: 0.75rem; color: var(--text-secondary); font-weight: 500; }
.cal-apply-btn {
  padding: 8px 18px; border-radius: 8px; border: none;
  background: var(--accent); color: #fff;
  font-family: var(--font); font-size: 0.82rem; font-weight: 700;
  cursor: pointer; transition: all 0.2s ease;
}
.cal-apply-btn:disabled { opacity: 0.3; cursor: default; }
.cal-apply-btn:not(:disabled):hover { transform: translateY(-1px); box-shadow: 0 4px 12px var(--accent-glow); }

/* ─── Event Type Breakdown Chart ───────────────────────────── */
.card-event-chart { padding: 28px; margin-bottom: 28px; }
.event-chart-layout {
  display: grid; grid-template-columns: 280px 1fr; gap: 40px;
  align-items: center;
}
@media (max-width: 900px) { .event-chart-layout { grid-template-columns: 1fr; } }

/* Donut container */
.ec-donut-wrap {
  position: relative; width: 260px; height: 260px;
  margin: 0 auto;
}
.ec-donut-svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ec-donut-segment {
  fill: none; stroke-width: 32;
  transition: stroke-dasharray 0.8s cubic-bezier(0.4,0,0.2,1), opacity 0.3s ease;
  cursor: pointer;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.3));
}
.ec-donut-segment:hover { stroke-width: 38; filter: drop-shadow(0 4px 12px rgba(0,0,0,0.5)); }
.ec-donut-center {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; pointer-events: none;
}
.ec-donut-total { font-size: 2.4rem; font-weight: 900; letter-spacing: -2px; line-height: 1; }
.ec-donut-sublabel { font-size: 0.78rem; color: var(--text-secondary); font-weight: 500; margin-top: 4px; }

/* Legend grid */
.ec-legend { display: flex; flex-direction: column; gap: 8px; }
.ec-legend-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; border-radius: 12px;
  background: rgba(255,255,255,0.02); border: 1px solid transparent;
  cursor: pointer; transition: all 0.2s ease;
}
.ec-legend-item:hover { background: rgba(255,255,255,0.05); border-color: var(--border); }
.ec-legend-item.ec-hidden { opacity: 0.3; }
.ec-legend-color {
  width: 14px; height: 14px; border-radius: 4px; flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.ec-legend-info { flex: 1; min-width: 0; }
.ec-legend-name { font-size: 0.82rem; font-weight: 700; display: flex; align-items: center; gap: 6px; }
.ec-legend-bar-wrap { height: 4px; border-radius: 2px; background: rgba(255,255,255,0.06); margin-top: 5px; overflow: hidden; }
.ec-legend-bar {
  height: 100%; border-radius: 2px;
  transition: width 0.8s cubic-bezier(0.4,0,0.2,1);
}
.ec-legend-count { font-size: 1rem; font-weight: 800; min-width: 36px; text-align: right; }
.ec-legend-pct { font-size: 0.72rem; color: var(--text-muted); font-weight: 600; min-width: 40px; text-align: right; }

.ec-empty { text-align: center; padding: 40px; color: var(--text-muted); font-size: 0.85rem; }

/* Filter chips */
.event-chart-filters {
  display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 24px;
}
.ecf-chip {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: 20px; border: 1px solid var(--border);
  background: transparent; color: var(--text); cursor: pointer;
  font-family: var(--font); font-size: 0.78rem; font-weight: 600;
  transition: all 0.2s ease;
}
.ecf-chip:not(.ecf-chip-off) {
  border-color: var(--chip-color);
  box-shadow: inset 0 0 0 1px var(--chip-color), 0 2px 8px rgba(0,0,0,0.2);
  background: color-mix(in srgb, var(--chip-color) 10%, transparent);
}
.ecf-chip.ecf-chip-off { opacity: 0.35; text-decoration: line-through; }
.ecf-chip:hover { transform: translateY(-1px); }
.ecf-chip-icon { font-size: 0.85rem; }

/* ─── Analytics Chart Cards ───────────────────────────────── */
.card-analytics-chart { padding: 28px; margin-bottom: 20px; }
.analytics-duo-row {
  display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px;
}
@media (max-width: 900px) { .analytics-duo-row { grid-template-columns: 1fr; } }

/* ─── Funnel Histogram ───────────────────────────────────── */
.fh-container {
  display: flex; align-items: flex-end; justify-content: space-between;
  height: 200px; padding: 20px 0 10px; width: 100%;
}
.fh-step {
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
  height: 100%; flex: 1; min-width: 0;
}
.fh-val {
  font-size: 0.8rem; font-weight: 800; margin-bottom: 6px;
}
.fh-bar-track {
  width: 100%; max-width: 32px; height: 100%;
  display: flex; align-items: flex-end; justify-content: center;
  border-radius: 4px 4px 2px 2px;
  background: rgba(255,255,255,0.04);
  cursor: help; position: relative;
}
.fh-bar {
  width: 100%; border-radius: 4px 4px 2px 2px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}
.fh-label {
  font-size: 0.65rem; font-weight: 600; text-align: center;
  color: var(--text-secondary); margin-top: 8px; line-height: 1.2;
  word-break: break-word; max-width: 100%;
}
.fh-arrow {
  display: flex; flex-direction: column; align-items: center; justify-content: flex-end;
  padding-bottom: 30px; /* align roughly with middle/bottom of bars */
  color: var(--border); font-size: 0.9rem;
}
.fh-conv {
  font-size: 0.65rem; font-weight: 700; color: var(--text-muted);
  background: var(--bg); padding: 2px 6px; border-radius: 6px;
  margin-bottom: 4px; border: 1px solid var(--border);
}
@keyframes fhGrow {
  from { height: 0; }
}

/* ─── Mini Donut Layout (Auth Sources / New vs Returning) ── */
.mini-donut-layout {
  display: flex; align-items: center; gap: 28px;
  padding: 8px 0;
}
@media (max-width: 600px) { .mini-donut-layout { flex-direction: column; } }
.mini-donut-wrap {
  position: relative; width: 160px; height: 160px; flex-shrink: 0;
}
.mini-donut-legend { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.mini-legend-row {
  display: flex; align-items: center; gap: 10px;
  font-size: 0.82rem; font-weight: 600;
}
.mini-legend-dot {
  width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
}
.mini-legend-label { flex: 1; }
.mini-legend-val { font-weight: 800; min-width: 28px; text-align: right; }
.mini-legend-pct { color: var(--text-muted); min-width: 32px; text-align: right; font-size: 0.75rem; }

/* ─── Hourly Activity ─────────────────────────────────────── */
.hourly-meta {
  margin-bottom: 16px; padding: 10px 16px;
  background: rgba(245, 158, 11, 0.08); border-radius: 10px;
  border: 1px solid rgba(245, 158, 11, 0.15);
}
.hourly-peak { font-size: 0.85rem; color: var(--text-secondary); }
.hourly-peak strong { color: #f59e0b; }
.hourly-container {
  display: flex; align-items: flex-end; gap: 3px;
  height: 200px; padding-top: 20px;
}
.hourly-bar-col {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; gap: 4px; height: 100%;
  justify-content: flex-end;
}
.hourly-bar {
  width: 100%; border-radius: 4px 4px 1px 1px;
  transition: height 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer; min-height: 2px;
}
.hourly-bar:hover { filter: brightness(1.3); }
.hourly-val {
  font-size: 0.6rem; font-weight: 700; color: var(--accent);
  height: 14px; line-height: 14px;
}
.hourly-val-zero { visibility: hidden; }
.hourly-label {
  font-size: 0.6rem; color: var(--text-muted); font-weight: 600;
  margin-top: 2px;
}

/* ─── Global Tooltip ─────────────────────────────────────────────── */
.global-tooltip {
  position: fixed;
  background: var(--bg-card, #12161f); color: var(--text);
  border: 1px solid var(--border); padding: 8px 12px; border-radius: 8px;
  font-size: 0.72rem; font-weight: 500; white-space: pre-wrap; width: max-content; max-width: 220px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.6); z-index: 10000; pointer-events: none;
  opacity: 0; transition: opacity 0.1s;
  transform: translate(-50%, -120%);
  text-align: left; line-height: 1.4;
  left: -9999px; top: -9999px; /* Hide initially */
}
.global-tooltip.show { opacity: 1; }
