:root {
  --navy: #24385A;
  --blue: #3F5F92;
  --blue-2: #6C88B5;
  --sky: #A9BCD8;
  --mist: #E8EDF5;
  --bg: #F5F7FA;
  --ink: #1D2636;
  --muted: #64708A;
  --line: #E2E7EF;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(36, 56, 90, 0.04), 0 8px 24px -12px rgba(36, 56, 90, 0.10);
  --shadow-hover: 0 2px 4px rgba(36, 56, 90, 0.05), 0 18px 40px -16px rgba(36, 56, 90, 0.18);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body {
  font-family: "Plus Jakarta Sans", Inter, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
h1, h3, p { margin: 0; }

/* ---------- Site header (white bar with title and Data Beyond logo) ---------- */
.site-header { background: white; border-bottom: 1px solid var(--line); }
.site-inner {
  max-width: 1360px; margin: 0 auto; padding: 14px 28px;
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
}
.site-header h1 { font-size: 24px; font-weight: 800; letter-spacing: -0.02em; color: var(--navy); }
.tagline { font-size: 13px; color: var(--muted); margin-top: 3px; }
.site-logo {
  flex: none; display: block; border-radius: 10px; padding: 4px;
  transition: opacity 0.2s var(--ease), transform 0.2s var(--ease);
}
.site-logo img { display: block; height: 64px; width: auto; }
.site-logo:hover { opacity: 0.85; }
.site-logo:active { transform: scale(0.97); }
.site-logo:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

/* ---------- Hero (blue band with tabs and filters) ---------- */
.hero {
  background: var(--blue);
  color: white;
  padding: 20px 0 96px;
  position: relative;
  overflow: hidden;
}
.hero-inner {
  max-width: 1360px; margin: 0 auto; padding: 0 28px;
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
}

.live-pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 14px; border-radius: 999px; font-size: 13px; font-weight: 600;
  background: rgba(255,255,255,0.12); border: 1px solid rgba(255,255,255,0.2);
  backdrop-filter: blur(8px);
}
.pulse {
  width: 8px; height: 8px; border-radius: 50%; background: #7FD1AE;
  box-shadow: 0 0 0 0 rgba(127, 209, 174, 0.6);
  animation: pulse 1.8s var(--ease) infinite;
  display: inline-block;
}
.pulse.small { background: var(--blue); box-shadow: 0 0 0 0 rgba(63,95,146,0.5); animation-name: pulse-blue; }
@keyframes pulse { 70% { box-shadow: 0 0 0 10px rgba(127,209,174,0); } 100% { box-shadow: 0 0 0 0 rgba(127,209,174,0); } }
@keyframes pulse-blue { 70% { box-shadow: 0 0 0 9px rgba(63,95,146,0); } 100% { box-shadow: 0 0 0 0 rgba(63,95,146,0); } }

/* ---------- Filters ---------- */
.filters { margin-top: 26px; justify-content: flex-start; flex-wrap: wrap; gap: 28px; }
.filter { display: flex; flex-direction: column; gap: 8px; }
.filter > label {
  font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  color: rgba(255,255,255,0.6);
}
.segmented, .chips { display: flex; flex-wrap: wrap; gap: 6px; }
.segmented {
  background: rgba(255,255,255,0.1); padding: 4px; border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.16); gap: 2px;
}
.segmented label, .chips label {
  display: inline-flex; align-items: center; cursor: pointer; user-select: none;
  font-size: 13px; font-weight: 600; margin: 0 !important;
  transition: background 0.25s var(--ease), color 0.25s var(--ease), border-color 0.25s var(--ease), transform 0.15s var(--ease);
}
.segmented input, .chips input { position: absolute; opacity: 0; pointer-events: none; width: 0; height: 0; }
.segmented label { padding: 6px 14px; border-radius: 9px; color: rgba(255,255,255,0.75); }
.segmented label:hover { color: white; }
.hero .segmented label:has(input:checked) { background: white; color: var(--navy); box-shadow: 0 4px 12px -4px rgba(0,0,0,0.3); }
.chips label {
  padding: 6px 13px; border-radius: 999px; color: rgba(255,255,255,0.7);
  border: 1px solid rgba(255,255,255,0.22);
}
.chips label:hover { border-color: rgba(255,255,255,0.5); color: white; }
.chips label:active, .segmented label:active { transform: scale(0.96); }
.hero .chips label:has(input:checked) { background: rgba(255,255,255,0.95); color: var(--navy); border-color: white; }

