/* Business Intelligence — ANALYTICS-SIMPLE layout */

.bi-section { margin-bottom: 36px; }

.bi-section-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-subtle);
}

.bi-section-title {
  font-size: 16px;
  font-weight: 500;
  color: var(--text-primary);
  margin: 0;
}

.bi-section-sub {
  font-size: 12px;
  color: #A3A3A3;
  font-weight: 400;
  margin-left: 4px;
}

/* 3-col stat row */
.bi-stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}

.bi-stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 20px;
  transition: border-color 200ms ease;
}

.bi-stat-card:hover { border-color: var(--border-strong); }

.bi-stat-label {
  font-size: 10px;
  font-weight: 600;
  color: #A3A3A3;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 8px;
}

.bi-stat-value {
  font-family: var(--font-mono);
  font-size: 28px;
  font-weight: 600;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.bi-stat-value--accent { color: var(--accent); }
.bi-stat-value--success { color: var(--success); }

/* 2-col charts row — bar 2fr, pie 1fr */
.bi-charts-row {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 12px;
}

.bi-card.card {
  padding: 24px;
  margin-bottom: 0;
  border-radius: 12px;
  box-shadow: none;
  transition: border-color 200ms ease;
}

.bi-card.card:hover { border-color: var(--border-strong); }

.bi-card-title {
  font-size: 11px;
  font-weight: 600;
  margin: 0 0 16px;
  color: #A3A3A3;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.bi-chart-wrap {
  height: 200px;
  width: 100%;
  position: relative;
}

.bi-chart-wrap--pie { height: 220px; }

@media (max-width: 900px) {
  .bi-stats-row { grid-template-columns: 1fr; }
  .bi-charts-row { grid-template-columns: 1fr; }
  .dash-topup-chip--desktop { display: none !important; }
}

/* ── Live Activity feed (dashboard home) — premium terminal window ── */
.live-activity-card {
  position: relative;
  overflow: hidden;
  padding: 40px 0 0;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  background:
    radial-gradient(120% 80% at 0% 0%, rgba(99, 102, 241, 0.10) 0%, transparent 55%),
    linear-gradient(180deg, #0d1117 0%, #06080c 100%);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.06) inset,
    0 18px 40px -18px rgba(0, 0, 0, 0.7),
    0 0 0 1px rgba(0, 0, 0, 0.4);
}
/* Window chrome — traffic-light dots + bar (pure CSS, no markup/i18n needed) */
.live-activity-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 40px;
  background:
    radial-gradient(circle at 22px 20px, #ff5f57 5px, transparent 5.6px),
    radial-gradient(circle at 40px 20px, #febc2e 5px, transparent 5.6px),
    radial-gradient(circle at 58px 20px, #28c840 5px, transparent 5.6px),
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.015));
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  pointer-events: none;
}
/* LIVE pill (language-neutral) */
.live-activity-card::after {
  content: "LIVE";
  position: absolute;
  top: 10px;
  right: 14px;
  padding: 3px 10px 3px 22px;
  border-radius: 999px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  line-height: 1.4;
  color: #56d364;
  background:
    radial-gradient(circle at 11px 50%, #3fb950 3px, transparent 3.6px),
    rgba(63, 185, 80, 0.10);
  border: 1px solid rgba(63, 185, 80, 0.28);
  animation: live-activity-glow 2.4s ease-out infinite;
  pointer-events: none;
}
@keyframes live-activity-glow {
  0% { box-shadow: 0 0 0 0 rgba(63, 185, 80, 0.35); }
  70% { box-shadow: 0 0 0 7px rgba(63, 185, 80, 0); }
  100% { box-shadow: 0 0 0 0 rgba(63, 185, 80, 0); }
}
/* Legacy header bits (kept for compatibility if ever re-added) */
.live-activity-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 18px;
  margin-bottom: 10px;
}
.live-activity-title {
  font-family: var(--font-display, "Inter", sans-serif);
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: #f0f6fc;
}
.live-activity-stream {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.72rem;
  font-weight: 500;
  color: #7d8590;
}
.live-activity-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #238636;
  flex-shrink: 0;
  animation: live-activity-pulse 2s ease-out infinite;
}
@keyframes live-activity-pulse {
  0% { box-shadow: 0 0 0 0 rgba(35, 134, 54, 0.4); }
  70% { box-shadow: 0 0 0 6px rgba(35, 134, 54, 0); }
  100% { box-shadow: 0 0 0 0 rgba(35, 134, 54, 0); }
}
.live-activity-list {
  background: transparent;
  border: 0;
  padding: 12px 14px 14px;
  height: 300px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Courier New", monospace;
  font-size: 0.8rem;
  line-height: 2;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.16) transparent;
  -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 14px);
  mask-image: linear-gradient(180deg, transparent 0, #000 14px);
}
.live-activity-list::-webkit-scrollbar { width: 6px; }
.live-activity-list::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.14); border-radius: 6px; }
.live-activity-list::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.26); }
@keyframes live-activity-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}
.live-log-line {
  color: #e6edf3;
  animation: live-activity-in 220ms ease;
  padding: 2px 10px;
  border-radius: 8px;
  transition: background-color 160ms ease;
  /* No overflow:hidden here — Bangla glyph marks (matras) from the fallback
     font extend past the line box and would get clipped top/bottom. */
  line-height: 2;
}
.live-log-line:hover { background: rgba(255, 255, 255, 0.04); }
.live-log-line:has(.live-log-event--message) { box-shadow: inset 2px 0 0 rgba(126, 231, 135, 0.5); }
.live-log-line:has(.live-log-event--reply) { box-shadow: inset 2px 0 0 rgba(121, 192, 255, 0.5); }
.live-log-line--idle { color: #8b949e; }
.live-log-line--idle:hover, .live-log-line--typing:hover { background: transparent; }
.live-log-line--typing { color: #a5b4fc; }
.live-log-typing-label { font-weight: 600; letter-spacing: 0.02em; }
.live-typing-dots {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-left: 7px;
}
.live-typing-dots i {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #a5b4fc;
  animation: live-typing-bounce 1.2s infinite;
}
.live-typing-dots i:nth-child(2) { animation-delay: 0.15s; }
.live-typing-dots i:nth-child(3) { animation-delay: 0.3s; }
@keyframes live-typing-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30% { transform: translateY(-3px); opacity: 1; }
}
.live-log-prompt {
  color: #3fb950;
  font-weight: 700;
  animation: live-prompt-blink 1.4s step-end infinite;
}
@keyframes live-prompt-blink {
  50% { opacity: 0.3; }
}
.live-log-time {
  color: #6e7681;
  margin-right: 10px;
  font-variant-numeric: tabular-nums;
  font-size: 0.92em;
}
.live-log-platform {
  display: inline-block;
  color: #e3b341;
  background: rgba(210, 153, 34, 0.12);
  border: 1px solid rgba(210, 153, 34, 0.22);
  border-radius: 999px;
  padding: 0 9px;
  margin-right: 10px;
  font-size: 0.86em;
  line-height: 1.55;
}
/* Platform logo badges — official brand colours, white glyph */
.live-plat {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  margin-right: 10px;
  border-radius: 7px;
  color: #fff;
  vertical-align: middle;
  top: 2px;
  flex-shrink: 0;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.10) inset, 0 2px 6px -2px rgba(0, 0, 0, 0.6);
}
.live-plat svg { display: block; width: 14px; height: 14px; }
.live-plat--wa   { background: #25D366; }
.live-plat--waba { background: #25D366; }
.live-plat--fb   { background: linear-gradient(135deg, #00C6FF 0%, #0A7CFF 55%, #A334FA 100%); }
.live-plat--ig   { background: radial-gradient(circle at 30% 107%, #fdf497 0%, #fdf497 5%, #fd5949 45%, #d6249f 60%, #285AEB 90%); }
.live-plat--tt   { background: #0b0b0f; box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.22) inset, -1px -1px 0 #25F4EE, 1px 1px 0 #FE2C55; }
.live-plat--tg   { background: #26A5E4; }
.live-log-event {
  display: inline-block;
  min-width: 5.4em;
  text-align: center;
  padding: 0 8px;
  margin-right: 10px;
  border-radius: 6px;
  font-size: 0.82em;
  line-height: 1.6;
  font-weight: 700;
  letter-spacing: 0.06em;
}
.live-log-event--message { color: #7ee787; background: rgba(126, 231, 135, 0.11); }
.live-log-event--reply { color: #79c0ff; background: rgba(121, 192, 255, 0.11); }
.live-log-preview { color: #c9d1d9; }
/* Row layout — time | logo | badge | text. Long text wraps inside its own
   column (hanging indent) instead of dropping under the clock. */
.live-log-line:has(.live-log-preview) {
  display: grid;
  grid-template-columns: max-content max-content max-content minmax(0, 1fr);
  column-gap: 10px;
  align-items: center;
}
.live-log-line:has(.live-log-preview) > * { margin: 0; }
.live-log-line:has(.live-log-preview) .live-log-time,
.live-log-line:has(.live-log-preview) .live-plat,
.live-log-line:has(.live-log-preview) .live-log-platform,
.live-log-line:has(.live-log-preview) .live-log-event { align-self: center; }
.live-log-line:has(.live-log-preview) .live-plat { top: 0; }
.live-log-preview { line-height: 1.8; overflow-wrap: anywhere; }
@media (max-width: 768px) {
  .live-activity-card { padding-top: 36px; border-radius: 14px; }
  .live-activity-card::before { height: 36px; background-position: 0 -2px, 0 -2px, 0 -2px, 0 0; }
  .live-activity-card::after { top: 8px; right: 12px; }
  .live-activity-list { font-size: 0.72rem; height: 240px; padding: 10px 10px 12px; }
  .live-log-line { padding: 1px 8px; }
  /* Phones: no clock column — keeps logo + badge + text on one tidy row */
  .live-log-line:has(.live-log-preview) { grid-template-columns: max-content max-content minmax(0, 1fr); column-gap: 8px; }
  .live-log-line:has(.live-log-preview) .live-log-time { display: none; }
  .live-log-event { min-width: 4.8em; }
  .live-plat { width: 22px; height: 22px; margin-right: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  .live-activity-card::after, .live-activity-dot, .live-typing-dots i, .live-log-prompt, .live-log-line { animation: none; }
}

/* Dashboard chrome (non-BI) */
.dash-topup-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 4px 4px 16px;
  border-radius: 100px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
}

.dash-topup-add-btn {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: var(--on-accent, #0a0a0a);
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 150ms ease;
}

.dash-topup-add-btn:hover { background: var(--accent-hover); }

.dash-topup-value {
  font-family: var(--font-mono);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
}

.topup-modal-box {
  max-width: 560px !important;
  width: min(560px, 100%);
  max-height: calc(100vh - 32px);
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border-strong);
  background: var(--bg-card);
  box-shadow: none;
  border-radius: 10px;
  overflow: hidden;
}

.plan-card.selected {
  border-color: var(--accent) !important;
  background: var(--accent-soft) !important;
  box-shadow: none;
}

#pay-submit-btn {
  background: var(--accent) !important;
  border: none !important;
  color: var(--on-accent, #0a0a0a) !important;
}

.sidebar-nav-icon { color: var(--text-muted); }

.store-setup-title { color: var(--text-primary) !important; }

.ai-wizard-btn {
  background: var(--accent) !important;
  color: var(--on-accent, #0a0a0a) !important;
  border: none !important;
  box-shadow: none !important;
}

.admin-demo-badge {
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid rgba(99, 102, 241, 0.28);
}

.dash-account-btn {
  background: transparent;
  color: var(--sec);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 7px 16px;
  font-size: 12px;
  transition: border-color 150ms ease, color 150ms ease;
}

.dash-account-btn:hover {
  border-color: var(--border-strong);
  color: var(--text-primary);
}

.bot-icon-wa {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--wa-bg);
  color: var(--wa);
}

.bot-icon-fb {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--fb-bg);
  color: var(--fb);
}

/* ═══ Light theme overrides — theme.js adds html.theme-light ═══ */
html.theme-light .live-activity-card {
  background:
    radial-gradient(120% 80% at 0% 0%, rgba(99,102,241,0.07) 0%, transparent 55%),
    linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  border: 1px solid rgba(15,23,42,0.10);
  box-shadow: 0 1px 0 #fff inset, 0 14px 32px -16px rgba(15,23,42,0.22);
}
html.theme-light .live-activity-card::before {
  background:
    radial-gradient(circle at 22px 20px, #ff5f57 5px, transparent 5.6px),
    radial-gradient(circle at 40px 20px, #febc2e 5px, transparent 5.6px),
    radial-gradient(circle at 58px 20px, #28c840 5px, transparent 5.6px),
    linear-gradient(180deg, rgba(15,23,42,0.035), rgba(15,23,42,0.01));
  border-bottom: 1px solid rgba(15,23,42,0.08);
}
html.theme-light .live-activity-card::after {
  color: #15803d;
  background: radial-gradient(circle at 11px 50%, #16a34a 3px, transparent 3.6px), rgba(22,163,74,0.09);
  border-color: rgba(22,163,74,0.28);
}
html.theme-light .live-activity-title { color:#0f172a; }
html.theme-light .live-activity-stream { color:#64748b; }
html.theme-light .live-activity-list { background:transparent; border:0; scrollbar-color: rgba(15,23,42,0.22) transparent; }
html.theme-light .live-activity-list::-webkit-scrollbar-thumb { background: rgba(15,23,42,0.18); }
html.theme-light .live-log-line { color:#1e293b; }
html.theme-light .live-log-line:hover { background: rgba(15,23,42,0.04); }
html.theme-light .live-log-line:has(.live-log-event--message) { box-shadow: inset 2px 0 0 rgba(21,128,61,0.5); }
html.theme-light .live-log-line:has(.live-log-event--reply) { box-shadow: inset 2px 0 0 rgba(29,78,216,0.5); }
html.theme-light .live-log-line--idle { color:#64748b; }
html.theme-light .live-log-line--typing { color:#4f46e5; }
html.theme-light .live-typing-dots i { background:#6366f1; }
html.theme-light .live-log-prompt { color:#16a34a; }
html.theme-light .live-log-time { color:#94a3b8; }
html.theme-light .live-log-platform { color:#b45309; background: rgba(180,83,9,0.08); border-color: rgba(180,83,9,0.22); }
html.theme-light .live-plat { box-shadow: 0 0 0 1px rgba(15,23,42,0.08) inset, 0 2px 6px -2px rgba(15,23,42,0.35); }
html.theme-light .live-log-event--message { color:#15803d; background: rgba(21,128,61,0.10); }
html.theme-light .live-log-event--reply { color:#1d4ed8; background: rgba(29,78,216,0.09); }
html.theme-light .live-log-preview { color:#334155; }

htmlhtml.theme-light .bi-section-sub { color:#64748b; }
html.theme-light .bi-stat-label { color:#475569; font-weight:700; }
html.theme-light .bi-section-title { color:#0f172a; }
