/* ────────────────────────────────────────────────────────────────────
   PalmCraft Dashboards — GOLDEN STANDARD chrome (V22).
   Every dashboard links to this. Inline page styles should only add
   page-specific bits (e.g. a chart layout) on top of these tokens.
   ──────────────────────────────────────────────────────────────────── */

:root{
  /* Brand palette */
  --navy: #0F1B2D;
  --gold: #C9A961;
  --pale: #F4EFE6;
  --cream: #FAF7F0;

  /* Functional palette */
  --link: #1A73E8;
  --good: #1E8E3E;
  --warn: #B06000;
  --bad:  #C5221F;
  --good-bg: #E6F4EA;
  --warn-bg: #FEF7E0;
  --bad-bg:  #FCE8E6;
  --info:    #1967D2;
  --info-bg: #E8F0FE;

  /* Neutrals */
  --border:      #E0E0E0;
  --border-soft: #EDEDED;
  --text:        #202124;
  --muted:       #5F6368;
  --light-bg:    #F8F9FA;

  color-scheme: light;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 13px; line-height: 1.5; color: var(--text);
  margin: 0; padding: 0; background: #fafafa;
}
/* (2026-06-10) The cover is full-bleed at top:0 — no gap above it to mask,
   so the old body::before 16px strip is gone. */

/* ── CONTAINER ──────────────────────────────────────────────────────── */
/* (2026-06-10) FULL-WIDTH like the chrome above it — no max-width cap, no
   centered-card margins/shadow. The white content frame always spans the
   visible frame edge to edge, matching the full-bleed cover/tab-strip. */
.container {
  max-width: none;
  margin: 0;
  padding: 196px 36px 36px;   /* 200px top reserved for fixed cover+tabs+KPIs */
  background: white;
}

/* ── COVER ──────────────────────────────────────────────────────────── */
.cover {
  padding: 11px 36px 10px;
  background: linear-gradient(135deg, var(--navy), #1a2842);
  color: white;
  /* FIXED to viewport — never scrolls. FULL-BLEED edge to edge (standard as
     of 2026-06-10): the band always covers the page width, nothing hangs
     beside it regardless of the .container max-width. */
  position: fixed;
  top: 0; left: 0;
  width: 100%; max-width: none;
  z-index: 51;
}
.cover-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.cover-left { display: inline-flex; align-items: center; gap: 18px; }
.cover-logo {
  display: block; height: 35px; width: auto;
  filter: invert(1); mix-blend-mode: screen;
}
.cover-title { display: flex; flex-direction: column; }
.cover-title .h   { font-size: 14px; font-weight: 600; color: white; line-height: 1.2; letter-spacing: 0.02em; }
.cover-title .sub { color: rgba(255,255,255,0.65); font-size: 11px; margin-top: 2px; white-space: nowrap; }
.cover-status {
  display: flex; align-items: center; gap: 14px;
  color: rgba(255,255,255,0.75); font-size: 12px; white-space: nowrap;
}
.cover-status .subhead { font-size: 11px; color: rgba(255,255,255,0.85); white-space: nowrap; }
.cover-status .age { font-size: 11px; color: rgba(255,255,255,0.6); font-variant-numeric: tabular-nums; }

/* "Back to dashboards" pill — left of logo */
.cover-back {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 12px;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 999px;
  color: rgba(255,255,255,0.85);
  font-size: 11px; font-weight: 600;
  letter-spacing: 0.06em; text-decoration: none; white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.cover-back:hover {
  background: rgba(201,169,97,0.18); border-color: var(--gold); color: white;
}
.cover-back svg { width: 11px; height: 11px; }

/* Cover icon buttons (realign, refresh, etc.) */
.cover-icon-btn {
  width: 30px; height: 30px;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; border: none; color: white;
  cursor: pointer; padding: 0; border-radius: 4px;
  transition: background 0.12s;
}
.cover-icon-btn:hover { background: rgba(255,255,255,0.12); }
.cover-icon-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.cover-icon-btn svg { width: 18px; height: 18px; transition: transform 0.2s; }

/* Spinning refresh icon while a fetch is in-flight */
.cover-icon-btn.is-loading svg { animation: cover-refresh-spin 0.9s linear infinite; }
@keyframes cover-refresh-spin { to { transform: rotate(360deg); } }

/* v0.9.33 Phase 4: "data changed in CRM" indicator.
   Set on the refresh button when /staleness/all reports that an upstream
   webhook flagged the dashboard's snapshot as stale. The amber background
   + subtle pulse pulls the eye without screaming for attention; clicking
   the refresh button rebuilds the snapshot and the server clears the flag,
   so this class drops off automatically on the next poll. */
.cover-icon-btn.is-stale {
  background: #f59e0b;
  color: white;
  box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.55);
  animation: cover-stale-pulse 2s ease-in-out infinite;
}
.cover-icon-btn.is-stale:hover { background: #d97706; }
.cover-icon-btn.is-stale.is-loading { animation: cover-refresh-spin 0.9s linear infinite; box-shadow: none; }
@keyframes cover-stale-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0.55); }
  60%  { box-shadow: 0 0 0 8px rgba(245, 158, 11, 0); }
  100% { box-shadow: 0 0 0 0 rgba(245, 158, 11, 0); }
}
/* Stale label that sits next to the button. Distinct color so it stands
   out from the normal "Updated Xs ago" status text. */
