/* TRP Pulse — phone linen chrome (Overview + bottom bar)
   Tokens match the /mobile scoreboard and Collections work-run.
   Desktop (≥769px) is untouched. Collections work-run still owns its own shell. */
@media (max-width: 768px) {
  :root {
    --ph-bg: #f3f0e8;
    --ph-surface: #fffcf6;
    --ph-raised: #ece8de;
    --ph-ink: #2c2a26;
    --ph-muted: #6a655c;
    --ph-subtle: #8f8a80;
    --ph-accent: #3d5348;
    --ph-accent-fg: #f7f4ee;
    --ph-border: rgba(44, 42, 38, 0.10);
    --ph-ok: #4a7a64;
    --ph-warn: #9a7d4e;
    --ph-danger: #9a6e66;
    --ph-serif: ui-serif, Georgia, "Times New Roman", serif;
    --ph-sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  }

  html, body {
    background: var(--ph-bg) !important;
    color: var(--ph-ink);
  }

  /* ---- Header: less empty cream, keep the menu ---- */
  html header {
    background: var(--ph-bg) !important;
    border-bottom: 1px solid var(--ph-border) !important;
    box-shadow: none !important;
    padding: calc(6px + env(safe-area-inset-top, 0px)) 12px 8px !important;
  }
  html header .header-title { color: var(--ph-ink) !important; }
  html header .hamburger-btn {
    background: var(--ph-ink) !important;
    border-radius: 12px !important;
    width: 40px !important;
    height: 40px !important;
  }
  html header .hamburger-btn .tlb-stroke { stroke: var(--ph-accent-fg) !important; }

  /* ---- Overview: editorial paper ---- */
  #overview-dashboard {
    background: var(--ph-bg) !important;
    padding: 4px 14px calc(28px + env(safe-area-inset-bottom, 0px)) !important;
    max-width: 430px;
    margin: 0 auto !important;
  }
  #overview-dashboard .trp-page-h1 {
    margin: 10px 2px 14px !important;
  }
  #overview-dashboard .trp-page-h1 h1 {
    font-family: var(--ph-serif) !important;
    font-size: 26px !important;
    font-weight: 500 !important;
    letter-spacing: -0.03em !important;
    color: var(--ph-ink) !important;
    line-height: 1.15 !important;
  }

  /* Weekly Operating Review — navy hero on paper, chips as linen cards */
  #worPanel {
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    margin: 0 0 14px !important;
    border-radius: 0 !important;
  }
  #worPanel .wor-hd {
    background: #24352e !important;
    color: var(--ph-accent-fg) !important;
    border-radius: 16px 16px 0 0;
    padding: 16px 16px 14px !important;
  }
  #worPanel .wor-hd h2 {
    font-family: var(--ph-serif) !important;
    font-weight: 500 !important;
    font-size: 18px !important;
    letter-spacing: -0.02em !important;
    line-height: 1.25 !important;
  }
  #worPanel .wor-hd .wor-head-line {
    color: rgba(247, 244, 238, 0.82) !important;
    font-size: 13px !important;
    line-height: 1.45 !important;
  }
  #worPanel .wor-meta,
  #worPanel .wor-refresh { color: rgba(247, 244, 238, 0.62) !important; }
  #worPanel .wor-dot { background: var(--ph-ok) !important; }
  #worPanel .wor-body {
    background: var(--ph-surface) !important;
    border: 1px solid var(--ph-border);
    border-top: 0;
    border-radius: 0 0 16px 16px;
    padding: 12px 12px 14px !important;
  }
  #worPanel .wor-score { gap: 8px !important; margin-bottom: 10px !important; }
  #worPanel .wor-chip {
    background: var(--ph-bg) !important;
    border: 1px solid var(--ph-border) !important;
    border-radius: 14px !important;
    padding: 12px 12px 10px !important;
    min-width: calc(50% - 6px) !important;
    box-shadow: 0 1px 2px rgba(44, 42, 38, 0.04);
  }
  #worPanel .wor-chip .l {
    color: var(--ph-subtle) !important;
    font-size: 10px !important;
    letter-spacing: 0.08em !important;
    font-weight: 600 !important;
  }
  #worPanel .wor-chip .v {
    font-family: var(--ph-serif) !important;
    font-weight: 500 !important;
    font-size: 26px !important;
    color: var(--ph-ink) !important;
    letter-spacing: -0.03em !important;
  }
  #worPanel .up { color: var(--ph-ok) !important; }
  #worPanel .down { color: var(--ph-danger) !important; }
  #worPanel .flat { color: var(--ph-muted) !important; }
  #worPanel .wor-tabs {
    gap: 6px !important;
    margin: 4px 0 12px !important;
    flex-wrap: nowrap !important;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  #worPanel .wor-tab {
    min-height: 40px;
    padding: 0 14px !important;
    border-radius: 999px !important;
    border: 1px solid var(--ph-border) !important;
    background: var(--ph-surface) !important;
    color: var(--ph-muted) !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    white-space: nowrap;
  }
  #worPanel .wor-tab.active {
    background: var(--ph-accent) !important;
    color: var(--ph-accent-fg) !important;
    border-color: var(--ph-accent) !important;
  }
  #worPanel table.wor-t th { color: var(--ph-subtle) !important; }
  #worPanel table.wor-t td { color: var(--ph-ink) !important; }

  /* Legacy snapshot tiles, if they still paint under the review */
  #overview-dashboard .ov-kpi-tile {
    background: var(--ph-surface) !important;
    border: 1px solid var(--ph-border) !important;
    border-radius: 16px !important;
    box-shadow: 0 1px 2px rgba(44, 42, 38, 0.04) !important;
    padding: 14px 14px 12px !important;
  }
  #overview-dashboard .ov-kpi-tile::before { background: var(--ph-accent) !important; width: 3px !important; }
  #overview-dashboard .ov-kpi-label { color: var(--ph-subtle) !important; }
  #overview-dashboard .ov-kpi-value {
    font-family: var(--ph-serif) !important;
    font-weight: 500 !important;
    color: var(--ph-ink) !important;
    font-size: 28px !important;
  }

  /* Pattern Review + Ask Pulse: off the page — live in More */
  #oprFab,
  #askPulseFab,
  #askPulsePanel { display: none !important; }

  /* Admin chrome does not belong on a phone scoreboard */
  #roleBannerStrip,
  #pageHeaderStrip,
  #dashboardTabs,
  .top-subtabs,
  #revenueSubtabsBar,
  #opsSubtabsBar { display: none !important; }

  /* One compact top row: menu only */
  html header {
    position: sticky !important;
    top: 0 !important;
    z-index: 40 !important;
    min-height: 0 !important;
    height: auto !important;
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 10px !important;
  }
  html header .header-center-group,
  html header .header-right-group,
  html header .header-title,
  html header .header-search,
  html header #globalSourceToggle { display: none !important; }

  #overview-dashboard {
    padding-top: 2px !important;
    padding-bottom: calc(88px + env(safe-area-inset-bottom, 0px)) !important;
  }
  #overview-dashboard .trp-page-h1 { margin: 4px 2px 12px !important; }
  #overview-dashboard .trp-page-h1 h1 { font-size: 24px !important; }

  /* WOR hero: stack, don't wrap the title into a tower */
  #worPanel .wor-hd {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 8px !important;
    padding: 14px 14px 12px !important;
  }
  #worPanel .wor-hd h2 {
    display: block !important;
    font-size: 17px !important;
    line-height: 1.2 !important;
    font-weight: 600 !important;
  }
  #worPanel .wor-hd .wor-head-line {
    font-size: 13px !important;
    line-height: 1.45 !important;
    max-width: none !important;
  }
  #worPanel .wor-refresh { white-space: nowrap !important; align-self: flex-start !important; }

  /* KPI chips: always two columns, no leftover single */
  #worPanel .wor-score {
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 8px !important;
  }
  #worPanel .wor-chip {
    min-width: 0 !important;
    width: auto !important;
  }
  #worPanel .wor-chip .v { font-size: 22px !important; }

  /* Pills wrap instead of sliding under a FAB */
  #worPanel .wor-tabs {
    flex-wrap: wrap !important;
    overflow: visible !important;
    margin: 8px 0 10px !important;
  }

  /* Week table: Metric / this / prior only — MTD/YTD live in Month */
  #worPanel table.wor-t {
    font-size: 12px !important;
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  #worPanel table.wor-t th:nth-child(n+4),
  #worPanel table.wor-t td:nth-child(n+4) { display: none !important; }
  #worPanel table.wor-t th,
  #worPanel table.wor-t td { padding: 8px 6px !important; }

  #worPanel .wor-two { grid-template-columns: 1fr !important; }
  #worPanel .wor-cards { grid-template-columns: 1fr 1fr !important; }

  /* ---- Bottom bar: four equal linen tabs, no raw ids, no scroll soup ---- */
  #trpMobileNav {
    display: flex !important;
    position: fixed !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    z-index: 99990 !important;
    background: rgba(255, 252, 246, 0.96) !important;
    border-top: 1px solid var(--ph-border) !important;
    box-shadow: 0 -8px 24px rgba(44, 42, 38, 0.05) !important;
    overflow: hidden !important;
    justify-content: space-around !important;
    align-items: stretch !important;
    gap: 0 !important;
    padding: 4px 6px max(8px, env(safe-area-inset-bottom)) !important;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
  }
  #trpMobileNav .mnav-btn {
    flex: 1 1 0 !important;
    min-width: 0 !important;
    min-height: 52px !important;
    max-width: none !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 3px !important;
    background: none !important;
    border: 0 !important;
    color: var(--ph-subtle) !important;
    font-family: var(--ph-sans) !important;
    font-size: 10px !important;
    font-weight: 600 !important;
    letter-spacing: 0.02em !important;
    padding: 6px 4px !important;
    white-space: nowrap !important;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  #trpMobileNav .mnav-btn.active { color: var(--ph-accent) !important; }
  #trpMobileNav .mnav-ic {
    width: 22px;
    height: 22px;
    display: grid;
    place-items: center;
    font-size: 0 !important;
    line-height: 0 !important;
  }
  #trpMobileNav .mnav-ic svg {
    width: 22px;
    height: 22px;
    display: block;
  }

  body { padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px)) !important; }

  /* More sheet */
  #phMore {
    position: fixed;
    inset: 0;
    z-index: 100020;
    display: none;
    align-items: flex-end;
    justify-content: center;
    background: rgba(44, 42, 38, 0.4);
  }
  #phMore.on { display: flex; }
  #phMore .ph-sheet {
    width: 100%;
    max-width: 430px;
    background: var(--ph-surface);
    color: var(--ph-ink);
    border-radius: 18px 18px 0 0;
    padding: 8px 16px calc(18px + env(safe-area-inset-bottom, 0px));
    font-family: var(--ph-sans);
    box-shadow: 0 -12px 40px rgba(44, 42, 38, 0.12);
  }
  #phMore .ph-handle {
    width: 36px;
    height: 4px;
    background: var(--ph-raised);
    border-radius: 99px;
    margin: 8px auto 14px;
  }
  #phMore h2 {
    margin: 0 0 4px;
    font-family: var(--ph-serif);
    font-size: 20px;
    font-weight: 500;
    letter-spacing: -0.02em;
  }
  #phMore .ph-sub {
    margin: 0 0 12px;
    font-size: 12px;
    color: var(--ph-muted);
  }
  #phMore button.ph-row {
    width: 100%;
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 0 4px;
    border: 0;
    border-bottom: 1px solid var(--ph-border);
    background: none;
    color: var(--ph-ink);
    font: 600 15px/1.2 var(--ph-sans);
    text-align: left;
    cursor: pointer;
  }
  #phMore button.ph-row:last-of-type { border-bottom: 0; }
  #phMore button.ph-row span { color: var(--ph-subtle); font-size: 12px; font-weight: 500; }
  #phMore .ph-close {
    margin-top: 10px;
    width: 100%;
    min-height: 44px;
    border: 1px solid var(--ph-border);
    background: var(--ph-bg);
    color: var(--ph-muted);
    border-radius: 12px;
    font: 600 14px var(--ph-sans);
  }

  /* Year vs $19M — full-screen linen from More */
  #phYear {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 100030;
    background: var(--ph-bg);
    color: var(--ph-ink);
  }
  #phYear.on { display: block; }
  #phYear .phy-in {
    max-width: 430px;
    margin: 0 auto;
    min-height: 100%;
    padding: calc(8px + env(safe-area-inset-top, 0px)) 16px calc(88px + env(safe-area-inset-bottom, 0px));
    font-family: var(--ph-sans);
  }
  #phYear .phy-top {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 14px;
  }
  #phYear .phy-back {
    flex: none;
    min-height: 40px;
    padding: 0 14px;
    border: 1px solid var(--ph-border);
    background: var(--ph-surface);
    color: var(--ph-ink);
    border-radius: 12px;
    font: 600 14px var(--ph-sans);
  }
  #phYear h2 {
    margin: 2px 0 0;
    font-family: var(--ph-serif);
    font-size: 22px;
    font-weight: 500;
    letter-spacing: -0.03em;
  }
  #phYear .phy-sub, #phYear .phy-asof, #phYear .phy-note, #phYear .phy-hint, #phYear .phy-foot {
    margin: 0;
    font-size: 12px;
    line-height: 1.45;
    color: var(--ph-muted);
  }
  #phYear .phy-asof { margin-bottom: 10px; }
  #phYear h3 {
    margin: 18px 0 6px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ph-subtle);
  }
  #phYear .phy-hero {
    background: var(--ph-surface);
    border: 1px solid var(--ph-border);
    border-radius: 16px;
    padding: 16px 16px 14px;
  }
  #phYear .phy-k { font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--ph-subtle); }
  #phYear .phy-big {
    font-family: var(--ph-serif);
    font-size: 40px;
    font-weight: 500;
    letter-spacing: -0.03em;
    line-height: 1.1;
    margin: 4px 0 8px;
  }
  #phYear .phy-goalrow {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    font-size: 12px;
    font-weight: 600;
    color: var(--ph-muted);
  }
  #phYear .phy-track {
    position: relative;
    height: 8px;
    background: var(--ph-raised);
    border-radius: 99px;
    margin: 12px 0 6px;
    overflow: hidden;
  }
  #phYear .phy-track i {
    display: block;
    height: 100%;
    background: var(--ph-ok);
    border-radius: 99px;
  }
  #phYear .phy-track em {
    position: absolute;
    top: -3px;
    width: 2px;
    height: 14px;
    background: var(--ph-warn);
    border-radius: 2px;
  }
  #phYear .phy-kpis {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-top: 10px;
  }
  #phYear .phy-kpis > div {
    background: var(--ph-surface);
    border: 1px solid var(--ph-border);
    border-radius: 14px;
    padding: 12px;
  }
  #phYear .phy-kpis span { display: block; font-size: 11px; color: var(--ph-subtle); font-weight: 600; }
  #phYear .phy-kpis b { display: block; margin-top: 4px; font-family: var(--ph-serif); font-size: 20px; font-weight: 500; }
  #phYear .phy-kpis b.ok { color: var(--ph-ok); }
  #phYear .phy-kpis b.warn { color: var(--ph-warn); }
  #phYear .phy-kpis b.bad { color: var(--ph-danger); }
  #phYear .phy-mos {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 6px;
    margin-top: 10px;
  }
  #phYear .phy-mo { text-align: center; }
  #phYear .phy-bar {
    height: 68px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    background: var(--ph-raised);
    border-radius: 8px 8px 4px 4px;
    overflow: hidden;
  }
  #phYear .phy-bar i {
    display: block;
    width: 70%;
    background: var(--ph-ok);
    border-radius: 4px 4px 0 0;
  }
  #phYear .phy-mo.on .phy-bar { box-shadow: inset 0 0 0 1px var(--ph-accent); }
  #phYear .phy-mo b { display: block; margin-top: 4px; font-size: 10px; color: var(--ph-subtle); }
  #phYear .phy-mo span { display: block; font-size: 10px; font-weight: 700; }
  #phYear .phy-vint { margin-top: 8px; }
  #phYear .phy-vin {
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 8px 0 10px;
    font-size: 13px;
    border-bottom: 1px solid var(--ph-border);
  }
  #phYear .phy-vin i {
    position: absolute;
    left: 0;
    bottom: 0;
    height: 3px;
    background: var(--ph-accent);
    border-radius: 99px;
    opacity: 0.55;
  }
  #phYear .phy-vin span { color: var(--ph-ink); }
  #phYear .phy-vin b { font-variant-numeric: tabular-nums; }
  #phYear .phy-foot { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--ph-border); }
  #phYear .phy-err { color: var(--ph-danger); font-size: 13px; }
}

/* Work-run owns the viewport — never paint phone chrome over it */
body.trp-coll-run #trpMobileNav,
body.trp-coll-run #phMore,
body.trp-coll-run #phYear,
body.trp-coll-run #oprFab {
  display: none !important;
}
