/* Crosscut Hub — Partners (v0.51): the frame (Settings' sidebar / drill-down, see hub-settings.css), the dashboard, the
   category pages and Referrals. Markup: hub-partners.js. Colours are theme tokens, so light and dark both work.
   Chart colours (validated for colour-blind separation and contrast on both surfaces): --pd-c1 blue = we reached out,
   --pd-c3 teal = they came back, --pd-c2 orange = referrals and money. */
:root { --pd-c1: #3A6EA5; --pd-c2: #D27A00; --pd-c3: #16967A; --pd-axis: #c9c4bb; }
:root[data-theme="dark"] { --pd-c1: #3987E5; --pd-c2: #D2711C; --pd-c3: #199E70; --pd-axis: #45413c; }

/* ---- frame ---- */
.pt { grid-template-columns: 264px minmax(0, 1fr); }
.pt .st-page { padding-left: 32px; }
.pt .st-inner { max-width: 1180px; }
.pt-side .st-gh { display: flex; align-items: center; gap: 7px; }
.pt-stn { width: 18px; height: 18px; border-radius: 50%; background: var(--fill-2, var(--fill)); color: var(--ink); font-size: 10.5px; font-weight: 700; display: grid; place-items: center; flex: none; }
.pt-tier { width: 22px; height: 20px; border-radius: 6px; display: inline-grid; vertical-align: -4px; place-items: center; flex: none; font: 700 11px/1 var(--text); letter-spacing: 0; }
.pt-tier.tA { background: var(--orange); color: #231f1a; }
.pt-tier.tB { background: var(--fill-2, #e8e4dc); color: var(--charcoal); }
.pt-tier.tC { background: transparent; color: var(--muted); box-shadow: inset 0 0 0 1px var(--line); }
.pt-tier.t0 { background: transparent; color: var(--muted); }
.pt-n { flex: none; font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.pt-call { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; background: var(--paper); box-shadow: var(--shadow); text-decoration: none; color: inherit; margin-bottom: 4px; }
.pt-call.on { box-shadow: inset 0 0 0 2px var(--orange), var(--shadow); }
.pt-call b { display: block; font-size: 15px; color: var(--charcoal); }
.pt-call small { display: block; font-size: 12.5px; color: var(--muted); }
.pt-call > svg { color: var(--muted); flex: none; }
.pt-callic { width: 36px; height: 36px; border-radius: 10px; background: var(--orange); color: #231f1a; display: grid; place-items: center; flex: none; }
.pt-hits .st-nav-g { gap: 1px; }
.pt-more { margin: 12px 8px 0; padding: 6px 2px; border: 0; background: none; color: var(--orange-2); font: 600 13px var(--text); text-align: left; cursor: pointer; }
.pt-more:hover { text-decoration: underline; }
.pt-phoneback { display: none !important; }

/* app.js pages (call session, partner page, the full list) drawn inside the frame */
.pt-legacy { max-width: none !important; gap: 0 !important; display: block !important; }
.pt-legacy > .toolbar:first-child, .pt-list .toolbar { margin-top: 0; }
.pt-sfilter { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 0 0 14px; }
.pt-sfilter select { max-width: 260px; }
.why.pt-step { border-left: 3px solid var(--orange); padding-left: 10px; }
.why.pt-comp { background: color-mix(in srgb, var(--orange) 10%, transparent); border-radius: 8px; padding: 8px 10px; }

/* ---- dashboard ---- */
.pd-filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.pd-sel { max-width: 280px; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--paper); color: var(--ink); font: 500 13.5px var(--text); }
.pd-body { display: flex; flex-direction: column; gap: 16px; transition: opacity .2s; }
.pd-loading { opacity: .5; pointer-events: none; }
.pd-range { margin: -4px 0 -4px; font-size: 13px; color: var(--muted); }
.pd-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.pd-tiles.sm { grid-template-columns: repeat(auto-fit, minmax(124px, 1fr)); }
.pd-tile { display: flex; flex-direction: column; gap: 2px; padding: 14px 16px 12px; border-radius: 14px; background: var(--paper); box-shadow: var(--shadow); color: inherit; text-decoration: none; min-width: 0; }
a.pd-tile:hover { box-shadow: var(--shadow-hi, var(--shadow)); }
.pd-tl { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.pd-tv { font-size: 30px; font-weight: 700; letter-spacing: -.03em; color: var(--charcoal); line-height: 1.15; }
.pd-tiles.sm .pd-tv { font-size: 24px; }
.pd-ts { font-size: 12.5px; color: var(--muted); line-height: 1.4; text-wrap: pretty; }
.pd-delta { display: inline-flex; align-items: center; gap: 3px; font-size: 12px; font-weight: 600; color: var(--muted); }
.pd-delta.up { color: var(--green); } .pd-delta.down { color: var(--red); }
.pd-spark { display: block; width: 100%; height: 28px; margin-top: 8px; overflow: visible; }
.pd-warn { color: var(--orange-2); font-weight: 600; }
.pd-ok { color: var(--green); font-weight: 600; }
.pd-muted { color: var(--muted); }

.pd-card { background: var(--paper); border-radius: 14px; box-shadow: var(--shadow); padding: 18px 18px 16px; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.pd-card h2 { margin: 0; font-size: 17px; font-weight: 700; letter-spacing: -.01em; color: var(--charcoal); }
.pd-card h2 small, .pd-ch small { font-size: 12.5px; font-weight: 500; color: var(--muted); margin-left: 4px; }
.pd-ch { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.pd-h3 { margin: 6px 0 0; font-size: 13px; font-weight: 650; color: var(--charcoal); }
.pd-foot { margin: 0; font-size: 12.5px; line-height: 1.45; color: var(--muted); text-wrap: pretty; }
.pd-foot a { color: var(--orange-2); }
.pd-empty { margin: 0; padding: 10px 0; font-size: 13.5px; color: var(--muted); }
.pd-hint { font-size: 12.5px; color: var(--muted); }
.pd-tog { display: inline-flex; align-items: center; gap: 6px; }
.pd-two { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }

/* needs attention */
.pd-att { gap: 6px; }
.pd-attl { display: flex; flex-direction: column; }
.pd-attr { display: flex; align-items: flex-start; gap: 12px; padding: 10px 6px; border-top: 1px solid var(--line); color: inherit; text-decoration: none; border-radius: 8px; }
.pd-attr:first-child { border-top: 0; }
.pd-attr:hover { background: var(--fill); }
.pd-attic { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; flex: none; background: color-mix(in srgb, var(--orange) 15%, transparent); color: var(--orange-2); }
.pd-attr.setup .pd-attic { background: var(--fill); color: var(--muted); }
.pd-attx { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.pd-attx b { font-size: 14.5px; font-weight: 600; color: var(--charcoal); }
.pd-attx span { font-size: 13px; line-height: 1.4; color: var(--muted); text-wrap: pretty; }
.pd-attgo { flex: none; display: inline-flex; align-items: center; gap: 2px; font-size: 13px; font-weight: 600; color: var(--orange-2); margin-top: 6px; white-space: nowrap; }

/* small multiples */
.pd-multi { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px 22px; }
.pd-panel { min-width: 0; }
.pd-ph { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
.pd-ph h3 { margin: 0; font-size: 13.5px; font-weight: 650; color: var(--charcoal); }
.pd-ph small { font-size: 12px; color: var(--muted); }
.pd-chart { height: 132px; }
.pd-chart svg { display: block; }
.pd-legend { display: inline-flex; gap: 12px; font-size: 12px; color: var(--muted); }
.pd-legend span { display: inline-flex; align-items: center; gap: 5px; }
.pd-legend i { width: 10px; height: 10px; border-radius: 3px; }
.pd-grid { stroke: var(--line); stroke-width: 1; }
.pd-axis { stroke: var(--pd-axis); stroke-width: 1; }
.pd-tick { fill: var(--muted); font: 500 10.5px var(--text); font-variant-numeric: tabular-nums; }
.pd-hit { fill: transparent; }
.pd-hit.pd-hov { fill: color-mix(in srgb, var(--charcoal) 6%, transparent); }

/* horizontal bars */
.pd-bars { display: flex; flex-direction: column; gap: 2px; }
.pd-bar { display: grid; grid-template-columns: minmax(96px, 36%) minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 5px 6px; border-radius: 8px; color: inherit; text-decoration: none; outline: none; }
.pd-bar:hover, .pd-bar.pd-hov, .pd-bar:focus-visible { background: var(--fill); }
.pd-bar:focus-visible { box-shadow: var(--focus); }
.pd-bl { min-width: 0; font-size: 13.5px; color: var(--charcoal); display: flex; flex-direction: column; }
.pd-bl small { font-size: 11.5px; color: var(--muted); }
.pd-bt { display: block; min-width: 0; border-left: 1px solid var(--pd-axis); }
.pd-bt i { display: block; height: 12px; border-radius: 0 4px 4px 0; }
.pd-bv { font-size: 13.5px; font-weight: 700; color: var(--charcoal); font-variant-numeric: tabular-nums; text-align: right; display: flex; flex-direction: column; align-items: flex-end; }
.pd-bv small { font-size: 11.5px; font-weight: 500; color: var(--muted); white-space: nowrap; }
.pd-rate { display: grid; grid-template-columns: minmax(40px, 1fr) auto; align-items: center; gap: 8px; min-width: 110px; }
.pd-rate .pd-bt i { height: 8px; }

/* tables */
.pd-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.pd-table th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); padding: 6px 8px 8px; white-space: nowrap; }
.pd-table td { padding: 9px 8px; border-top: 1px solid var(--line); vertical-align: top; color: var(--ink); font-variant-numeric: tabular-nums; }
.pd-table td b { display: block; font-weight: 650; color: var(--charcoal); }
.pd-table td small { display: block; font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.pd-table td a { color: var(--charcoal); text-decoration: none; font-weight: 600; }
.pd-table td a:hover { text-decoration: underline; }
.pd-board tr[data-href] { cursor: pointer; }
.pd-board tr[data-href]:hover td, .pd-board tr[data-href]:focus-visible td { background: var(--fill); }
.pd-board tr[data-href]:focus-visible { outline: none; }
.pd-board .pd-cn { white-space: nowrap; }
.pd-board .pd-cn .pt-tier { display: inline-grid; vertical-align: -5px; margin-right: 8px; }
.pd-board .pd-revc { min-width: 120px; }
.pd-stg th { padding: 14px 10px 6px; font-size: 12px; font-weight: 650; color: var(--charcoal); border-top: 1px solid var(--line); }
.pd-stg:first-child th { border-top: 0; }
.pd-stg .pt-stn { display: inline-grid; margin-right: 6px; vertical-align: -4px; }
.pd-sort { border: 0; background: none; padding: 0; font: inherit; color: inherit; cursor: pointer; }
.pd-sort:hover, .pd-sort.on { color: var(--charcoal); text-decoration: underline; text-underline-offset: 3px; }
.pd-sort.lnk { color: var(--orange-2); font-weight: 600; }
.pd-steps td { vertical-align: middle; }
.pd-acts { white-space: nowrap; text-align: right; }
.pd-acts .btn + .btn { margin-left: 6px; }
.pd-av { display: inline-grid; width: 24px; height: 24px; font-size: 10.5px; margin-right: 8px; vertical-align: -6px; place-items: center; }

/* lists */
.pd-list { list-style: none; margin: 0; padding: 0; }
.pd-list li { display: flex; align-items: center; gap: 12px; padding: 9px 0; border-top: 1px solid var(--line); }
.pd-list li:first-child { border-top: 0; }
.pd-list li > span:not(.pd-rank) { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.pd-list b { font-size: 14px; font-weight: 600; color: var(--charcoal); }
.pd-list a { text-decoration: none; }
.pd-list small { font-size: 12.5px; color: var(--muted); }
.pd-rank { width: 24px; height: 24px; border-radius: 50%; background: var(--fill); color: var(--ink); font-size: 12px; font-weight: 700; display: grid; place-items: center; flex: none; }
.pd-lv { font-size: 14px; font-weight: 700; color: var(--charcoal); font-variant-numeric: tabular-nums; }

/* partner line + referrals */
.pd-linestats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.pd-linestats div { display: flex; flex-direction: column; }
.pd-linestats b { font-size: 24px; font-weight: 700; color: var(--charcoal); letter-spacing: -.02em; }
.pd-linestats span { font-size: 12px; color: var(--muted); }
.pd-setup p { margin: 0 0 8px; font-size: 14px; line-height: 1.5; color: var(--ink); }
.pd-setup ol { margin: 0 0 12px; padding-left: 20px; font-size: 13.5px; line-height: 1.6; color: var(--ink); }
.pd-speed { margin: 0; display: flex; gap: 8px; align-items: flex-start; font-size: 14px; color: var(--ink); line-height: 1.45; }
.pd-speed svg { color: var(--muted); flex: none; margin-top: 2px; }
.pd-speed b { color: var(--charcoal); }

/* tooltip (lives on <body>) */
.pd-tip { position: fixed; z-index: 1000; min-width: 120px; max-width: 280px; padding: 8px 10px; border-radius: 10px; background: var(--paper); box-shadow: var(--shadow-hi, var(--shadow)); pointer-events: none; font-size: 12.5px; color: var(--ink); display: flex; flex-direction: column; gap: 3px; }
.pd-tip[hidden] { display: none; }
.pd-tip-t { font-weight: 600; color: var(--muted); font-size: 12px; }
.pd-tip-r { display: flex; align-items: center; gap: 7px; }
.pd-tip-r i { width: 12px; height: 3px; border-radius: 2px; flex: none; }
.pd-tip-r i.none { background: transparent; }
.pd-tip-r b { color: var(--charcoal); font-variant-numeric: tabular-nums; }
.pd-tip-r span { color: var(--muted); }

/* ---- a category ---- */
.pt-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.pt-chip { display: inline-flex; align-items: center; gap: 7px; padding: 4px 11px; border-radius: 999px; background: var(--fill); font-size: 12.5px; font-weight: 600; color: var(--ink); }
.pt-chip.strong { background: var(--paper); box-shadow: var(--shadow); color: var(--charcoal); padding-left: 4px; }
.pt-chip.off { background: transparent; box-shadow: inset 0 0 0 1px var(--line); color: var(--muted); }
.pt-gh { display: flex; align-items: center; justify-content: space-between; padding: 0 0 0 16px; }
.pt-gh h3 { font-family: var(--text); text-transform: none; letter-spacing: .01em; font-size: 12.5px; font-weight: 600; color: var(--muted); margin: 0; }
.pt-gh .btn { display: inline-flex; align-items: center; gap: 6px; }
.pt-prow { align-items: flex-start; padding-top: 12px; padding-bottom: 12px; }
.pt-prow .st-l { flex: 0 0 170px; color: var(--muted); font-size: 13.5px; }
.pt-pv { flex: 1; min-width: 0; font-size: 14.5px; line-height: 1.5; color: var(--charcoal); text-wrap: pretty; }
.pt-score { display: grid; grid-template-columns: repeat(4, minmax(0, auto)); justify-content: start; gap: 6px 22px; }
.pt-score div { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink); }
.pt-score b { font-variant-numeric: tabular-nums; color: var(--charcoal); }
.pt-pips { display: inline-flex; gap: 3px; }
.pt-pips i { width: 8px; height: 8px; border-radius: 50%; background: var(--fill-2, var(--line)); }
.pt-pips i.on { background: var(--orange); }
.pt-steps { list-style: none; margin: 4px 0 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.pt-steps li { display: grid; grid-template-columns: 52px 150px minmax(0, 1fr); gap: 10px; align-items: baseline; font-size: 14px; line-height: 1.45; color: var(--charcoal); }
.pt-day { font-size: 12px; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.pt-kind { justify-self: start; padding: 1px 8px; border-radius: 999px; background: var(--fill); font-size: 12px; font-weight: 600; color: var(--ink); white-space: nowrap; }
.pt-kind.k-text { background: color-mix(in srgb, var(--orange) 15%, transparent); color: var(--orange-2); }
.pt-list { margin-top: 4px; }
.pt-form { display: flex; flex-direction: column; gap: 22px; }
.pt-srow { display: grid; grid-template-columns: 64px 180px minmax(0, 1fr) 36px; gap: 8px; align-items: center; }
.pt-srow input, .pt-srow select { min-width: 0; padding: 7px 9px; font-size: 14px; }
#ptSteps { gap: 8px; }
#ptSteps > .btn { align-self: flex-start; display: inline-flex; align-items: center; gap: 6px; }
.pt-formbar { position: sticky; bottom: 12px; z-index: 5; display: flex; justify-content: flex-end; gap: 8px; padding: 10px; border-radius: 12px; background: var(--paper); box-shadow: var(--shadow-hi, var(--shadow)); }

@media (max-width: 1180px) { .pd-two { grid-template-columns: minmax(0, 1fr); } }

/* ---- phone: the list, then one page at a time (hub-settings.css does the frame) ---- */
@media (max-width: 899px) {
  .pt .st-page { padding-left: 0; }
  .pt-side .st-groups { display: flex; flex-direction: column; gap: 18px; }
  .pt-phoneback { display: inline-flex !important; }
  .pt-call { min-height: 64px; }
  .pt-callic { width: 40px; height: 40px; }
  .pt-n { font-size: 15px; }
  .pt-side .st-item .pt-tier { width: 24px; height: 22px; }
  .pd-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .pd-tile { padding: 12px 12px 10px; }
  .pd-tv { font-size: 24px; }
  .pd-multi { grid-template-columns: minmax(0, 1fr); }
  .pd-card { padding: 16px 14px 14px; }
  .pd-filters .st-segw { display: flex; width: 100%; }
  .pd-filters .st-segw label { flex: 1; }
  .pd-filters .st-segw span { text-align: center; padding: 8px 2px; font-size: 13px; }
  .pd-sel { max-width: none; width: 100%; font-size: 16px; }
  .pd-linestats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pd-attgo { display: none; }
  /* the category table becomes one card per category */
  .pd-board thead { display: none; }
  .pd-board, .pd-board tbody { display: block; }
  .pd-board tr { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px 10px; padding: 12px 4px; border-top: 1px solid var(--line); }
  .pd-board tr.pd-stg { display: block; padding: 14px 4px 2px; }
  .pd-board tr.pd-stg th { display: block; padding: 0; border: 0; }
  .pd-board td { padding: 0; border: 0; }
  .pd-board td::before { content: attr(data-l); display: block; font-size: 11px; font-weight: 600; color: var(--muted); }
  .pd-board td.pd-cn { grid-column: 1 / -1; font-size: 15px; }
  .pd-board td.pd-cn::before { display: none; }
  .pd-board td.pd-revc { grid-column: span 2; min-width: 0; }
  .pd-refs thead { display: none; }
  .pd-refs, .pd-refs tbody { display: block; }
  .pd-refs tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; padding: 12px 2px; border-top: 1px solid var(--line); }
  .pd-refs td { padding: 0; border: 0; }
  .pd-refs td.pd-acts { grid-column: 1 / -1; text-align: left; }
  .pt-prow { flex-direction: column; gap: 4px; }
  .pt-prow .st-l { flex: none; }
  .pt-score { grid-template-columns: repeat(2, minmax(0, auto)); }
  .pt-steps li { grid-template-columns: 46px minmax(0, 1fr); }
  .pt-steps li > span:last-child { grid-column: 1 / -1; }
  .pt-srow { grid-template-columns: 56px minmax(0, 1fr) 36px; }
  .pt-srow [data-s=say] { grid-column: 1 / 3; }
  .pt-sfilter .st-segw { display: flex; width: 100%; }
  .pt-sfilter .st-segw label { flex: 1; }
  .pt-sfilter .st-segw span { text-align: center; padding: 8px 2px; font-size: 13px; }
  .pt-sfilter select { max-width: none; width: 100%; }
}