.cover-status #refreshLabel.is-stale {
  color: #f59e0b;
  font-weight: 600;
}

/* Inline status label that sits next to the refresh button while loading.
   Created dynamically by boot-progress.js — see #refreshLabel. */
.cover-status #refreshLabel {
  font-size: 11px;
  color: rgba(255,255,255,0.7);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  transition: opacity 0.2s;
  margin-right: 4px;
}
.cover-status #refreshLabel:empty { opacity: 0; }

/* Top-of-viewport boot/refresh progress bar.
   3px high, gold, shimmering — appears during snapshot fetch + manual refresh. */
.boot-progress {
  position: fixed; top: 0; left: 0; right: 0;
  height: 3px;
  background: rgba(15,27,45,0.06);
  z-index: 100;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s;
}
.boot-progress.is-active { opacity: 1; }
.boot-progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--gold, #C9A961), #e6cf8d, var(--gold, #C9A961));
  background-size: 200% 100%;
  animation: boot-progress-shimmer 1.4s linear infinite;
  transition: width 0.35s ease-out;
  box-shadow: 0 1px 4px rgba(201,169,97,0.5);
}
@keyframes boot-progress-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Optional text-pill button in the cover */
.cover-text-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 12px;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.22);
  border-radius: 6px;
  color: rgba(255,255,255,0.92);
  font-size: 11px; font-weight: 600;
  cursor: pointer; font-family: inherit;
  transition: background 0.12s, border-color 0.12s;
}
.cover-text-btn:hover { background: rgba(201,169,97,0.18); border-color: var(--gold); }

/* ── TAB STRIP (RECEIVABLES / PAYABLES style) ───────────────────────── */
.tab-strip {
  border-bottom: 2px solid var(--border);
  margin: 0;
  padding: 6px 36px 6px;
  display: flex; align-items: flex-end; justify-content: space-between; gap: 24px;
  /* FIXED right below the full-bleed cover. White bg so scrolling content
     doesn't bleed through. Full width, same as the cover. */
  position: fixed;
  top: 56px; left: 0;
  width: 100%; max-width: none;
  z-index: 50;
  background: white;
}
.tab-strip-tabs { display: flex; gap: 0; }
.tab-strip .tab {
  background: none; border: none;
  padding: 9px 20px;
  font-size: 12px; font-weight: 600;
  color: var(--muted); cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  letter-spacing: 0.06em;
  font-family: inherit;
  transition: color 0.12s;
}
.tab-strip .tab:hover { color: var(--navy); }
.tab-strip .tab.active { color: var(--navy); border-bottom-color: var(--gold); }
.tab-strip .tab[disabled] { cursor: not-allowed; opacity: 0.55; }
.tab-strip .tab[disabled]:hover { color: var(--muted); }