/* ---------- Grid & cards ---------- */
.grid {
  max-width: 1360px; margin: -64px auto 0; padding: 0 28px;
  display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 18px;
  position: relative;
}
.card {
  background: white; border-radius: var(--radius); border: 1px solid var(--line);
  box-shadow: var(--shadow); padding: 20px 20px 14px; min-width: 0;
  transition: box-shadow 0.35s var(--ease), transform 0.35s var(--ease);
  animation: rise 0.7s var(--ease) both;
}
.card:hover { box-shadow: var(--shadow-hover); transform: translateY(-2px); }
@keyframes rise { from { opacity: 0; transform: translateY(16px); } }
.grid > .card:nth-child(1) { animation-delay: 0.00s; }
.grid > .card:nth-child(2) { animation-delay: 0.06s; }
.grid > .card:nth-child(3) { animation-delay: 0.12s; }
.grid > .card:nth-child(4) { animation-delay: 0.18s; }
.grid > .card:nth-child(5) { animation-delay: 0.26s; }
.grid > .card:nth-child(6) { animation-delay: 0.32s; }
.grid > .card:nth-child(7) { animation-delay: 0.40s; }
.grid > .card:nth-child(8) { animation-delay: 0.46s; }
.grid > .card:nth-child(9) { animation-delay: 0.52s; }
.grid > .card:nth-child(10) { animation-delay: 0.60s; }
.grid > .card:nth-child(11) { animation-delay: 0.66s; }

.card-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 10px; }
.card h3 { font-size: 15px; font-weight: 700; letter-spacing: -0.01em; }
.sub { font-size: 12.5px; color: var(--muted); margin-top: 3px; }

.kpi { grid-column: span 3; padding-bottom: 6px; }
.span-3 { grid-column: span 3; }
.span-4 { grid-column: span 4; }
.span-5 { grid-column: span 5; }
.span-7 { grid-column: span 7; }
.span-8 { grid-column: span 8; }

