/* Product of the Weekend (live) — js/views/potw.js.
   Same design family as pva.css / sched_rev.css: portal tokens for every
   mapped color, component-local --potw-* vars on #potwView so nothing leaks. */

#potwView {
  --potw-surface: var(--row-store-bg);
  --potw-band:    var(--table-header-bg);
  --potw-ink:     var(--navy);
  --potw-grid:    var(--table-border);
  --potw-ring:    var(--table-border);
  --potw-ink2: #52616B;
  --potw-mut:  #7C8792;
  --potw-axis: #B7C1CA;
  --potw-good: #2d8540;  --potw-good-ink: #267036;
  --potw-warn: #c98a1d;  --potw-warn-ink: #8A5D0C;
  --potw-bad:  #dc2626;  --potw-bad-ink:  #A3211F;

  display: block;
  color: var(--potw-ink);
  font-family: var(--font-stack);
  font-size: var(--text-body);
  line-height: 1.45;
}
#potwView * { box-sizing: border-box; }

/* ── Title bar ── */
#potwView .potw-h1 {
  background: var(--navy); color: #fff;
  padding: 13px 20px; margin: 0 0 12px;
  font-size: var(--text-heading); font-weight: 600;
  border-radius: var(--radius);
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
#potwView .potw-h1 .potw-window { font-weight: 400; opacity: .8; font-size: var(--text-eyebrow); margin-left: auto; }
#potwView .potw-live {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(255,255,255,.12); border-radius: 12px;
  padding: 2px 10px; font-size: 11px; font-weight: 700; letter-spacing: .8px;
}
#potwView .potw-live i {
  width: 8px; height: 8px; border-radius: 50%;
  background: #58d68d; display: inline-block;
  animation: potwPulse 1.6s ease-in-out infinite;
}
@keyframes potwPulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }

#potwView .potw-how { margin: 0 0 14px 2px; }
#potwView .potw-how > summary {
  font-size: var(--text-eyebrow); color: var(--potw-mut);
  cursor: pointer; display: inline-block; list-style: none;
  padding: 2px 0; user-select: none;
}
#potwView .potw-how > summary::-webkit-details-marker { display: none; }
#potwView .potw-how > summary::before { content: "\25B8 "; opacity: .7; }
#potwView .potw-how[open] > summary::before { content: "\25BE "; }
#potwView .potw-how-body {
  font-size: var(--text-eyebrow); color: var(--potw-ink2);
  background: var(--potw-surface); border: 1px solid var(--potw-ring);
  border-radius: var(--radius); padding: 12px 16px;
  margin-top: 8px; max-width: 900px;
}
#potwView .potw-how-body p { margin: 0 0 8px; }
#potwView .potw-how-body p:last-child { margin-bottom: 0; }

/* ── Alert banner ── */
#potwView .potw-alertbar {
  background: #FDF4F4; border: 1px solid #F0C2C2;
  border-left: 6px solid var(--potw-bad);
  border-radius: var(--radius); padding: 10px 14px;
  font-size: var(--text-eyebrow); color: var(--potw-bad-ink);
  margin: 0 0 14px; line-height: 1.6;
}
#potwView .potw-alertbar b { letter-spacing: .3px; }

/* ── KPI tiles ── */
#potwView .potw-tiles {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px; margin-bottom: 16px;
}
#potwView .potw-tile {
  background: var(--potw-surface); border: 1px solid var(--potw-ring);
  border-top: 3px solid var(--potw-accent, var(--potw-ring));
  border-radius: var(--radius); padding: var(--pad-card);
}
#potwView .potw-tile .potw-k {
  font-size: var(--text-caption); color: var(--potw-mut);
  text-transform: uppercase; letter-spacing: .5px; margin-bottom: 3px;
}
#potwView .potw-tile .potw-v {
  font-size: var(--text-display); font-weight: 700; letter-spacing: -.3px;
  font-variant-numeric: tabular-nums; color: var(--potw-accent-ink, var(--potw-ink));
}
#potwView .potw-tile .potw-c { font-size: 11.5px; color: var(--potw-ink2); margin-top: 3px; }
#potwView .potw-t-units { --potw-accent: var(--primary-blue); --potw-accent-ink: var(--primary-blue); }
#potwView .potw-t-spiff { --potw-accent: var(--ashley-orange); --potw-accent-ink: var(--navy); background: #FFF8F1; }
#potwView .potw-t-good  { --potw-accent: var(--potw-good); --potw-accent-ink: var(--potw-good-ink); background: #F3F9F4; }
#potwView .potw-t-bad   { --potw-accent: var(--potw-bad);  --potw-accent-ink: var(--potw-bad-ink);  background: #FDF4F4; }
#potwView .potw-t-warn  { --potw-accent: var(--potw-warn); --potw-accent-ink: var(--potw-warn-ink); background: #FDF8EE; }