/* Right side of tab strip: filter dropdowns + icon button */
.tab-strip-filters {
  display: flex; align-items: center; gap: 8px;
  padding-bottom: 6px; flex-shrink: 0;
}
.dropdown-trigger {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; height: 26px; cursor: pointer;
  background: white;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-family: inherit; font-size: 12px;
}
.dropdown-trigger .dd-label { color: var(--muted); font-weight: 500; }
.dropdown-trigger .dd-value { color: var(--navy); font-weight: 700; }
.dropdown-trigger .dd-chev  { margin-left: 2px; color: var(--muted); }
.icon-btn {
  width: 28px; height: 26px;
  border: 1px solid var(--border);
  background: white;
  border-radius: 999px;
  cursor: pointer; color: var(--muted);
  display: inline-flex; align-items: center; justify-content: center;
  transition: border-color 0.12s, color 0.12s;
  padding: 0; font-family: inherit;
}
.icon-btn:hover { border-color: var(--navy); color: var(--navy); }

/* ── STICKY TABLE HEADERS (standard 2026-06-10) ─────────────────────────
   Table headers must survive scrolling: stick them at the BOTTOM of the
   fixed chrome (cover 56 + tab-strip 48 = 104px), NEVER at top:0 — the
   chrome (z:49-51) paints over a 0-offset header so it "disappears".
   Sticky also silently fails inside scroll containers: no overflow:hidden/
   auto on any ancestor between the table and the page (use overflow:clip
   for border-radius clipping; gate overflow-x:auto wrappers to <=900px,
   trading sticky for horizontal pan there). Apply via .sticky-thead on the
   <table>; dashboards with a fixed KPI strip use .tbl-head-row (top:200px)
   instead. */
.sticky-thead thead th {
  position: sticky;
  top: calc(104px + env(safe-area-inset-top, 0px));
  z-index: 5;
}

/* ── KPI STRIP (8-cell summary row) ─────────────────────────────────── */
.kpi-strip {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 8px;
  margin: 0;
  /* FIXED right below the tab-strip. Full width, same as cover/tab-strip. */
  position: fixed;
  top: 104px; left: 0;
  width: 100%; max-width: none;
  z-index: 49;
  background: white;
  padding: 8px 36px;
}
.kpi {
  border-radius: 5px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  background: white;
  min-height: 0;
  text-align: left;
}
.kpi .num {
  font-size: 18px; font-weight: 700; line-height: 1.15;
  color: var(--navy); font-variant-numeric: tabular-nums; white-space: nowrap;
}
.kpi .num .sep { color: var(--muted); font-weight: 400; margin: 0 4px; }
.kpi .num .qty { font-size: 14px; font-weight: 600; color: var(--muted); }
.kpi .lbl {
  font-size: 10px; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.5px;
  margin-top: 6px; font-weight: 700; white-space: nowrap;
}
.kpi.selected { border-color: var(--navy); box-shadow: 0 0 0 2px var(--navy); }
.kpi.unconfirmed .num { color: var(--warn); }
.kpi.collected   .num { color: var(--good); }
.kpi.outstanding .num { color: #a06800; }
.kpi.overdue     .num { color: var(--bad); }
.kpi.draft-overdue .num { color: #c2410c; }
.kpi.recon       .num { color: var(--bad); }

/* ── KPIs are the canonical filter affordance ───────────────────────
   Clicking a KPI cell sets the active filter for the dashboard.
   The previous .show-bar / .chip pattern is REMOVED in favor of this —
   one less row of chrome, no duplicate "Confirmed" affordances.
   If a dashboard needs filters beyond what fits in the KPI strip,
   add them as dropdowns in .tab-strip-filters. ─────────────────────── */

/* ── GLOSSARY (Definitions block) ───────────────────────────────────── */
.glossary {
  padding: 10px 14px;
  background: white;
  border: 1px solid var(--border);
  border-radius: 4px;
  margin-bottom: 16px;
}
.glossary-title {
  font-size: 9px; font-weight: 700;
  color: var(--muted); text-transform: uppercase;
  letter-spacing: 0.5px; margin-bottom: 6px;
}
.glossary-grid {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 4px 16px;
  font-size: 10.5px; color: var(--muted); line-height: 1.5;
}
.glossary-grid div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.glossary-grid dt  { display: inline; font-weight: 700; color: var(--navy); }
.glossary-grid dd  { display: inline; margin: 0; color: var(--muted); }

/* ── FOOTER ─────────────────────────────────────────────────────────── */
.footer {
  margin-top: 36px; padding: 14px 0;
  border-top: 1px solid var(--border);
  font-size: 11px; color: var(--muted); text-align: left;
}

/* ── COMMON UTILITIES (loading, error, toast) ───────────────────────── */
#loading { padding: 40px 20px; text-align: center; color: var(--muted); font-size: 13px; }
#loading .spin {
  display: inline-block; width: 14px; height: 14px;
  border: 2px solid var(--border); border-top-color: var(--navy);
  border-radius: 50%; animation: pcd-spin 1s linear infinite;
  margin-right: 8px; vertical-align: middle;
}
@keyframes pcd-spin { to { transform: rotate(360deg); } }
#err {
  padding: 12px 40px 12px 14px; margin: 0 0 14px;
  background: var(--bad-bg); border: 1px solid #fecaca; color: #991b1b;
  border-radius: 6px; font-size: 12px; white-space: pre-wrap; position: relative;
}
#err .err-close {
  position: absolute; top: 8px; right: 10px; cursor: pointer;
  font-size: 18px; line-height: 1; color: #991b1b; padding: 0 6px;
  font-weight: 700; user-select: none;
}
#err .err-close:hover { color: #7f1d1d; }
#toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: var(--navy); color: white; padding: 12px 20px; border-radius: 10px;
  font-size: 12px; box-shadow: 0 8px 24px rgba(0,0,0,.25);
  z-index: 1000; opacity: 0; transition: opacity .2s, transform .2s;
  pointer-events: auto; max-width: 520px;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(-4px); }