.kpi-label {
  font-size: 12px; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.06em;
}
.kpi-value {
  font-size: 32px; font-weight: 800; letter-spacing: -0.03em; margin-top: 8px;
  font-variant-numeric: tabular-nums; color: var(--navy); min-height: 40px;
}
.delta-row { margin-top: 4px; font-size: 12.5px; min-height: 20px; }
.delta { font-weight: 700; padding: 2px 8px; border-radius: 999px; font-size: 12px; }
.delta.up { background: var(--mist); color: var(--blue); }
.delta.down { background: #F6EAEA; color: #A8494C; }
.delta.neutral { background: var(--mist); color: var(--muted); }
.delta-note { color: var(--muted); }
.spark { margin: 8px -6px 0; height: 46px; }

/* ---------- Live card ---------- */
.today { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 4px; }
.today-value { font-size: 24px; font-weight: 800; color: var(--navy); font-variant-numeric: tabular-nums; }
.feed { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.feed-item {
  display: grid; grid-template-columns: 10px 1fr auto; align-items: center; gap: 10px;
  padding: 7px 10px; border-radius: 10px;
  animation: slide-in 0.5s var(--ease) both;
}
.feed-item:first-child { background: var(--mist); }
@keyframes slide-in { from { opacity: 0; transform: translateY(-10px); } }
.feed-dot { width: 8px; height: 8px; border-radius: 50%; }
.feed-dot.p0 { background: var(--navy); } .feed-dot.p1 { background: var(--blue); }
.feed-dot.p2 { background: var(--blue-2); } .feed-dot.p3 { background: var(--sky); }
.feed-acct { font-size: 13px; font-weight: 600; }
.feed-meta { font-size: 11.5px; color: var(--muted); }
.feed-amt { font-size: 13px; font-weight: 700; color: var(--navy); font-variant-numeric: tabular-nums; }

/* ---------- Accounts ---------- */
.accounts { display: flex; flex-direction: column; gap: 12px; padding: 4px 0 8px; }
.acct-top { display: flex; align-items: center; gap: 10px; font-size: 13.5px; }
.rank { font-size: 11px; font-weight: 700; color: var(--sky); width: 18px; font-variant-numeric: tabular-nums; }
.acct-name { font-weight: 600; }
.acct-region {
  font-size: 11px; color: var(--muted); background: var(--mist);
  padding: 2px 8px; border-radius: 999px;
}
.acct-rev { margin-left: auto; font-weight: 700; color: var(--navy); font-variant-numeric: tabular-nums; }
.bar { height: 6px; background: var(--mist); border-radius: 999px; margin: 6px 0 0 28px; overflow: hidden; }
.bar-fill {
  height: 100%; border-radius: inherit;
  background: var(--blue);
}

.foot { text-align: center; font-size: 12px; color: var(--muted); padding: 28px 0 36px; }
.foot a { color: var(--blue); font-weight: 600; text-decoration: none; }
.foot a:hover { text-decoration: underline; }

/* ---------- Tabs ---------- */
.tabbar { margin-top: 0; }
.tabs {
  display: flex; gap: 24px; flex: 1;
  border-bottom: 1px solid rgba(255,255,255,0.18);
}
.tabs label {
  display: inline-flex; align-items: center; cursor: pointer; user-select: none; margin: 0 !important;
  padding: 0 2px 10px; font-size: 14px; font-weight: 600; color: rgba(255,255,255,0.65);
  border-bottom: 2px solid transparent; margin-bottom: -1px !important;
  transition: color 0.2s var(--ease), border-color 0.2s var(--ease);
}
.tabs label:hover { color: white; }
.tabs input { position: absolute; opacity: 0; pointer-events: none; width: 0; height: 0; }
.hero .tabs label:has(input:checked) { color: white; border-bottom-color: white; }
.tabbar + .filters { margin-top: 20px; }
.filters + .filters { margin-top: 20px; }
.page.tab-sales .only-workforce, .page.tab-workforce .only-sales { display: none !important; }

/* ---------- Department scorecard ---------- */
.scorecard-wrap { overflow-x: auto; }
.scorecard { min-width: 520px; font-size: 13.5px; }
.sc-row {
  display: grid; grid-template-columns: 1.7fr repeat(5, 1fr); align-items: center; gap: 8px;
  padding: 11px 0; border-bottom: 1px solid var(--line);
}
.sc-row > :not(:first-child) { justify-self: end; font-variant-numeric: tabular-nums; }
.sc-row:last-child { border-bottom: 0; }
.sc-head { padding-top: 2px; }
.sc-head span {
  font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em;
}
.sc-name { font-weight: 600; }
.pill { padding: 2px 9px; border-radius: 999px; font-weight: 700; font-size: 12px; }
.pill.ok { background: var(--mist); color: var(--navy); }
.pill.warn { background: #F6EAEA; color: #A8494C; }

/* ---------- Embed mode (?embed=1) ---------- */
.embed .site-header, .embed .foot { display: none; }
.embed .grid { padding-bottom: 28px; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .kpi { grid-column: span 6; }
  .span-3, .span-4, .span-5, .span-7, .span-8 { grid-column: span 12; }
}
@media (max-width: 640px) {
  .hero-inner, .grid { padding: 0 16px; }
  .site-inner { padding: 12px 16px; gap: 12px; }
  .site-header h1 { font-size: 19px; }
  .tagline { font-size: 12px; }
  .site-logo img { height: 46px; }
  .kpi { grid-column: span 12; }
  .live-pill { display: none; }
  .filters { gap: 18px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
