/* ============================================================
   THE BRAIN · design system (loaded after each page's styles)
   Brand: Nativz 2026 dark/product mode (see nativz-homepage/BRAND.md)
   Outfit type (700 max) · electric blue #00adef · dot-grid · navy gradient
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700&display=swap');

:root {
  /* Nativz brand tokens (Cortex dark mode) */
  --brand: #00adef;
  --brand-strong: #0090cc;
  --dark: #060e1a;
  --navy: #0a1628;
  --navy-2: #0e1d33;
  --line-brand: rgba(0, 173, 239, 0.22);
  --card-fill: rgba(255, 255, 255, 0.04);

  /* chat + dashboard + scorecards vocabulary → brand */
  --bg: #060e1a;
  --surface: #0c1930;
  --surface2: #122340;
  --surface3: #18304f;
  --border: rgba(255, 255, 255, 0.10);
  --text: #ffffff;
  --text-muted: rgba(255, 255, 255, 0.55);
  --accent: #00adef;
  --accent-hover: #3cc5ff;
  --accent-glow: rgba(0, 173, 239, 0.28);
  --green: #34d399;
  --green-dim: rgba(52, 211, 153, 0.14);
  --red: #f87171;
  --red-dim: rgba(248, 113, 113, 0.14);
  --orange: #fbbf24;
  --orange-dim: rgba(251, 191, 36, 0.14);
  --cyan: #22d3ee;
  --purple: #a78bfa;

  /* report + shc vocabulary → brand */
  --panel: #0c1930;
  --panel2: #122340;
  --line: rgba(255, 255, 255, 0.10);
  --txt: #ffffff;
  --muted: rgba(255, 255, 255, 0.55);
  --gold: #e8b84a;
  --teal: #3fc4b0;
  --grn: #34d399;
  --blue: #60a5fa;
}

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: 'Outfit', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important;
  -webkit-font-smoothing: antialiased;
  background-color: var(--dark) !important;
  background-image: linear-gradient(135deg, var(--dark) 0%, var(--navy) 100%) !important;
  background-attachment: fixed !important;
  position: relative;
}
/* Nativz signature dot-grid */
body::before {
  content: ''; position: fixed; inset: 0; z-index: 0;
  background-image: radial-gradient(circle at 1px 1px, rgba(0, 173, 239, 0.16) 1px, transparent 0);
  background-size: 24px 24px; opacity: 0.28; pointer-events: none;
}
body > * { position: relative; z-index: 1; }

::selection { background: var(--accent-glow); color: var(--text); }
*:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 6px; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface3); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: var(--line-brand); }

/* Brand weight cap: 700 max, tight headings */
h1, h2, h3, .header-title, .sc-hero-name, .sc-grade-letter, .card .val,
.sc-metric-value, .brain-wordmark .name, b, strong {
  font-weight: 700 !important;
}
h1, h2, h3, .header-title, .sc-hero-name { letter-spacing: -0.01em; }

/* ---------- unified top navigation ---------- */
.header, .brain-topbar {
  background: rgba(6, 14, 26, 0.85) !important;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line-brand) !important;
}
.brain-topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 22px; position: sticky; top: 0; z-index: 90;
}
.brain-wordmark { display: flex; align-items: center; gap: 10px; margin-right: 6px; text-decoration: none; flex-shrink: 0; }
.brain-wordmark img.nz { height: 17px; display: block; }
.brain-wordmark .name {
  font-size: 11px; font-weight: 600 !important; text-transform: uppercase;
  letter-spacing: 0.14em; color: var(--brand); white-space: nowrap;
  border-left: 1px solid var(--line); padding-left: 10px;
}
.header-logo { display: none !important; }
.nav-links { display: flex; gap: 4px; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.nav-links::-webkit-scrollbar { display: none; }
.nav-link {
  padding: 8px 14px !important; border-radius: 999px !important;
  font-size: 13px !important; font-weight: 500 !important;
  color: var(--text-muted) !important; text-decoration: none !important;
  border: 1px solid transparent !important; white-space: nowrap;
  transition: color .15s ease, background .15s ease !important;
  background: transparent !important;
}
.nav-link:hover { color: var(--text) !important; background: var(--surface2) !important; }
.nav-link.active {
  color: #04222e !important;
  background: var(--brand) !important;
  font-weight: 600 !important;
  box-shadow: 0 10px 26px var(--accent-glow);
}
.brain-spacer { margin-left: auto; }
.brain-status { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--green); font-weight: 600; flex-shrink: 0; }
.brain-status .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 10px rgba(52,211,153,.8); animation: bnPulse 2.2s infinite; }
@keyframes bnPulse { 0%,100% { opacity: 1; } 50% { opacity: .45; } }

