/* Copyright (c) 2026 Peakora. All rights reserved. Licensed under the MIT License; see NOTICE and LICENSE. */
/* Peakora Insights - built on the Peakora-Assistant theme tokens
   (deep midnight canvas, warm terracotta/amber glow, centered cards). */

* { box-sizing: border-box; }

/* A `display` rule on an element beats the `hidden` attribute, so #gate
   (display: grid) and #app would stay visible when hidden. Make the
   attribute win everywhere, once. */
[hidden] { display: none !important; }

:root {
  --theme-bg: #0c0a15;
  --theme-card-bg: #151122;
  --theme-card-border: rgba(255, 255, 255, 0.08);
  --theme-text-main: #f8fafc;
  --theme-text-muted: #a0aec0;
  --theme-heading: #ffffff;
  --theme-accent: #f4a261;
  --theme-accent-2: #a78bfa;
  --theme-accent-glow: rgba(224, 122, 95, 0.35);
  --theme-primary-grad: linear-gradient(135deg, #e07a5f 0%, #f4a261 50%, #a78bfa 100%);
  --good: #34d399;
  --warn: #fbbf24;
  --bad: #fb7185;
  --radius-sm: 10px;
  --radius-md: 18px;
  --radius-lg: 26px;
}

html, body { margin: 0; padding: 0; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--theme-bg);
  background-image: radial-gradient(circle at top, #1a152e 0%, #0c0a15 60%, #08060e 100%);
  color: var(--theme-text-main);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

h1, h2, h3, h4 { font-family: 'Plus Jakarta Sans', sans-serif; color: var(--theme-heading); margin: 0; }

@keyframes dashFadeIn {
  from { opacity: 0; transform: translateY(16px); filter: blur(8px); }
  to   { opacity: 1; transform: translateY(0); filter: blur(0); }
}
.animate-fade-in { animation: dashFadeIn 0.8s cubic-bezier(0.16, 1, 0.3, 1) both; }

/* ---------------------------------------------------------------- gate ---- */
.gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.gate-card {
  width: 100%;
  max-width: 400px;
  background: var(--theme-card-bg);
  border: 1px solid var(--theme-card-border);
  border-radius: var(--radius-lg);
  padding: 36px 32px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(244, 162, 97, 0.06);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
/* The mark carries the same treatment as the assistant site header: forced to
   pure white, then two warm drop-shadows for the glow. Sizes are unchanged. */
.gate-logo { width: 64px; height: 64px; margin: 0 auto 4px; object-fit: contain; filter: brightness(0) invert(1) drop-shadow(0 0 2px rgba(244, 162, 97, 0.9)) drop-shadow(0 0 12px rgba(224, 122, 95, 0.6)); }
.gate-card h1 { font-size: 24px; text-align: center; font-weight: 800; }
.gate-sub { color: var(--theme-text-muted); text-align: center; font-size: 14px; margin: 0 0 12px; line-height: 1.5; }
.gate-card label { font-size: 12px; color: var(--theme-text-muted); text-transform: uppercase; letter-spacing: 0.06em; margin-top: 6px; }
.gate-card input {
  background: #0f0c1c;
  border: 1px solid var(--theme-card-border);
  color: var(--theme-text-main);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 15px;
  font-family: inherit;
}
.gate-card input:focus { outline: none; border-color: var(--theme-accent); box-shadow: 0 0 0 3px var(--theme-accent-glow); }
.gate-card button {
  margin-top: 14px;
  background: var(--theme-primary-grad);
  color: #1a0f0a;
  font-weight: 700;
  font-family: 'Plus Jakarta Sans', sans-serif;
  border: none;
  border-radius: var(--radius-sm);
  padding: 13px;
  font-size: 15px;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.gate-card button:hover { transform: translateY(-2px); box-shadow: 0 10px 26px var(--theme-accent-glow); }
.gate-card button:disabled { opacity: 0.6; cursor: wait; transform: none; }
.gate-error { color: var(--bad); font-size: 13px; text-align: center; margin: 6px 0 0; line-height: 1.5; }

/* -------------------------------------------------------------- topbar ---- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 28px;
  border-bottom: 1px solid var(--theme-card-border);
  background: rgba(12, 10, 21, 0.72);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 20;
  flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 14px; }
.brand-logo { width: 40px; height: 40px; object-fit: contain; filter: brightness(0) invert(1) drop-shadow(0 0 2px rgba(244, 162, 97, 0.9)) drop-shadow(0 0 12px rgba(224, 122, 95, 0.6)); transition: transform 0.3s ease, filter 0.3s ease; }
.brand-logo:hover { transform: scale(1.04); filter: brightness(0) invert(1) drop-shadow(0 0 4px rgba(244, 162, 97, 1)) drop-shadow(0 0 20px rgba(224, 122, 95, 0.85)); }
.brand-name { font-family: 'Plus Jakarta Sans', sans-serif; font-weight: 800; font-size: 18px; }
.brand-sub { color: var(--theme-text-muted); font-size: 12px; }
.topbar-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
select, .ghost {
  background: var(--theme-card-bg);
  border: 1px solid var(--theme-card-border);
  color: var(--theme-text-main);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
}
.ghost:hover, select:hover { border-color: var(--theme-accent); }
.ghost:active { transform: translateY(1px); }

/* ---------------------------------------------------------------- tabs ---- */
.tabs {
  display: flex;
  gap: 8px;
  padding: 14px 28px 0;
  overflow-x: auto;
  scrollbar-width: thin;
  border-bottom: 1px solid var(--theme-card-border);
}
.tab {
  background: transparent;
  border: 1px solid transparent;
  border-bottom: 2px solid transparent;
  color: var(--theme-text-muted);
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-weight: 600;
  font-size: 14px;
  padding: 10px 16px;
  border-radius: 10px 10px 0 0;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}
.tab:hover { color: var(--theme-text-main); background: rgba(255, 255, 255, 0.03); }
.tab.active {
  color: var(--theme-accent);
  border-bottom-color: var(--theme-accent);
  background: linear-gradient(180deg, rgba(244, 162, 97, 0.10), transparent);
}
.tab .dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--bad); margin-left: 6px; vertical-align: middle; }

/* -------------------------------------------------------------- panels ---- */
main { padding: 26px 28px 60px; max-width: 1400px; margin: 0 auto; }
.loading { color: var(--theme-text-muted); text-align: center; padding: 80px 0; font-size: 15px; }
.dots span { animation: blink 1.4s infinite both; }
.dots span:nth-child(2) { animation-delay: 0.2s; }
.dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 0%, 80%, 100% { opacity: 0.2; } 40% { opacity: 1; } }

.section-title { font-size: 15px; font-weight: 700; margin: 30px 0 14px; color: var(--theme-heading); }
.section-title:first-child { margin-top: 0; }
.section-note { color: var(--theme-text-muted); font-size: 13px; margin: -8px 0 14px; line-height: 1.6; }

.grid { display: grid; gap: 16px; }
.grid.k2 { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.grid.k3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid.k4 { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }

.card {
  background: var(--theme-card-bg);
  border: 1px solid var(--theme-card-border);
  border-radius: var(--radius-md);
  padding: 20px;
  animation: dashFadeIn 0.7s cubic-bezier(0.16, 1, 0.3, 1) both;
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.35s ease, box-shadow 0.35s ease;
}
.card:hover { transform: translateY(-3px); border-color: rgba(244, 162, 97, 0.35); box-shadow: 0 14px 34px rgba(0, 0, 0, 0.4); }
.card h3 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--theme-text-muted); font-weight: 700; margin-bottom: 14px; }