/* ── Controls: tabs + weekend pills + DC pills ── */
#potwView .potw-filters {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 14px;
}
#potwView .potw-dcrow { margin-top: -4px; }
#potwView .potw-tabs {
  display: inline-flex; border: 1px solid var(--potw-ring); border-radius: 6px;
  overflow: hidden; margin-right: 8px;
}
#potwView .potw-tab {
  background: var(--potw-surface); color: var(--potw-ink2);
  border: 0; border-right: 1px solid var(--potw-ring);
  padding: 6px 16px; font-size: var(--text-eyebrow); font-weight: 600;
  cursor: pointer; font-family: inherit;
}
#potwView .potw-tab:last-child { border-right: 0; }
#potwView .potw-tab.active { background: var(--navy); color: #fff; }
#potwView .potw-wklbl { color: var(--potw-mut); font-size: var(--text-eyebrow); font-weight: 600; }
#potwView .potw-live.potw-final {
  background: rgba(255,255,255,.18); letter-spacing: .8px;
}
#potwView .potw-pill {
  background: var(--potw-surface); border: 1px solid var(--potw-ring);
  color: var(--potw-ink2); border-radius: 15px; padding: 5px 14px;
  font-size: var(--text-eyebrow); font-weight: 600; cursor: pointer; font-family: inherit;
}
#potwView .potw-pill.active { background: var(--navy); border-color: var(--navy); color: #fff; }
#potwView .potw-asof { margin-left: auto; color: var(--potw-mut); font-size: var(--text-eyebrow); }

/* ── Cards + tables ── */
#potwView .potw-card {
  background: var(--potw-surface); border: 1px solid var(--potw-ring);
  border-radius: var(--radius); padding: 16px 18px; margin-bottom: 16px;
  overflow-x: auto;
}
#potwView .potw-card h2 { font-size: 13.5px; margin: 0 0 2px; font-weight: 600; }
#potwView .potw-card .potw-cap {
  font-size: 11.5px; color: var(--potw-mut); margin-bottom: 10px; max-width: 980px;
}
#potwView .potw-table {
  border-collapse: collapse; width: 100%; font-size: 12.5px;
  font-variant-numeric: tabular-nums;
}
#potwView .potw-table th, #potwView .potw-table td {
  padding: var(--pad-row); text-align: right;
  border-bottom: 1px solid var(--potw-grid); white-space: nowrap;
}
#potwView .potw-table th {
  color: var(--potw-mut); font-size: 10.5px; text-transform: uppercase;
  letter-spacing: .3px; font-weight: 600; border-bottom: 1px solid var(--potw-axis);
}
#potwView .potw-table td.potw-lbl, #potwView .potw-table th.potw-lbl {
  text-align: left; font-weight: 600;
}
#potwView .potw-table td .potw-sub { font-size: 10.5px; color: var(--potw-mut); font-weight: 400; }
#potwView tr.potw-dcband td {
  background: var(--potw-band); font-weight: 700; text-align: left;
  border-top: 2px solid var(--potw-axis); font-size: 12px; letter-spacing: .3px;
}
#potwView td.potw-remain { font-size: 15px; font-weight: 700; }
#potwView td.potw-remain.potw-r-out,  #potwView td.potw-remain.potw-r-last { color: var(--potw-bad-ink); }
#potwView td.potw-remain.potw-r-low  { color: var(--potw-warn-ink); }
#potwView td.potw-remain.potw-r-ok   { color: var(--potw-good-ink); }

/* status pills: the label carries the meaning, color is the second read */
#potwView .potw-st {
  display: inline-block; padding: 1px 8px; border-radius: 9px;
  background: var(--potw-band); border: 1px solid var(--potw-ring);
  font-size: 10px; font-weight: 700; letter-spacing: .2px; white-space: nowrap;
}
#potwView .potw-st-out  { background: #FDECEC; border-color: #F0C2C2; color: #A3211F; }
#potwView .potw-st-last { background: #FDECEC; border-color: #F0C2C2; color: #A3211F; }
#potwView .potw-st-low  { background: #FCF3E2; border-color: #E8D2A4; color: #8A5D0C; }
#potwView .potw-st-ok   { background: #F3F9F4; border-color: #BFDCC5; color: #267036; }
#potwView .potw-st-info { background: #EDF3F7; border-color: #C6D7E2; color: #2C5568; }

/* leaderboard */
#potwView .potw-rank { color: var(--potw-mut); font-weight: 700; width: 30px; }
#potwView td.potw-bonus { font-weight: 700; color: var(--potw-ink); font-size: 14px; }
#potwView tr.potw-first td { background: #FFF8F1; }
#potwView tr.potw-first td.potw-bonus { color: var(--ashley-orange); }

/* ticker */
#potwView .potw-ticker { list-style: none; margin: 0; padding: 0; font-size: 12.5px; }
#potwView .potw-ticker li {
  padding: 6px 2px; border-bottom: 1px solid var(--potw-grid);
  display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap;
}
#potwView .potw-ticker li:last-child { border-bottom: 0; }
#potwView .potw-ticker .potw-tt { color: var(--potw-mut); font-size: 11px; min-width: 92px; }
#potwView .potw-ticker .potw-tn { font-weight: 600; }
#potwView .potw-ticker .potw-ti { color: var(--potw-ink2); }
#potwView .potw-ticker .potw-tneg { color: var(--potw-bad-ink); font-weight: 600; }
#potwView .potw-ticker .potw-tspiff { color: var(--potw-good-ink); font-weight: 700; margin-left: auto; }

/* footnote / empty / retry */
#potwView .potw-note {
  font-size: 11.5px; color: var(--potw-mut); line-height: 1.55; max-width: 920px;
}
#potwView .potw-empty {
  background: var(--potw-surface); border: 1px solid var(--potw-ring);
  border-radius: var(--radius); padding: 40px 20px; text-align: center;
  color: var(--potw-ink2); font-size: var(--text-body);
}
#potwView .potw-retry-btn {
  background: var(--primary-blue); color: #fff; border: 0; border-radius: 4px;
  padding: 6px 14px; font-size: var(--text-eyebrow); font-weight: 600;
  cursor: pointer; font-family: inherit;
}
#potwView .potw-retry-btn:hover { background: var(--navy-hover); }