/* ---------- badges / chips ---------- */
.bn-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 9px; border-radius: 999px;
  font-size: 10.5px; font-weight: 600; letter-spacing: .02em;
  border: 1px solid transparent; line-height: 1.6; vertical-align: middle;
}
.bn-qbo     { background: rgba(96,165,250,.13);  color: #93c5fd; border-color: rgba(96,165,250,.34); }
.bn-stripe  { background: rgba(124,92,255,.16);  color: #c4b5fd; border-color: rgba(124,92,255,.38); }
.bn-migrating { background: var(--orange-dim);   color: var(--orange); border-color: rgba(251,191,36,.35); }
.bn-paid    { background: var(--green-dim);      color: var(--green);  border-color: rgba(52,211,153,.35); }
.bn-open    { background: var(--orange-dim);     color: var(--orange); border-color: rgba(251,191,36,.35); }
.bn-pastdue { background: var(--red-dim);        color: var(--red);    border-color: rgba(248,113,113,.4); }
.bn-neutral { background: var(--surface2);       color: var(--text-muted); border-color: var(--border); }

/* ---------- cards & numbers ---------- */
.card, .sc-metric, .client-card, .chartbox, .summary, .cfo, .stat-card, .sc-section, .sc-hero {
  background-color: var(--card-fill) !important;
  transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease;
}
.client-card:hover, .card:hover, .sc-metric:hover {
  transform: translateY(-3px);
  border-color: var(--brand) !important;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}
.card .val, .sc-metric-value, .stat-value, td.r, th.r, .client-card-meta {
  font-variant-numeric: tabular-nums;
}

/* ---------- chat page ---------- */
.quick-action {
  border-radius: 10px !important; border: 1px solid var(--border) !important;
  background: var(--card-fill) !important; color: var(--text) !important;
  font-weight: 500 !important;
  transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease !important;
}
.quick-action:hover {
  transform: translateY(-3px);
  border-color: var(--brand) !important;
  box-shadow: 0 10px 26px var(--accent-glow) !important;
}
.message.user .message-bubble { background: linear-gradient(125deg, var(--brand-strong), var(--brand)) !important; }
.send-btn { background: var(--brand) !important; box-shadow: 0 10px 26px var(--accent-glow); }
.send-btn:hover { box-shadow: 0 14px 36px rgba(0,173,239,.45); }
.input-field:focus { border-color: var(--brand) !important; box-shadow: 0 0 0 3px var(--accent-glow) !important; }

/* ---------- report page ---------- */
.preset.active, .preset.cf.active, .preset:hover { background: var(--brand) !important; border-color: var(--brand) !important; color: #04222e !important; }
.cfo button { background: var(--brand) !important; color: #04222e !important; box-shadow: 0 10px 26px var(--accent-glow); }
.summary { border-left-color: var(--brand) !important; }
.winlabel { color: var(--brand) !important; }
h1 .b { color: var(--brand) !important; }
body > h2 { color: var(--brand) !important; font-size: 12px !important; letter-spacing: 0.13em !important; } /* report/shc section eyebrows only */
.badge.qbo    { background: rgba(96,165,250,.13) !important;  color: #93c5fd !important; }
.badge.stripe { background: rgba(124,92,255,.16) !important;  color: #c4b5fd !important; }

/* ============================================================
   MOBILE (Nativz spec: 24px side pad, tighter sections, 44px targets)
   ============================================================ */
@media (max-width: 900px) {
  /* scorecards: sidebar used to display:none with no fallback */
  .sidebar {
    display: flex !important;
    flex-direction: column;
    height: 36vh;
    min-height: 230px;
    border-right: none !important;
    border-bottom: 1px solid var(--border);
  }
  .client-list { overflow-y: auto; flex: 1; min-height: 0; }
}

@media (max-width: 640px) {
  body { padding-left: 0; padding-right: 0; }
  .brain-topbar { padding: 10px 14px; gap: 8px; }
  .brain-wordmark img.nz { height: 14px; }
  .brain-wordmark .name { font-size: 10px; padding-left: 8px; }
  .brain-status span:last-child { display: none; } /* dot only, save width */
  .nav-link { padding: 9px 13px !important; font-size: 13px !important; }
  .header { flex-wrap: wrap; row-gap: 8px; padding: 10px 14px !important; }
  .header-stats { width: 100%; justify-content: space-between; gap: 10px !important; }

  /* iOS: 16px inputs prevent focus zoom; honor home-bar safe area */
  .input-field, .search-box, .cfo input[type=text], input[type=month],
  #brainGate input { font-size: 16px !important; }
  .input-area { padding-bottom: calc(12px + env(safe-area-inset-bottom)) !important; }

  /* chat quick actions: 2-up grid, comfy targets */
  .quick-actions { display: grid !important; grid-template-columns: 1fr 1fr; gap: 8px !important; }
  .quick-action { padding: 12px 10px !important; font-size: 13px !important; }
  .message { max-width: 94% !important; }

  /* report: cards already 2-up; tighten page padding */
  .daterow { gap: 8px; }
  .preset { padding: 9px 13px !important; }
}
