@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&family=Newsreader:ital,wght@0,400;0,600;1,400&display=swap');

:root {
  --pg-red: #D41A2A;
  --pg-red-dark: #A81422;
  --pg-navy: #0F2B4C;
  --pg-navy-light: #1A3D66;
  --pg-slate: #2C3E50;
  --pg-gold: #D4A843;
  --pg-green: #1B8F5A;
  --pg-green-light: #D1F0E0;
  --pg-warn: #E67E22;
  --pg-bg: #F7F8FA;
  --pg-card: #FFFFFF;
  --pg-border: #E8ECF1;
  --pg-text: #1A1A2E;
  --pg-muted: #8896A6;
  --radius: 8px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.08);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);

  /* ── Department identity colours ── */
  --dept-ops: #D41A2A;       /* Operations  – red    */
  --dept-ops-bg: #FDE8EA;
  --dept-ops-dark: #A81422;
  --dept-fin: #2a7d45;       /* Finance     – green  */
  --dept-fin-bg: #E4F4EC;
  --dept-fin-dark: #1F6035;
  --dept-mkt: #D4A843;       /* Marketing   – gold   */
  --dept-mkt-bg: #FDF5E0;
  --dept-mkt-dark: #B8900A;
  --dept-dsa: #1a6fc4;       /* DSA Tracker – blue   */
  --dept-dsa-bg: #E8F1FB;
  --dept-dsa-dark: #1358A0;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Inter', sans-serif; background: var(--pg-bg); color: var(--pg-text); min-height: 100vh; }