#toast .msg { font-weight: 600; margin-bottom: 6px; }
#toast .url {
  font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 11px;
  background: rgba(255,255,255,0.1); padding: 6px 8px; border-radius: 5px;
  user-select: all; word-break: break-all;
}
#toast .url a { color: #93c5fd; text-decoration: underline; }
#toast .close { float: right; cursor: pointer; opacity: 0.6; margin-left: 12px; }
#toast .close:hover { opacity: 1; }


/* ── BURGER MENU (cover-left) — opens a panel listing all dashboards ── */
/* Burger lives in .tab-strip-filters on a white background. Sized to
   match the .icon-btn cog so the row reads as one consistent strip. */
.burger-wrap { position: relative; display: inline-flex; }
.cover-burger {
  width: 28px; height: 26px;
  display: inline-flex; align-items: center; justify-content: center;
  background: white;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  cursor: pointer; padding: 0; font-family: inherit;
  transition: border-color 0.12s, color 0.12s;
}
.cover-burger:hover { border-color: var(--navy); color: var(--navy); }
.cover-burger svg { width: 13px; height: 13px; }

.cover-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 320px;
  background: white;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 12px 32px rgba(15,27,45,0.18);
  padding: 6px;
  z-index: 100;
  display: none;
}
.cover-menu.open { display: block; }
.cover-menu .item {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 12px;
  border-radius: 6px;
  cursor: pointer;
  text-decoration: none;
  color: var(--text);
  transition: background 0.1s;
}
.cover-menu .item:hover { background: var(--cream); }
.cover-menu .item.current { background: var(--cream); cursor: default; }
.cover-menu .item.current::after {
  content: "•"; color: var(--gold); margin-left: auto;
  font-size: 18px; line-height: 1;
}
.cover-menu .item .ico {
  flex: 0 0 36px; width: 36px; height: 36px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--cream); border-radius: 5px;
  border: 1px solid var(--border-soft);
}
.cover-menu .item .ico svg { width: 26px; height: 26px; }
.cover-menu .item .body { flex: 1; min-width: 0; }
.cover-menu .item .title {
  font-size: 13px; font-weight: 600; color: var(--navy); line-height: 1.2;
}
.cover-menu .item .desc {
  font-size: 11px; color: var(--muted); margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cover-menu-empty {
  padding: 14px 12px;
  color: var(--muted); font-size: 12px; text-align: center;
}

/* ── DROPDOWN MENU (used by .dropdown-trigger pills in tab-strip-filters) ── */
.dropdown-filter { position: relative; }
.dropdown-trigger.open { background: var(--cream); border-color: var(--navy); }
.dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  min-width: 220px;
  max-height: 320px;
  overflow-y: auto;
  background: white;
  border: 1px solid var(--border);
  border-radius: 6px;
  box-shadow: 0 8px 22px rgba(15,27,45,0.14);
  padding: 4px;
  z-index: 90;
  display: none;
}
.dropdown-menu.open { display: block; }
.dropdown-menu .opt {
  padding: 6px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  color: var(--text);
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px;
}
.dropdown-menu .opt:hover { background: var(--cream); }
.dropdown-menu .opt.selected { color: var(--navy); font-weight: 600; }
.dropdown-menu .opt.selected::after {
  content: "✓"; color: var(--gold);
}
.dropdown-menu .sep {
  height: 1px; background: var(--border-soft); margin: 4px 0;
}
/* ── Searchable dropdowns (STANDARD) ──────────────────────────────────────
   Any .dropdown-menu whose option list exceeds 10 items should render a filter
   input as its first child (class .dd-search inside .dd-search-wrap). The input
   stays pinned while the option rows scroll; rows are hidden client-side as the
   user types. See catalyst-dashboard-standards skill §"Searchable dropdowns". */