.kpi { text-align: left; }
.kpi .label { color: var(--theme-text-muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600; }
.kpi .value { font-family: 'Plus Jakarta Sans', sans-serif; font-size: 32px; font-weight: 800; margin: 6px 0 2px; line-height: 1.1; }
.kpi .value.accent { background: var(--theme-primary-grad); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.kpi .sub { color: var(--theme-text-muted); font-size: 12px; }

.bar-row { display: grid; grid-template-columns: minmax(90px, 34%) 1fr auto; align-items: center; gap: 10px; margin-bottom: 9px; font-size: 13px; }
.bar-row .name { color: var(--theme-text-main); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-row .track { background: rgba(255, 255, 255, 0.06); border-radius: 6px; height: 9px; overflow: hidden; }
.bar-row .fill { height: 100%; border-radius: 6px; background: var(--theme-primary-grad); }
.bar-row .n { color: var(--theme-text-muted); font-variant-numeric: tabular-nums; font-size: 12px; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid rgba(255, 255, 255, 0.05); }
th { color: var(--theme-text-muted); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; }
td { color: var(--theme-text-main); }
tbody tr:hover { background: rgba(255, 255, 255, 0.03); }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }

.chart { width: 100%; height: 200px; }
.spark { width: 100%; height: 56px; }

.pill { display: inline-block; padding: 3px 9px; border-radius: 999px; font-size: 11px; font-weight: 600; }
.pill.good { background: rgba(52, 211, 153, 0.15); color: var(--good); }
.pill.warn { background: rgba(251, 191, 36, 0.15); color: var(--warn); }
.pill.bad { background: rgba(251, 113, 133, 0.15); color: var(--bad); }
.pill.mute { background: rgba(160, 174, 192, 0.15); color: var(--theme-text-muted); }

/* Real vs test, on every address row. Real is calm green, test is a muted
   amber that reads as "ours, not a customer", unknown is neutral grey. */
.kind {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}
.kind.real { background: rgba(52, 211, 153, 0.15); color: var(--good); }
.kind.test { background: rgba(251, 191, 36, 0.15); color: var(--warn); }
.kind.unknown { background: rgba(160, 174, 192, 0.12); color: var(--theme-text-muted); }

.notice {
  border-radius: var(--radius-md);
  padding: 14px 18px;
  font-size: 13px;
  line-height: 1.6;
  border: 1px solid;
  margin-bottom: 12px;
}
.notice.warn { background: rgba(251, 191, 36, 0.07); border-color: rgba(251, 191, 36, 0.3); color: #fde68a; }
.notice.good { background: rgba(52, 211, 153, 0.07); border-color: rgba(52, 211, 153, 0.3); color: #a7f3d0; }
.notice strong { color: #fff; }

.empty { color: var(--theme-text-muted); font-size: 13px; padding: 18px 0; text-align: center; }

.foot { padding: 20px 28px; color: var(--theme-text-muted); font-size: 12px; text-align: center; border-top: 1px solid var(--theme-card-border); }

.funnel-step { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-radius: var(--radius-sm); background: rgba(255, 255, 255, 0.03); margin-bottom: 8px; border-left: 3px solid var(--theme-accent); }
.funnel-step .lbl { font-size: 13px; }
.funnel-step .val { font-family: 'Plus Jakarta Sans', sans-serif; font-weight: 700; font-size: 16px; }

@media (max-width: 700px) {
  .topbar { padding: 14px 16px; }
  main { padding: 18px 16px 40px; }
  .tabs { padding: 12px 16px 0; }
  .kpi .value { font-size: 26px; }
}