/* ─── Refresh button ─── */
.header-right { display: flex; align-items: center; gap: 16px; }
.refresh-btn {
  background: rgba(255,255,255,0.15); color: #fff; border: none;
  padding: 6px 14px; border-radius: 6px; font-weight: 700; font-size: 12px;
  cursor: pointer; transition: background 0.2s;
}
.refresh-btn:hover { background: rgba(255,255,255,0.25); }
.refresh-btn.spinning { opacity: 0.6; pointer-events: none; }
.refresh-btn.spinning::before {
  content: '⟳'; display: inline-block; animation: spin 1s linear infinite;
  margin-right: 4px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.data-age { font-size: 11px; color: var(--pg-muted); margin-left: 8px; }

/* ─── Persistent top nav ───────────────────────────────────────────────
   Always-visible sticky nav across every portal. Sits above .landing and
   .section-page; their internal headers (landing-header / page-header)
   are still rendered immediately under it. The two label spans inside
   each link (-full / -short) switch via the media query at the bottom of
   this block — desktop sees "Operations", mobile sees "OPS". */
.top-nav {
  position: sticky; top: 0; z-index: 100;
  background: var(--pg-navy);
  display: flex; align-items: stretch; gap: 0;
  padding: 0 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  height: 48px;
}
.top-nav-brand {
  display: flex; align-items: center; gap: 10px;
  color: #fff; text-decoration: none;
  padding: 0 14px 0 0; margin-right: 8px;
  border-right: 1px solid rgba(255,255,255,0.08);
}
.top-nav-logo {
  width: 32px; height: 32px; background: var(--pg-red);
  border-radius: 5px; display: flex; align-items: center; justify-content: center;
  font-weight: 900; font-size: 13px; color: #fff; letter-spacing: -0.5px;
  flex-shrink: 0;
}
.top-nav-logo-img {
  height: 32px; width: auto; max-width: 120px;
  object-fit: contain; flex-shrink: 0;
}
.top-nav-brand-text { line-height: 1.1; }
.top-nav-brand-title { color: #fff; font-weight: 800; font-size: 13px; letter-spacing: 0.4px; }
.top-nav-brand-sub   { color: rgba(255,255,255,0.5); font-size: 10px; font-weight: 500; margin-top: 1px; }
.top-nav-links {
  display: flex; align-items: stretch; gap: 0;
  flex: 1;
}
.top-nav-link {
  display: flex; align-items: center; padding: 0 16px;
  color: rgba(255,255,255,0.65); text-decoration: none;
  font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em;
  border-bottom: 3px solid transparent;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}
.top-nav-link:hover { color: #fff; background: rgba(255,255,255,0.05); }
.top-nav-link.active {
  color: #fff;
  border-bottom-color: var(--pg-red); /* default / home */
  background: rgba(255,255,255,0.04);
  border-bottom-width: 4px;
}
/* Per-department active underline colours */
.top-nav-link[data-nav-target="ops"].active  { border-bottom-color: var(--dept-ops); }
.top-nav-link[data-nav-target="fin"].active  { border-bottom-color: var(--dept-fin); }
.top-nav-link[data-nav-target="mkt"].active  { border-bottom-color: var(--dept-mkt); }
.top-nav-link[data-nav-target="dsa"].active  { border-bottom-color: var(--dept-dsa); }
.top-nav-link[data-nav-target="home"].active { border-bottom-color: var(--pg-red); }
.top-nav-label-short { display: none; }
.top-nav-right {
  display: flex; align-items: center; gap: 10px;
  padding-left: 12px; margin-left: auto;
  border-left: 1px solid rgba(255,255,255,0.08);
}
/* Freshness dot — color is set by JS via the data-state attribute:
   green = ≤4h, amber = 4–24h, red = >24h or unknown */
.top-nav-dot {
  display: inline-block; width: 9px; height: 9px; border-radius: 50%;
  background: #555; flex-shrink: 0;
  box-shadow: 0 0 0 2px rgba(255,255,255,0.08);
  transition: background 0.2s;
}
.top-nav-dot[data-state="fresh"] { background: #4ADE80; box-shadow: 0 0 0 2px rgba(74,222,128,0.18); }
.top-nav-dot[data-state="aging"] { background: #FACC15; box-shadow: 0 0 0 2px rgba(250,204,21,0.18); }
.top-nav-dot[data-state="stale"] { background: #F87171; box-shadow: 0 0 0 2px rgba(248,113,113,0.18); }
.top-nav-refresh {
  background: rgba(255,255,255,0.10); color: #fff; border: none;
  width: 32px; height: 32px; border-radius: 6px;
  font-size: 16px; font-weight: 700; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s;
}
.top-nav-refresh:hover { background: rgba(255,255,255,0.22); }
.top-nav-refresh.spinning { opacity: 0.6; pointer-events: none; }
.top-nav-refresh.spinning .top-nav-refresh-icon {
  display: inline-block; animation: spin 1s linear infinite;
}
@media (max-width: 760px) {
  .top-nav { padding: 0 8px; height: 44px; }
  .top-nav-brand-text { display: none; }
  .top-nav-brand { padding-right: 8px; margin-right: 4px; }
  .top-nav-link { padding: 0 10px; font-size: 11px; }
  .top-nav-label-full { display: none; }
  .top-nav-label-short { display: inline; }
  .top-nav-right { padding-left: 8px; gap: 8px; }
}

/* ─── Landing ─── */
.landing { min-height: 100vh; display: none; flex-direction: column; }
.landing.active { display: flex; }
.landing-header {
  background: var(--pg-navy); padding: 16px 32px;
  display: flex; align-items: center; justify-content: space-between;
}
.logo-group { display: flex; align-items: center; gap: 14px; }
.logo-mark {
  width: 44px; height: 44px; background: var(--pg-red);
  border-radius: 6px; display: flex; align-items: center; justify-content: center;
  font-weight: 900; font-size: 18px; color: #fff; letter-spacing: -1px;
}
.logo-text { color: #fff; font-weight: 700; font-size: 18px; letter-spacing: 0.5px; }
.logo-sub { color: rgba(255,255,255,0.5); font-size: 12px; font-weight: 500; margin-top: 1px; }
.header-time { color: rgba(255,255,255,0.6); font-size: 13px; font-weight: 500; }

.landing-hero {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 40px 20px 60px;
}
.hero-greeting {
  font-family: 'Newsreader', serif; font-size: 36px; font-weight: 600;
  color: var(--pg-navy); margin-bottom: 6px;
}
.hero-sub { color: var(--pg-muted); font-size: 15px; margin-bottom: 48px; }

.landing-footer {
  margin-top: 48px; padding: 16px 0 0; text-align: center;
  font-size: 12px; color: var(--pg-muted);
  display: flex; gap: 10px; justify-content: center; align-items: center; flex-wrap: wrap;
}
.landing-footer a { color: var(--pg-navy); text-decoration: none; }
.landing-footer a:hover { text-decoration: underline; }
.landing-footer .footer-sep { opacity: 0.5; }

.section-cards { display: grid; grid-template-columns: repeat(3, 340px); gap: 28px; }
.section-card {
  background: var(--pg-card); border-radius: 12px; padding: 32px 28px;
  box-shadow: var(--shadow-md); cursor: pointer; position: relative;
  border: 2px solid transparent; transition: all 0.3s ease; overflow: hidden;
}
.section-card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 4px; }
.section-card.ops::before { background: var(--pg-red); }
.section-card.fin::before { background: var(--pg-navy); }
.section-card.mkt::before { background: var(--pg-gold); }
.section-card.bank::before { background: var(--pg-green); }
.section-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: var(--pg-border); }
.card-icon {
  width: 48px; height: 48px; border-radius: 10px; display: flex;
  align-items: center; justify-content: center; font-size: 22px; margin-bottom: 18px;
}
.ops .card-icon { background: #FDE8EA; color: var(--pg-red); }
.fin .card-icon { background: #E3EBF5; color: var(--pg-navy); }
.mkt .card-icon { background: #FDF5E6; color: var(--pg-gold); }
.bank .card-icon { background: #D9F2E4; color: var(--pg-green); }
.card-title { font-size: 20px; font-weight: 800; margin-bottom: 8px; }
.card-desc { font-size: 13px; color: var(--pg-muted); line-height: 1.6; margin-bottom: 20px; }
.card-stats { display: flex; gap: 16px; }
.card-stat { text-align: center; flex: 1; padding: 10px 0; background: var(--pg-bg); border-radius: 6px; }
.card-stat-val { font-size: 18px; font-weight: 800; }
.ops .card-stat-val { color: var(--pg-red); }
.fin .card-stat-val { color: var(--pg-navy); }
.mkt .card-stat-val { color: var(--pg-gold); }
.bank .card-stat-val { color: var(--pg-green); }
.card-stat-label { font-size: 10px; color: var(--pg-muted); text-transform: uppercase; letter-spacing: 0.8px; font-weight: 600; margin-top: 2px; }
.card-enter {
  display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 1px; margin-top: 20px;
}
.ops .card-enter { color: var(--pg-red); }
.fin .card-enter { color: var(--pg-navy); }
.mkt .card-enter { color: var(--pg-gold); }
.bank .card-enter { color: var(--pg-green); }

/* ─── Section pages ─── */
.section-page { display: none; min-height: 100vh; }
.section-page.active { display: block; }
.page-header {
  padding: 14px 32px; display: flex; align-items: center; justify-content: space-between;
}
.page-header.ops-hdr { background: var(--pg-red); }
.page-header.fin-hdr { background: var(--pg-navy); }
.page-header.mkt-hdr { background: var(--pg-gold); }
.page-header.bank-hdr { background: var(--pg-green); }
.page-header .logo-group .logo-text, .page-header .header-time { color: #fff; }
.page-header .logo-sub { color: rgba(255,255,255,0.6); }
.back-btn {
  display: flex; align-items: center; gap: 6px; color: #fff; font-size: 12px;
  font-weight: 700; text-transform: uppercase; letter-spacing: 1px;
  cursor: pointer; background: rgba(255,255,255,0.15); border: none;
  padding: 8px 16px; border-radius: 6px; transition: background 0.2s;
}
.back-btn:hover { background: rgba(255,255,255,0.25); }
.page-body { padding: 24px 32px; max-width: none; margin: 0; }

/* ─── Section labels ─── */
.sec-label {
  font-size: 11px; font-weight: 800; text-transform: uppercase;
  letter-spacing: 2px; margin-bottom: 14px; display: flex;
  align-items: center; gap: 12px;
}
.sec-label::after { content: ''; flex: 1; height: 1px; background: var(--pg-border); }
.sec-label.red { color: var(--pg-red); }
.sec-label.navy { color: var(--pg-navy); }
.sec-label.gold { color: var(--pg-gold); }

/* ─── KPI strip ─── */
.kpi-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 28px; }
.kpi {
  background: var(--pg-card); border-radius: var(--radius); padding: 16px 18px;
  box-shadow: var(--shadow-sm); border-left: 3px solid var(--pg-border);
}
.kpi.accent-red { border-left-color: var(--pg-red); }
.kpi.accent-navy { border-left-color: var(--pg-navy); }
.kpi.accent-green { border-left-color: var(--pg-green); }
.kpi.accent-gold { border-left-color: var(--pg-gold); }
.kpi.accent-warn { border-left-color: var(--pg-warn); }
.kpi-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: var(--pg-muted); }
.kpi-val { font-size: 26px; font-weight: 900; margin-top: 4px; line-height: 1; }
.kpi-note { font-size: 11px; color: var(--pg-muted); margin-top: 4px; }

/* ─── One-row clickable KPI card row (DSA Browse) ────────────────────
   5 cards across on desktop. On mobile the row becomes a horizontal
   scroll with snap so KPIs stay above the fold. The .active card has
   a bold border + ACTIVE badge so the current filter is obvious. Temp
   tiers map to lead heat: cold=blue (just got in), warm=gold (mid-
   review), hot=red (going to bid). */
.kpi-row {
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px; margin-bottom: 12px;
}
.kpi-card {
  position: relative;
  background: var(--pg-card); border: 0.5px solid var(--pg-border);
  border-left: 3px solid var(--pg-border);
  border-radius: var(--radius); padding: 12px 14px;
  cursor: pointer; transition: border-color 0.15s, box-shadow 0.15s, transform 0.05s;
  user-select: none;
}
.kpi-card:hover { box-shadow: var(--shadow-md); }
.kpi-card:active { transform: scale(0.99); }
.kpi-card.active {
  border: 2px solid var(--pg-navy); border-left-width: 2px;
  padding: 11px 13px;
}
.kpi-card.active::after {
  content: 'ACTIVE'; position: absolute; top: 6px; right: 8px;
  font-size: 9px; font-weight: 700; letter-spacing: 0.04em;
  padding: 1px 5px; border-radius: 3px;
  background: var(--pg-navy); color: #fff;
}
.kpi-card .kpi-label { font-size: 10px; }
.kpi-card .kpi-val { font-size: 22px; }
.kpi-card .kpi-note { font-size: 10px; }
.kpi-card.kpi-neutral { border-left-color: var(--pg-navy); }
.kpi-card.kpi-cold    { border-left-color: #185FA5; }
.kpi-card.kpi-cold .kpi-note    { color: #185FA5; font-weight: 600; }
.kpi-card.kpi-warm    { border-left-color: var(--pg-gold); }
.kpi-card.kpi-warm .kpi-note    { color: #BA7517; font-weight: 600; }
.kpi-card.kpi-hot     { border-left-color: var(--pg-red); }
.kpi-card.kpi-hot .kpi-note     { color: var(--pg-red); font-weight: 600; }
/* Active card recolors the ACTIVE badge by temperature so it's not always navy */
.kpi-card.kpi-cold.active { border-color: #185FA5; }
.kpi-card.kpi-cold.active::after { background: #185FA5; }
.kpi-card.kpi-warm.active { border-color: var(--pg-gold); }
.kpi-card.kpi-warm.active::after { background: var(--pg-gold); }
.kpi-card.kpi-hot.active  { border-color: var(--pg-red); }
.kpi-card.kpi-hot.active::after  { background: var(--pg-red); }

.kpi-filter-strip {
  display: flex; align-items: center; gap: 8px;
  background: #FCEBEB; border-left: 3px solid var(--pg-red);
  border-radius: var(--radius); padding: 8px 12px;
  font-size: 12px; color: #791F1F; margin-bottom: 18px;
}
.kpi-filter-icon { font-size: 13px; }
.kpi-filter-label { flex: 1; }
.kpi-filter-label strong { font-weight: 700; }
.kpi-filter-clear { margin-left: auto; color: #791F1F; font-size: 11px; font-weight: 700; text-decoration: none; }
.kpi-filter-clear:hover { text-decoration: underline; }

@media (max-width: 760px) {
  /* Mobile: row scrolls horizontally with snap so KPIs stay above the
     fold. Cards are fixed-width (~140px) so 2.5 fit on a phone screen,
     cueing the user that there's more to swipe. */
  .kpi-row {
    display: flex; grid-template-columns: none;
    overflow-x: auto; scroll-snap-type: x mandatory;
    gap: 8px; margin-bottom: 6px;
    padding-bottom: 6px; /* room for the scrollbar */
    -webkit-overflow-scrolling: touch;
  }
  .kpi-card {
    flex: 0 0 140px; scroll-snap-align: start;
    padding: 10px 12px;
  }
  .kpi-card.active { padding: 9px 11px; }
  .kpi-card .kpi-val { font-size: 18px; }
}

/* ─── Grids ─── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 28px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 20px; margin-bottom: 28px; }

/* ─── Panels ─── */
.panel { background: var(--pg-card); border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow: hidden; }
.panel-head {
  padding: 12px 18px; font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 1px; color: #fff;
  display: flex; align-items: center; justify-content: space-between;
}
.panel-head.red { background: var(--pg-red); }
.panel-head.navy { background: var(--pg-navy); }
.panel-head.gold { background: var(--pg-gold); }
.panel-head.slate { background: var(--pg-slate); }
.panel-head .badge {
  background: rgba(255,255,255,0.2); padding: 2px 8px; border-radius: 10px;
  font-size: 11px; font-weight: 600;
}

/* ─── Tables ─── */
.t { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.t th {
  text-align: left; padding: 10px 14px; font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.8px; color: var(--pg-muted);
  border-bottom: 2px solid var(--color-border, var(--pg-border)); background: var(--color-surface, #FAFBFC);
  position: sticky; top: 0; z-index: 1;
}
.t td { padding: 9px 14px; border-bottom: 1px solid var(--pg-border); }
.t tr:hover td { background: var(--color-surface, #F8F9FB); }
.t .num { text-align: right; font-variant-numeric: tabular-nums; }
.t .bold { font-weight: 700; }

.scroll-box { max-height: 380px; overflow-y: auto; }
.scroll-box::-webkit-scrollbar { width: 5px; }
.scroll-box::-webkit-scrollbar-thumb { background: var(--color-border, #ddd); border-radius: 3px; }

/* ─── Deployment panel map pane ─── */
#mapPane.map-hidden { width: 0 !important; opacity: 0; border-right: none; }
#opsMap { width: 100%; height: 360px; }
.jt-link { color: #1558a0; text-decoration: none; font-weight: 600; border-bottom: 1px dotted #1558a0; white-space: nowrap; }
.jt-link:hover { color: #0c3d73; border-bottom-color: #0c3d73; }

/* ─── Status dots ─── */
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 6px; }
.dot.live { background: #22c55e; box-shadow: 0 0 4px rgba(34,197,94,0.5); }
.dot.idle { background: #f59e0b; }
.dot.off { background: #ccc; }

/* ─── Progress bars ─── */
.prog-track { width: 100%; height: 6px; background: var(--color-surface-offset, #eee); border-radius: 3px; overflow: hidden; }
.prog-fill { height: 100%; border-radius: 3px; transition: width 0.8s ease; }
.prog-fill.red { background: var(--pg-red); }
.prog-fill.navy { background: var(--pg-navy); }
.prog-fill.green { background: var(--pg-green); }
.prog-fill.gold { background: var(--pg-gold); }

/* ─── Tags / Chips ─── */
.tag {
  display: inline-block; font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.5px; padding: 3px 8px; border-radius: 4px;
}
.tag.green { background: var(--pg-green-light); color: var(--pg-green); }
.tag.red { background: #FDE8EA; color: var(--pg-red); }
.tag.blue { background: #E3EBF5; color: var(--pg-navy); }
.tag.amber { background: #FEF3CD; color: #856404; }
.tag.gray { background: #eee; color: #666; }

/* ─── Marketing ideas ─── */
.mkt-idea {
  background: var(--pg-card); border-radius: var(--radius); padding: 20px;
  box-shadow: var(--shadow-sm); border-left: 3px solid var(--pg-gold);
}
.mkt-idea h4 { font-size: 14px; font-weight: 700; margin-bottom: 6px; }
.mkt-idea p { font-size: 12px; color: var(--pg-muted); line-height: 1.6; }
.mkt-idea .src { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.8px; color: var(--pg-gold); margin-top: 10px; }

/* ─── Finance summary boxes ─── */
.fin-box { text-align: center; padding: 16px; background: var(--pg-bg); border-radius: var(--radius); }
.fin-box-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: var(--pg-muted); }
.fin-box-val { font-size: 22px; font-weight: 900; margin-top: 4px; }

/* ─── Bar charts ─── */
.deposit-chart, .month-chart { width: 100%; }
.chart-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.chart-label { width: 70px; font-size: 11px; font-weight: 600; color: var(--pg-muted); text-align: right; flex-shrink: 0; }
.chart-bar-track { flex: 1; height: 22px; background: #EEF1F5; border-radius: 4px; overflow: hidden; position: relative; }
.chart-bar-fill { height: 100%; border-radius: 4px; transition: width 0.8s ease; display: flex; align-items: center; justify-content: flex-end; padding-right: 8px; }
.chart-bar-fill span { font-size: 10px; font-weight: 700; color: #fff; white-space: nowrap; }
.chart-bar-fill.navy-fill { background: linear-gradient(90deg, var(--pg-navy), var(--pg-navy-light)); }
.chart-bar-fill.green-fill { background: linear-gradient(90deg, var(--pg-green), #27AE60); }
.chart-val { width: 70px; font-size: 11px; font-weight: 700; color: var(--pg-text); text-align: right; flex-shrink: 0; }

/* ─── Period chip bar (Operations / activity period selector) ─── */
.period-btn {
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--pg-border);
  background: var(--pg-card);
  color: var(--pg-muted);
  cursor: pointer;
  transition: background .12s ease, color .12s ease, border-color .12s ease;
}
.period-btn:hover { background: var(--pg-bg); color: var(--pg-text); }
.period-btn.active {
  background: var(--dept-ops);
  border-color: var(--dept-ops);
  color: #fff;
}
.period-btn.active:hover { background: var(--dept-ops-dark); border-color: var(--dept-ops-dark); }

/* Re-use for the Reports tab chips that also use period-style filtering */
.rc-chip {
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--pg-border);
  background: var(--pg-card);
  color: var(--pg-muted);
  cursor: pointer;
  transition: background .12s ease, color .12s ease, border-color .12s ease;
}
.rc-chip:hover { background: var(--pg-bg); color: var(--pg-text); }
.rc-chip.active {
  background: var(--pg-navy);
  border-color: var(--pg-navy);
  color: #fff;
}

@media (max-width: 1100px) {
  .section-cards { grid-template-columns: 1fr; max-width: 400px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  /* Override the desktop inline grid-column-start:2 on the DSA card so it
     stacks naturally in the single-column mobile layout instead of leaving
     a phantom row above it. */
  .section-cards .section-card.dsa { grid-column-start: auto !important; }
}


/* ─── Refresh dropdown menu (top nav) ─────────────────────────────────
   Opens when the user clicks #topNavRefreshBtn. Each row refreshes one
   source independently; "Refresh all" at the top mirrors the old single-
   button behavior. Status dot in each row mirrors the global freshness
   dot's tiers (green ≤4h, amber 4-24h, red >24h). Mobile becomes a
   bottom slide-up sheet via the media query below. 2026-05-18 */
.top-nav-refresh-wrap { position: relative; }
.top-nav-refresh-menu {
  position: absolute; top: calc(100% + 6px); right: 0;
  width: 290px; background: var(--pg-card);
  border: 0.5px solid var(--pg-border);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0,0,0,0.14);
  padding: 6px; z-index: 200;
  color: var(--pg-text);
}
.trm-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 8px 10px; background: none; border: none;
  border-radius: var(--radius);
  cursor: pointer; text-align: left;
  color: var(--pg-text); font-family: inherit;
}
.trm-item:hover { background: var(--pg-bg); }
.trm-item.trm-all { background: var(--pg-bg); }
.trm-item.spinning { opacity: 0.6; pointer-events: none; }
.trm-item.spinning [data-trm-icon] { display: inline-block; animation: spin 1s linear infinite; }
.trm-chip {
  width: 26px; height: 26px; border-radius: 5px;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; flex-shrink: 0;
}
.trm-chip-all   { background: var(--pg-navy); color: #fff; }
.trm-chip-jt    { background: #FCEBEB; color: #791F1F; }
.trm-chip-qb    { background: #EAF3DE; color: #3B6D11; }
.trm-chip-plaid { background: #FAEEDA; color: #854F0B; }
.trm-body { flex: 1; min-width: 0; }
.trm-title { font-size: 13px; font-weight: 600; }
.trm-tag { font-size: 10px; color: var(--pg-muted); font-weight: 400; }
.trm-sub { font-size: 11px; color: var(--pg-muted); margin-top: 1px; }
.trm-status-dot {
  display: inline-block; width: 6px; height: 6px; border-radius: 50%;
  margin-right: 4px; vertical-align: middle;
}
.trm-status-dot.fresh { background: #4ADE80; }
.trm-status-dot.aging { background: #FACC15; }
.trm-status-dot.stale { background: #F87171; }
.trm-divider { height: 1px; background: var(--pg-border); margin: 4px 2px; }
.trm-footer {
  font-size: 10px; color: var(--pg-muted);
  padding: 6px 10px 4px;
  border-top: 0.5px solid var(--pg-border); margin-top: 4px;
}
.trm-action { color: var(--pg-muted); font-size: 14px; flex-shrink: 0; }

@media (max-width: 760px) {
  /* Mobile: convert into a bottom slide-up sheet so it's touch-friendly. */
  .top-nav-refresh-menu {
    position: fixed; left: 0; right: 0; bottom: 0; top: auto;
    width: 100%; max-width: none;
    border-radius: var(--radius) var(--radius) 0 0;
    border-bottom: none;
    padding: 14px 10px env(safe-area-inset-bottom, 14px);
    box-shadow: 0 -8px 24px rgba(0,0,0,0.18);
  }
  .top-nav-refresh-menu::before {
    content: ''; display: block;
    width: 36px; height: 4px; background: var(--pg-border);
    border-radius: 2px; margin: -4px auto 10px;
  }
  .trm-item { padding: 12px 10px; }
}


/* ─── Editorial landing hero + attention list ────────────────────────
   Replaces the centered "Where do you want to look today?" prompt with a
   date eyebrow, big serif greeting, italic narrative, then an inline list
   of items needing the user's attention. Each row is clickable and deep-
   links into the relevant portal/tab. Wired in dashboard.js by
   renderAttentionList(). 2026-05-18 */
.hero-eyebrow {
  font-size: 11px; font-weight: 700; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--pg-red);
  margin-bottom: 10px;
}
.hero-narrative {
  font-family: 'Newsreader', serif; font-size: 18px; font-style: italic;
  color: var(--pg-muted); margin-bottom: 24px;
}
.hero-narrative .data-age { font-style: normal; margin-left: 8px; }
.hero-portals-prompt {
  font-family: 'Newsreader', serif; font-size: 14px; font-style: italic;
  color: var(--pg-muted); margin: 28px 0 16px; text-align: center;
}
.attention-list {
  display: flex; flex-direction: column;
  width: 100%; max-width: 760px; margin: 0 auto 8px;
}
.attn-group { margin-bottom: 18px; }
.attn-group:last-child { margin-bottom: 4px; }
.attn-group-label {
  font-size: 11px; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; margin-bottom: 6px;
}
.attn-group-label.cfo { color: #185FA5; }
.attn-group-label.ops { color: var(--pg-red); }
.attn-group-label.sales { color: #B8900A; }
.attn-group-label.grow { color: #3B6D11; }
.attn-rows {
  display: flex; flex-direction: column; gap: 1px;
  background: var(--pg-border); border-radius: var(--radius);
  overflow: hidden;
}
.attn-row {
  background: var(--pg-card); padding: 10px 14px;
  display: flex; align-items: center; gap: 14px;
  cursor: pointer; border: none; width: 100%; text-align: left;
  color: var(--pg-text); font-family: inherit;
  transition: background 0.15s;
}
.attn-row:hover { background: var(--pg-bg); }
.attn-row .attn-chip {
  font-size: 13px; font-weight: 700; min-width: 56px; height: 32px;
  padding: 0 8px; border-radius: var(--radius);
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.attn-chip.red    { background: #FCEBEB; color: #791F1F; }
.attn-chip.amber  { background: #FAEEDA; color: #854F0B; }
.attn-chip.blue   { background: #E6F1FB; color: #0C447C; }
.attn-chip.green  { background: #EAF3DE; color: #3B6D11; }
.attn-body { flex: 1; min-width: 0; }
.attn-title { font-size: 14px; font-weight: 600; }
.attn-sub { font-size: 11px; color: var(--pg-muted); margin-top: 1px; line-height: 1.4; overflow: hidden; text-overflow: ellipsis; }
.attn-dest {
  font-size: 10px; color: var(--pg-muted); text-transform: uppercase;
  letter-spacing: 0.04em; font-weight: 600; flex-shrink: 0; white-space: nowrap;
}
@media (max-width: 760px) {
  .attention-list { max-width: 100%; padding: 0 16px; }
  .attn-row { padding: 12px 12px; gap: 10px; }
  .attn-dest { display: none; }
}

.landing-hero { align-items: flex-start; padding: 56px 32px 60px; max-width: 1100px; margin: 0 auto; width: 100%; }
.hero-greeting { font-size: 38px; line-height: 1.1; }
@media (max-width: 760px) {
  .landing-hero { padding: 32px 16px 40px; }
  .hero-greeting { font-size: 28px; }
}


/* ─── Slim section header (replaces .page-header) ─────────────────────
   2026-05-18 — Operations/Finance/Marketing/Banking/DSA all share the
   same compact layout: a 3px colored top bar (portal identity), a tiny
   eyebrow with section name + question, and an inline search input on
   the right. Replaces the old ~70px banner with the PG logo + Back-to-
   Home button — both were redundant with the persistent top nav. */
.section-header {
  display: flex; align-items: center; gap: 16px;
  padding: 12px 32px;
  background: var(--pg-card);
  border-bottom: 0.5px solid var(--pg-border);
  border-top: 3px solid transparent;
}
.section-header-ops  { border-top-color: var(--dept-ops); border-top-width: 4px; }
.section-header-fin  { border-top-color: var(--dept-fin); border-top-width: 4px; }
.section-header-mkt  { border-top-color: var(--dept-mkt); border-top-width: 4px; }
.section-header-dsa  { border-top-color: var(--dept-dsa); border-top-width: 4px; }
.section-header-bank { border-top-color: var(--pg-green); border-top-width: 4px; }
.section-header-label {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em;
  font-weight: 700; color: var(--dept-ops);
  white-space: nowrap;
}
.section-header-fin  .section-header-label { color: var(--dept-fin); }
.section-header-mkt  .section-header-label { color: var(--dept-mkt-dark); }
.section-header-dsa  .section-header-label { color: var(--dept-dsa); }
.section-header-bank .section-header-label { color: #3B6D11; }
.section-header-bar { display: none; } /* the 3px border-top carries the color now */
.section-header-title { font-weight: 700; }
.section-header-sub  { color: var(--pg-muted); font-weight: 500; letter-spacing: 0.04em; text-transform: none; font-size: 12px; }
.section-header-search {
  flex: 1; max-width: 520px;
  display: flex; align-items: center; gap: 8px;
  background: var(--pg-bg);
  border: 0.5px solid var(--pg-border);
  border-radius: var(--radius);
  padding: 0 10px;
  transition: border-color 0.15s, background 0.15s;
}
.section-header-search:focus-within {
  border-color: var(--pg-navy);
  background: var(--pg-card);
}
.section-header-search-icon { color: var(--pg-muted); font-size: 14px; display: inline-flex; }
.section-header-search input {
  flex: 1;
  background: transparent; border: none; outline: none;
  font-size: 13px; padding: 8px 0;
  color: var(--pg-text); font-family: inherit;
}
.section-header-search input::placeholder { color: var(--pg-muted); }
.section-header-search-kbd {
  font-size: 11px; font-weight: 600;
  background: var(--pg-card);
  border: 0.5px solid var(--pg-border);
  border-radius: 3px;
  padding: 1px 5px;
  color: var(--pg-muted);
}
.section-header-action {
  background: var(--pg-navy); color: #fff; text-decoration: none;
  font-size: 11px; font-weight: 600; letter-spacing: 0.04em;
  padding: 6px 12px; border-radius: var(--radius);
  white-space: nowrap;
}
.section-header-action:hover { background: var(--pg-navy-light); }
@media (max-width: 760px) {
  .section-header { padding: 10px 16px; flex-wrap: wrap; gap: 8px; }
  .section-header-search { width: 100%; max-width: none; }
  .section-header-search-kbd { display: none; }
  .section-header-sub { display: none; }
}


/* ─── Region selector chips (in section-header) ──────────────────────
   Single-select region toggles — SoCal, Central, NorCal, All CA. Active
   chip = filled red. .empty chips are dimmed with dotted border for
   regions that haven't been scraped yet. Selection persists via
   localStorage. Wired in dashboard.js (wireRegionChips). 2026-05-18 */
.region-chips {
  display: flex; gap: 4px; align-items: center;
  padding-left: 12px; margin-left: 4px;
  border-left: 0.5px solid var(--pg-border);
}
.region-chip {
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.04em;
  padding: 4px 10px; border-radius: 999px;
  background: none; border: 0.5px solid transparent;
  color: var(--pg-muted); cursor: pointer;
  font-family: inherit; white-space: nowrap;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.region-chip:hover { background: var(--pg-bg); color: var(--pg-text); }
.region-chip.active {
  background: #FCEBEB; color: #791F1F; font-weight: 800;
}
.region-chip.empty {
  border-style: dashed; border-color: var(--pg-border);
  color: var(--pg-muted); cursor: not-allowed;
}
.region-c