.dropdown-menu .dd-search-wrap {
  position: sticky; top: 0; z-index: 1;
  background: white; padding: 2px 2px 6px; margin: -2px -2px 4px;
  border-bottom: 1px solid var(--border-soft);
}
.dropdown-menu .dd-search {
  width: 100%; box-sizing: border-box;
  font: inherit; font-size: 12px;
  padding: 6px 9px;
  border: 1px solid var(--border); border-radius: 5px;
  color: var(--navy); background: var(--light-bg);
}
.dropdown-menu .dd-search::placeholder { color: var(--muted); }
.dropdown-menu .dd-search:focus { outline: none; border-color: var(--navy); background: #fff; }
.dropdown-menu .dd-empty { padding: 8px 10px; color: var(--muted); font-size: 12px; }

/* (2026-06-10) No body::before gap-mask here: the cover is full-bleed at
   top:0 and opaque, so there is no gap to mask. A leftover mask at a higher
   z-index paints OVER the cover and clips the logo — never reintroduce it. */

/* ──────────────────────────────────────────────────────────────────────
   RESPONSIVE / iPad-optimised overrides
   3 breakpoints, growing more aggressive as viewport shrinks:
     1180px → iPad landscape: bump touch targets to 44pt-ish
     900px  → iPad portrait : 4-col KPI, filters wrap below tabs,
                              switch chrome from "16px-inset" to top:0
     640px  → phone / mini  : 2-col KPI

   Per-dashboard inline <style> blocks ship their own copy of these media
   queries (with !important) — the inline overrides win because <style>
   blocks load after this linked sheet. This shared copy catches any
   future dashboard that forgets to add its own.
   ────────────────────────────────────────────────────────────────────── */

@media (max-width: 1180px) {
  .dropdown-trigger { height: 36px; padding: 8px 14px; font-size: 13px; touch-action: manipulation; }
  .dropdown-trigger .dd-label,
  .dropdown-trigger .dd-value { font-size: 13px; }
  .icon-btn,
  .cover-burger { width: 36px; height: 36px; touch-action: manipulation; }
  .cover-icon-btn { width: 40px; height: 40px; touch-action: manipulation; }
  .cover-icon-btn svg { width: 20px; height: 20px; }
  .cover-back { padding: 8px 14px; font-size: 12px; touch-action: manipulation; }
  .tab-strip .tab { padding: 12px 18px; font-size: 13px; min-height: 44px; touch-action: manipulation; }
  .dropdown-menu .opt { padding: 12px 14px; font-size: 14px; min-height: 44px; }
  .dropdown-menu .dd-search { font-size: 16px; padding: 9px 11px; }  /* 16px = no iOS zoom-on-focus */
  .cover-menu .item { padding: 14px 12px; min-height: 56px; }
}

@media (max-width: 900px) {
  /* Cover hugs the top edge — drop the 16px inset so we reclaim space */
  .cover { top: 0 !important; padding: 10px 16px !important; }
  .cover-inner { gap: 10px; max-width: 100%; }
  .cover-title { display: none; }  /* logo carries the brand */
  .cover-logo { height: 28px; }
  .cover-status { gap: 6px; font-size: 11px; }

  /* Tab strip wraps: tabs on row 1, filter pills on row 2 */
  .tab-strip {
    top: 50px !important;
    flex-wrap: wrap;
    padding: 4px 16px !important;
    gap: 4px;
  }
  .tab-strip-tabs { order: 0; }
  .tab-strip-filters {
    order: 1; width: 100%;
    overflow-x: auto; overflow-y: visible;
    flex-wrap: nowrap;
    padding-bottom: 8px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .tab-strip-filters::-webkit-scrollbar { display: none; }

  /* KPI: 4 columns × 2 rows (still readable at iPad portrait) */
  .kpi-strip {
    grid-template-columns: repeat(4, 1fr) !important;
    top: 152px !important;
    padding: 6px 16px !important;
    gap: 6px;
  }
  .kpi { padding: 8px 10px; }
  .kpi .num { font-size: 15px; }
  .kpi .num .qty { font-size: 12px; }
  .kpi .lbl { font-size: 9px; margin-top: 4px; }

  /* Container reserves space for cover(48) + tabs(40) + filters(44) + 2-row KPI(100) ≈ 240 */
  .container { padding: 240px 16px 24px !important; max-width: 100%; }
  .tbl-head-row { top: 240px !important; }
}

@media (max-width: 640px) {
  .kpi-strip { grid-template-columns: repeat(2, 1fr) !important; }
  .container { padding-top: 360px !important; }
  .tbl-head-row { top: 360px !important; }
  .cover-icon-btn { width: 44px; height: 44px; }
}

/* iOS PWA safe-area insets — when add-to-home-screen runs the dashboard
   fullscreen with apple-mobile-web-app-status-bar-style:black-translucent,
   env(safe-area-inset-top) returns the status-bar height (~20–40px). The
   cover grows by that amount via padding-top — so we MUST also push the
   tab-strip / kpi-strip / container down by the same amount, otherwise
   the tab-strip overlaps the cover's bottom edge.
   This shift is unconditional (not gated on a breakpoint) because PWA mode
   reports a non-zero inset at all iPad widths, not just <900px.
   CAUTION: desktop browsers ALSO match this @supports test (env() = 0), so
   the constants below apply everywhere and MUST equal the base geometry
   (tab-strip 56 / kpi-strip 104) — stale copies of the old 72/120 inset
   values open a visible gap between the cover and the tab-strip. */
@supports (padding-top: env(safe-area-inset-top)) {
  .cover { padding-top: max(11px, env(safe-area-inset-top)) !important; }
  /* Desktop-default chrome stack — shift each fixed element by inset */
  .tab-strip { top: calc(56px + env(safe-area-inset-top)) !important; }
  .kpi-strip { top: calc(104px + env(safe-area-inset-top)) !important; }
  .container { padding-top: calc(196px + env(safe-area-inset-top)) !important; }
  .tbl-head-row { top: calc(200px + env(safe-area-inset-top)) !important; }
  /* iPad portrait — chrome stack uses different fixed tops; override above */
  @media (max-width: 900px) {
    .tab-strip { top: calc(50px + env(safe-area-inset-top)) !important; }
    .kpi-strip { top: calc(152px + env(safe-area-inset-top)) !important; }
    .container { padding-top: calc(240px + env(safe-area-inset-top)) !important; }
    .tbl-head-row { top: calc(240px + env(safe-area-inset-top)) !important; }
  }
}
