/* ==========================================================================
   PitchX design layer — "Sales floor"
   Loads after styles.css and re-points the app's tokens to the PitchX brand:
   Pitch Black surface, Switch White type, Exchange Grey hairlines, and a
   strict two-red rule (Paper Red = things you can do, Night Red = things that
   are happening). Sharp corners, no shadows, no gradients.
   ========================================================================== */

/* ---------- fonts (self-hosted, latin subset) ---------------------------- */
@font-face {
  font-family: 'Archivo';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('/static/fonts/px-archivo-latin.woff2') format('woff2');
}
@font-face {
  font-family: 'Space Mono';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/static/fonts/px-spacemono-400.woff2') format('woff2');
}
@font-face {
  font-family: 'Space Mono';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('/static/fonts/px-spacemono-700.woff2') format('woff2');
}

/* ---------- tokens -------------------------------------------------------
   Two themes, one system. Dark is the night board: Pitch Black ground,
   Switch White ink. Light is the printed call sheet: Exchange Grey stock,
   Switch White cards, Pitch Black ink. Every rule below reads a ROLE token,
   never a colour name, so [data-theme=light] only has to re-point roles.
   -------------------------------------------------------------------------- */
:root,
[data-theme="dark"] {
  color-scheme: dark;

  /* brand swatches — literal, never used for layout */
  --px-black: #0b0c0e;   /* Pitch Black  */
  --px-white: #fbfbfc;   /* Switch White */
  --px-grey:  #f1f2f4;   /* Exchange Grey */
  --px-paper: #be1f2e;   /* Paper Red  — things you can do  */
  --px-night: #ff4655;   /* Night Red  — things that are happening */

  /* surfaces */
  --px-ground: #0b0c0e;
  --px-surface: #101215;
  --px-surface-2: #15181c;
  --px-fade: #0b0c0e;            /* tape edge gradient */
  --px-scrim: rgba(4, 5, 6, .78);

  /* ink */
  --px-ink: #fbfbfc;
  --px-ink-2: #a2a8af;
  --px-ink-3: #7f868e;   /* the mono label grey: 5.1:1 on a card, 5.3:1 on the ground */
  --px-on-accent: #fbfbfc;

  /* lines and quiet fills */
  --px-line: rgba(241, 242, 244, .13);
  --px-line-2: rgba(241, 242, 244, .28);
  --px-quiet: rgba(241, 242, 244, .05);
  --px-quiet-2: rgba(241, 242, 244, .08);
  --px-quiet-line: rgba(241, 242, 244, .22);
  --px-fill-quiet: var(--px-quiet);
  --px-fill-hover: var(--px-quiet-2);

  /* the two reds, by role */
  --px-action: #be1f2e;
  --px-action-hover: #a01926;
  --px-live: #ff4655;
  --px-live-glow: #ff4655;   /* fills only: the rec dot, the wave bars */
  --px-live-soft: rgba(255, 70, 85, .12);
  --px-live-line: rgba(255, 70, 85, .32);
  --px-live-fill: rgba(255, 70, 85, .07);
  --px-line-paper: var(--px-live-line);

  /* scrollbars */
  --px-scroll: #23272d;
  --px-scroll-hover: #3a4048;

  /* data series: one red ramp + greys, never a second hue */
  --px-s1: #ff4655;
  --px-s2: #be1f2e;
  --px-s3: #8d939a;
  --px-s4: #4b5158;
  --px-s5: #f1f2f4;
  --px-s6: #c9cdd2;
  --px-s7: #2b3037;
  --px-chart-stroke: #0b0c0e;

  --px-chrome: 52px;   /* top bar height */
  --px-tape: 84px;     /* live call tape height */

  /* re-point the legacy arena tokens at the roles --------------------- */
  --arena-white: var(--px-ink);
  --arena-bg: var(--px-ground);
  --arena-card: var(--px-surface);
  --arena-gray-light: var(--px-ground);
  --arena-gray: var(--px-surface);
  --arena-gray-dark: var(--px-surface-2);
  --arena-dark: var(--px-ink);
  --arena-secondary: var(--px-ink-2);
  --arena-border: var(--px-line);
  --arena-text: var(--px-ink);
  --arena-text-secondary: var(--px-ink-2);
  --arena-text-tertiary: var(--px-ink-3);

  --arena-blue: var(--px-action);
  --arena-blue-hover: var(--px-action-hover);
  --arena-blue-light: var(--px-live-soft);
  --arena-blue-mid: var(--px-live-line);
  --arena-red: var(--px-live);
  --arena-red-light: var(--px-live-fill);

  /* no green, no amber: good/bad read from fill weight, not hue */
  --arena-success: var(--px-ink);
  --arena-success-light: var(--px-quiet-2);
  --arena-warning: var(--px-live);
  --arena-warning-light: var(--px-live-soft);

  --arena-shadow-sm: none;
  --arena-shadow-md: none;
  --arena-shadow-lg: none;
  --arena-radius: 0px;
  --arena-radius-lg: 0px;

  --font-family: 'Archivo', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-display: 'Archivo', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'Space Mono', ui-monospace, 'SF Mono', Menlo, monospace;
}

/* ---------- light: the call sheet ---------------------------------------- */
[data-theme="light"] {
  color-scheme: light;

  --px-ground: #f1f2f4;
  --px-surface: #fbfbfc;
  --px-surface-2: #e9ebef;
  --px-fade: #f1f2f4;
  --px-scrim: rgba(241, 242, 244, .80);

  --px-ink: #0b0c0e;
  --px-ink-2: #4b5158;
  --px-ink-3: #5f656c;
  --px-on-accent: #fbfbfc;

  --px-line: rgba(11, 12, 14, .14);
  --px-line-2: rgba(11, 12, 14, .32);
  --px-quiet: rgba(11, 12, 14, .045);
  --px-quiet-2: rgba(11, 12, 14, .075);
  --px-quiet-line: rgba(11, 12, 14, .22);

  --px-action: #be1f2e;
  --px-action-hover: #991624;
  /* On paper there is one red. Night Red survives only as a fill — the rec
     dot and the wave bars — where it is a graphic, not text. */
  --px-live: #be1f2e;
  --px-live-glow: #e01b33;
  --px-live-soft: rgba(190, 31, 46, .10);
  --px-live-line: rgba(190, 31, 46, .32);
  --px-live-fill: rgba(190, 31, 46, .06);

  --px-scroll: #c9cdd2;
  --px-scroll-hover: #a2a8af;

  --px-s1: #be1f2e;
  --px-s2: #e01b33;
  --px-s3: #6e747b;
  --px-s4: #7f868e;
  --px-s5: #0b0c0e;
  --px-s6: #c9cdd2;
  --px-s7: #e9ebef;
  --px-chart-stroke: #fbfbfc;
}

/* ---------- base --------------------------------------------------------- */
html, body { background: var(--px-ground); }
body {
  color: var(--px-ink);
  font-family: var(--font-family);
  -webkit-font-smoothing: antialiased;
}
.material-symbols-rounded { font-variation-settings: 'FILL' 0, 'wght' 300, 'GRAD' 0; }
* { border-radius: 0 !important; box-shadow: none !important; }

h1, h2, h3, h4 { font-family: var(--font-display); letter-spacing: -.015em; }

::selection { background: var(--px-action); color: var(--px-on-accent); }

/* First thing on the page, invisible until the keyboard reaches it. */
.px-skip {
  position: absolute;
  left: 8px;
  top: -60px;
  z-index: 2000;
  padding: 10px 14px;
  background: var(--px-action);
  color: var(--px-on-accent);
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: top .12s ease;
}
.px-skip:focus { top: 8px; outline: 2px solid var(--px-ink); outline-offset: 2px; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--px-ground); }
::-webkit-scrollbar-thumb { background: var(--px-scroll); border: 3px solid var(--px-ground); }
::-webkit-scrollbar-thumb:hover { background: var(--px-scroll-hover); }

:focus-visible {
  outline: 2px solid var(--px-live);
  outline-offset: 2px;
}

/* utility type */
.px-caption,
.nav-label,
.stat-label,
.card-subtitle {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 400;
  line-height: 16px;
  letter-spacing: .10em;
  text-transform: uppercase;
  color: var(--px-ink-3);
}

/* ---------- top bar ------------------------------------------------------ */
.top-navbar {
  height: var(--px-chrome);
  background: var(--px-ground);
  border-bottom: 1px solid var(--px-line);
  padding: 0 20px;
  gap: 12px;
}
.top-navbar-logo {
  width: 26px;
  height: 26px;
  background: var(--px-action);
  color: var(--px-on-accent);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 15px;
  line-height: 1;
}
.top-navbar-title {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--px-ink);
}
.top-navbar-brand, .top-navbar-user { color: var(--px-ink); }
.top-navbar-user { padding: 4px 8px; }
.top-navbar-user span { color: var(--px-ink-2) !important; font-family: var(--font-mono); font-size: 11px !important; letter-spacing: .06em; }
.top-navbar-avatar {
  width: 24px;
  height: 24px;
  background: transparent;
  border: 1px solid var(--px-line-2);
  color: var(--px-ink);
  border-radius: 0 !important;
  font-family: var(--font-mono);
  font-size: 11px;
}
.top-navbar-btn {
  width: 30px;
  height: 30px;
  background: transparent;
  border: 1px solid var(--px-line);
  color: var(--px-ink-2);
}
.top-navbar-btn:hover { background: var(--px-fill-hover); border-color: var(--px-line-2); color: var(--px-ink); }
.top-navbar-badge {
  top: -6px; right: -6px;
  width: auto; min-width: 15px; height: 15px;
  padding: 0 3px;
  border-radius: 0 !important;
  /* Night Red at 9px is 3.2:1 against white; Paper Red clears 6:1 in both themes. */
  background: var(--px-action);
  color: var(--px-on-accent);
  font-family: var(--font-mono);
  font-size: 9px;
  line-height: 15px;
}

/* ---------- navigation --------------------------------------------------- */
.sidebar {
  background: var(--px-ground);
  border-right: 1px solid var(--px-line);
  color: var(--px-ink);
}
.sidebar-nav { padding: 4px 0; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  color: var(--px-ink-2);
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 500;
  line-height: 20px;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: color .15s ease, background .15s ease;
}
.nav-item:hover { color: var(--px-ink); background: var(--px-fill-quiet); }
.nav-item.active { color: var(--px-ink); background: transparent; border-bottom-color: var(--px-action); }
.nav-item .material-symbols-rounded { font-size: 18px; color: var(--px-ink-3); }
.nav-item.active .material-symbols-rounded { color: var(--px-live); }
.nav-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: .14em;
  color: var(--px-ink-3);
  padding: 14px 12px 6px;
}
.sidebar-footer { border-top: 1px solid var(--px-line); }
.sidebar-footer > div { background: var(--px-surface) !important; border: 1px solid var(--px-line); }

/* ---------- live call tape (signature element) --------------------------- */
.call-tape {
  position: sticky;
  top: var(--px-chrome);
  z-index: 120;
  display: flex;
  align-items: stretch;
  gap: 0;
  margin: 0 -20px 20px;
  padding: 0;
  height: var(--px-tape);
  background: linear-gradient(180deg, var(--px-surface) 0%, var(--px-ground) 100%);
  border-top: 1px solid var(--px-line);
  border-bottom: 1px solid var(--px-line);
}
.tape-head {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  padding: 0 16px 0 20px;
  border-right: 1px solid var(--px-line);
  background: var(--px-ground);
}
.tape-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--px-live);
}
.tape-count {
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 700;
  line-height: 1;
  color: var(--px-ink);
}
.tape-sub {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: .08em;
  color: var(--px-ink-3);
  text-transform: uppercase;
}
.tape-viewport {
  position: relative;
  flex: 1 1 auto;
  overflow: hidden;
  display: flex;
  align-items: center;
}
.tape-viewport::after {
  content: '';
  position: absolute;
  inset: 0 0 0 auto;
  width: 56px;
  pointer-events: none;
  background: linear-gradient(90deg, transparent 0%, var(--px-fade) 88%);
}
.call-tape.is-overflowing .tape-viewport::before {
  content: '';
  position: absolute;
  inset: 0 auto 0 0;
  width: 40px;
  pointer-events: none;
  z-index: 2;
  background: linear-gradient(270deg, transparent 0%, var(--px-fade) 88%);
}
.tape-track {
  display: flex;
  align-items: stretch;
  gap: 10px;
  padding: 12px 20px;
  width: max-content;
}
.tape-card {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 0 0 auto;
  padding: 10px 14px;
  min-width: 320px;
  background: var(--px-surface);
  border: 1px solid var(--px-line);
  border-left: 2px solid var(--px-live);
}
.tape-card[data-status="Ringing"] { border-left-color: var(--px-ink-3); }
.tape-card:hover { background: var(--px-surface-2); border-color: var(--px-line-2); border-left-color: var(--px-live); }
.tape-rec {
  width: 8px; height: 8px;
  flex: 0 0 auto;
  background: var(--px-live-glow);
  animation: px-pulse 1.4s ease-in-out infinite;
}
.tape-card[data-status="Ringing"] .tape-rec { background: var(--px-ink-3); animation: none; }
.tape-id { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.tape-lead {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  line-height: 18px;
  color: var(--px-ink);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tape-num {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .04em;
  color: var(--px-ink-3);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tape-wave {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  gap: 2px;
  height: 28px;
  min-width: 72px;
}
.tape-wave i {
  display: block;
  width: 2px;
  background: var(--px-live-glow);
  opacity: .8;
  transform-origin: center;
  animation: px-wave 900ms ease-in-out infinite alternate;
}
.tape-card[data-status="Ringing"] .tape-wave i { background: var(--px-ink-3); animation: none; height: 3px !important; }
.tape-time {
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: .02em;
  color: var(--px-ink);
  font-variant-numeric: tabular-nums;
}
.tape-action {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: .10em;
  text-transform: uppercase;
  color: var(--px-ink);
  background: transparent;
  border: 1px solid var(--px-line-2);
  padding: 6px 9px;
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
}
.tape-action:hover { background: var(--px-action); border-color: var(--px-action); color: var(--px-on-accent); }
.tape-empty {
  /* One sentence, not three flex columns. As a flex row the two text runs and
     the <b> each became their own item, so on a phone the line broke into a
     ragged three-column block. */
  display: block;
  align-self: center;
  padding: 0 20px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .08em;
  line-height: 1.6;
  text-transform: uppercase;
  color: var(--px-ink-3);
}
.tape-empty b { color: var(--px-ink); font-weight: 700; }

@keyframes px-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }
@keyframes px-wave { from { transform: scaleY(.25); } to { transform: scaleY(1); } }
@keyframes px-tape-scroll { from { transform: translateX(0); } to { transform: translateX(-50%); } }

.tape-track.is-marquee { animation: px-tape-scroll 38s linear infinite; }
.call-tape:hover .tape-track.is-marquee,
.call-tape:focus-within .tape-track.is-marquee { animation-play-state: paused; }

/* ---------- page frame --------------------------------------------------- */
.main-content { background: var(--px-ground); }
.page-section { max-width: 1480px; }
.page-title, h2.page-title {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 700;
  line-height: 40px;
  letter-spacing: -.02em;
  color: var(--px-ink);
  margin: 0;
}
.page-subtitle, .page-header p {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--px-ink-3);
}
.page-head-split { border-bottom: 1px solid var(--px-line); padding-bottom: 16px; margin-bottom: 20px; }

/* ---------- the sales floor ----------------------------------------------
   Three bands on one rhythm: the head (who is on, and what you can do about
   it), the ledger (every number, on one hairline line), then the work.
   Both body rows share the same 7/3 split, so the secondary column is always
   in the same place.
   ------------------------------------------------------------------------- */
.px-eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--px-ink-3);
}

.floor-head {
  display: flex;
  align-items: flex-end;
  gap: 20px 28px;
  flex-wrap: wrap;
  padding: 0 0 14px;
  margin: 0 0 16px;
  border-bottom: 1px solid var(--px-line-2);
}
.floor-id { min-width: 0 }
.floor-title {
  font-family: var(--font-display);
  font-size: clamp(26px, 3.1vw, 34px);
  font-weight: 800;
  letter-spacing: -.032em;
  line-height: 1.05;
  margin: 4px 0 0;
  color: var(--px-ink);
}
.floor-status { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px }
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px;
  border: 1px solid var(--px-line);
  background: var(--px-quiet);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--px-ink-2);
}
.status-pill b { color: var(--px-ink); font-weight: 700; font-variant-numeric: tabular-nums }
.status-pill.status-live { border-color: var(--px-live-line); background: var(--px-live-fill); color: var(--px-live) }
.status-pill.status-live b { color: var(--px-live) }
.floor-actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; align-items: center }

/* the ledger: one line of numbers, hairline gutters, Paper Red rule on the left */
.ledger {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 1px;
  background: var(--px-line);
  border: 1px solid var(--px-line);
  border-left: 3px solid var(--px-action);
  margin: 0 0 24px;
}
.ledger-cell {
  appearance: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-start;
  text-align: left;
  padding: 14px 16px 16px;
  background: var(--px-surface);
  border: 0;
  color: var(--px-ink);
  font: inherit;
  cursor: pointer;
  transition: background .14s linear;
}
.ledger-cell:hover { background: var(--px-surface-2) }
.ledger-cell:focus-visible { outline: 2px solid var(--px-live); outline-offset: -2px }
.ledger-value {
  font-family: var(--font-mono);
  font-size: clamp(21px, 2.1vw, 26px);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
}
.ledger-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--px-ink-3);
}

.floor-grid { display: grid; gap: 20px; margin: 0 0 20px }
.floor-grid-a { grid-template-columns: minmax(0, 7fr) minmax(0, 3fr) }
.floor-grid-b { grid-template-columns: repeat(3, minmax(0, 1fr)) }
.floor-grid-c { grid-template-columns: minmax(0, 7fr) minmax(0, 3fr) }

.card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 10px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--px-line);
}
.card-h {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -.012em;
  margin: 0;
  color: var(--px-ink);
}
.card-note {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: .10em;
  text-transform: uppercase;
  color: var(--px-ink-3);
  white-space: nowrap;
}
.chart-box { height: 200px }
.chart-box-hero { height: 288px }
/* Quiet note over an empty chart, so a slow week reads as "nothing dialled"
   rather than a broken panel. It sits inside the card, not the chart host,
   because ApexCharts owns everything inside that div. */
.chart-empty {
  position: absolute;
  left: 50%;
  top: 58%;
  transform: translate(-50%, -50%);
  margin: 0;
  max-width: 330px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.7;
  color: var(--px-ink-3);
  pointer-events: none;
}
.card-hero { position: relative }

/* queue pressure: the right-hand column of row A */
.pressure-list { list-style: none; margin: 0; padding: 0 }
.pressure-list li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--px-line);
}
.pressure-list li:last-child { border-bottom: 0 }
.pl-label { font-family: var(--font-mono); font-size: 11px; letter-spacing: .10em; text-transform: uppercase; color: var(--px-ink-3) }
.pl-value {
  font-family: var(--font-mono);
  font-size: 19px;
  font-weight: 700;
  color: var(--px-ink);
  font-variant-numeric: tabular-nums;
}
.panel-links {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  margin-top: 16px;
  background: var(--px-line);
  border: 1px solid var(--px-line);
}
.panel-links button {
  appearance: none;
  border: 0;
  background: var(--px-surface);
  color: var(--px-ink-2);
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  text-align: left;
  padding: 10px 12px;
  cursor: pointer;
  transition: background .14s linear, color .14s linear;
}
.panel-links button:hover { background: var(--px-quiet-2); color: var(--px-ink) }
.panel-links button:focus-visible { outline: 2px solid var(--px-live); outline-offset: -2px }

/* feeds: recent activity, callbacks, campaign outcomes */
.feed { font-size: 12px }
.feed-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  width: 100%;
  padding: 10px 0;
  border: 0;
  border-bottom: 1px solid var(--px-line);
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.feed-row:last-child { border-bottom: 0 }
button.feed-row:hover { background: var(--px-quiet); box-shadow: -8px 0 0 var(--px-quiet), 8px 0 0 var(--px-quiet) }
.feed-main { min-width: 0; display: flex; flex-direction: column; gap: 2px }
.feed-title { font-weight: 600; color: var(--px-ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap }
.feed-sub { font-family: var(--font-mono); font-size: 10px; letter-spacing: .04em; color: var(--px-ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap }
.feed-side { display: flex; align-items: center; gap: 8px; flex-shrink: 0 }
.feed-time { font-family: var(--font-mono); font-size: 10px; color: var(--px-ink-3) }
.feed-actions { flex-wrap: wrap; justify-content: flex-end }
.feed-scroll { max-height: 208px; overflow-y: auto; padding-right: 4px }
.feed-scroll-tall { max-height: 288px }
.feed-empty { font-family: var(--font-mono); font-size: 11px; letter-spacing: .04em; color: var(--px-ink-3); padding: 14px 0 }
.feed-foot { margin-top: 10px; font-family: var(--font-mono); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--px-ink-3) }
.figure-row { display: flex; gap: 28px; flex-wrap: wrap; padding-bottom: 14px; margin-bottom: 6px; border-bottom: 1px solid var(--px-line) }
.figure-label { font-family: var(--font-mono); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--px-ink-3); margin-top: 3px }
.btn-xs { font-size: 10px; padding: 3px 8px; letter-spacing: .04em }

/* ---------- cards -------------------------------------------------------- */
.card, .live-card, .modal-box {
  background: var(--px-surface);
  border: 1px solid var(--px-line);
}
.card:hover { border-color: var(--px-line); }
.card-title, .chart-title {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 500;
  line-height: 20px;
  letter-spacing: .02em;
  color: var(--px-ink);
  text-transform: none;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--px-line);
}

/* ---------- tables ------------------------------------------------------- */
.table-wrap { border: 1px solid var(--px-line); }
table { width: 100%; border-collapse: collapse; background: transparent; }
thead th {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 400;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--px-ink-3);
  background: var(--px-ground);
  border-bottom: 1px solid var(--px-line-2);
  padding: 10px 12px;
}
tbody td {
  font-size: 14px;
  color: var(--px-ink);
  border-bottom: 1px solid var(--px-line);
  padding: 10px 12px;
}
tbody tr { background: transparent; transition: background .12s ease; }
tbody tr:hover { background: var(--px-fill-hover); }
tbody tr:hover td:first-child { box-shadow: inset 2px 0 0 var(--px-live); }
tbody tr:last-child td { border-bottom: 0; }

/* ---------- badges ------------------------------------------------------- */
.badge {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 400;
  letter-spacing: .10em;
  text-transform: uppercase;
  padding: 2px 7px;
  border: 1px solid transparent;
}
.badge-success { background: var(--px-quiet-2); color: var(--px-ink); border-color: var(--px-quiet-line); }
.badge-neutral { background: var(--px-quiet); color: var(--px-ink-2); border-color: var(--px-line); }
.badge-info    { background: var(--px-quiet); color: var(--px-ink-2); border-color: var(--px-line); }
.badge-warning { background: var(--px-live-soft); color: var(--px-live); border-color: var(--px-live-line); }
.badge-danger  { background: var(--px-live-soft); color: var(--px-live); border-color: rgba(255, 70, 85, .42); }

/* ---------- buttons ------------------------------------------------------ */
.btn {
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .01em;
  padding: 9px 14px;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.btn-primary { background: var(--px-action); color: var(--px-on-accent); border: 1px solid var(--px-action); }
.btn-primary:hover:not(:disabled) { background: var(--px-action-hover); border-color: var(--px-action-hover); }
.btn-ghost { background: transparent; color: var(--px-ink-2); border: 1px solid var(--px-line-2); }
.btn-ghost:hover:not(:disabled) { background: var(--px-fill-hover); color: var(--px-ink); border-color: var(--px-ink); }
.btn-sm { padding: 5px 9px; font-size: 11px; }
/* Disabled used to be 40% opacity, which on paper turns a red button into pale
   pink with white text. Flat grey with a dashed edge says "not now" in both
   themes and keeps the label readable. */
.btn:disabled, .btn[disabled] {
  opacity: 1;
  background: var(--px-quiet-2);
  color: var(--px-ink-2);
  border: 1px dashed var(--px-line-2);
}

/* ---------- campaigns ---------------------------------------------------- */
.campaigns-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

/* ---------- forms -------------------------------------------------------- */
input, select, textarea {
  background: var(--px-ground) !important;
  border: 1px solid var(--px-line-2) !important;
  color: var(--px-ink) !important;
  font-family: var(--font-family);
}
input::placeholder, textarea::placeholder { color: var(--px-ink-3) !important; }
input:focus, select:focus, textarea:focus { border-color: var(--px-live) !important; }
select option { background: var(--px-surface); color: var(--px-ink); }
label { color: var(--px-ink-2); }

/* ---------- live monitoring page ---------------------------------------- */
.live-card { border-left: 2px solid var(--px-live); padding: 14px 16px; }
.live-card:hover { border-color: var(--px-line-2); border-left-color: var(--px-live); }
.waveform { height: 28px; }
.waveform span { width: 2px; background: var(--px-live-glow); border-radius: 0 !important; }
.live-indicator { background: var(--px-live-glow) !important; }

/* ---------- charts ------------------------------------------------------- */
.apexcharts-tooltip { background: var(--px-surface-2) !important; border: 1px solid var(--px-line-2) !important; }
.apexcharts-tooltip * { color: var(--px-ink) !important; font-family: var(--font-mono) !important; }
.apexcharts-text, .apexcharts-legend-text, .apexcharts-xaxis-label, .apexcharts-yaxis-label { fill: var(--px-ink-3) !important; }
.apexcharts-legend-text { color: var(--px-ink-2) !important; }
.apexcharts-menu, .apexcharts-toolbar { display: none !important; }

/* ---------- tabs, pagination, misc -------------------------------------- */
.tab-bar { background: var(--px-ground); border: 1px solid var(--px-line); padding: 0; gap: 0; }
.tab-btn {
  background: transparent;
  color: var(--px-ink-3);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  border-bottom: 2px solid transparent;
  padding: 10px 12px;
}
.tab-btn.active { background: transparent; color: var(--px-ink); border-bottom-color: var(--px-action); }
.pagination button {
  background: transparent;
  border: 1px solid var(--px-line);
  color: var(--px-ink-2);
  font-family: var(--font-mono);
  font-size: 11px;
  min-width: 30px;
}
.pagination button:hover { border-color: var(--px-ink); color: var(--px-ink); }
.pagination button.active { background: var(--px-action); border-color: var(--px-action); color: var(--px-on-accent); }
.notif-item { border-bottom: 1px solid var(--px-line); padding: 12px 16px }
.notif-item:hover { background: var(--px-fill-hover); margin: 0; border-radius: 0 !important; }
.notif-item.unread { box-shadow: inset 2px 0 0 var(--px-live); padding-left: 12px; }
.transcript-box {
  background: var(--px-ground);
  border: 1px solid var(--px-line);
  color: var(--px-ink-2);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 20px;
}
.modal { background: var(--px-scrim); }
.modal-box { border: 1px solid var(--px-line-2); background: var(--px-surface); }
.progress-track, .card[style*="dashed"] { border-color: var(--px-line-2) !important; }

/* ---------- status dots, figures, live rows ------------------------------ */
.px-dot { font-weight: 700; line-height: 1; }
.px-dot.on { color: var(--px-ink); }
.px-dot.off { color: var(--px-live); }
.px-figure {
  font-family: var(--font-mono);
  font-size: 24px;
  font-weight: 700;
  line-height: 32px;
  font-variant-numeric: tabular-nums;
}
.px-figure.on { color: var(--px-ink); }
.px-figure.off { color: var(--px-live); }
.px-figure.wait { color: var(--px-s3); }
tr.row-live { background: var(--px-live-fill); }
tr.row-live td { border-bottom: 1px solid var(--px-live-line); }
tr.row-live td:first-child { box-shadow: inset 2px 0 0 var(--px-live); }

/* ---------- desktop: nav lives in the top bar ---------------------------- */
/* 901, not 900: the legacy sheet hides .top-navbar at max-width:900px, so at
   exactly 900 we would keep a top-bar nav with no top bar to sit in. */
@media (min-width: 901px) {
  .app-layout { display: block; height: auto; overflow: visible; }
  .sidebar {
    position: fixed;
    top: 0;
    left: 216px;
    /* The icon cluster on the right is ~268px plus 20px of bar padding. Stop the
       nav strip short of it so nothing ever sits on top of those buttons. */
    right: 288px;
    height: var(--px-chrome);
    width: auto;
    padding: 0;
    border: 0;
    background: transparent;
    display: flex;
    flex-direction: row;
    align-items: center;
    overflow: visible;
    z-index: 160;
    transform: none !important;
  }
  .sidebar-nav {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 2px;
    margin: 0;
    padding: 0;
    min-width: 0;
    overflow-x: auto;
    scrollbar-width: none;
  }
  /* The strip above is a transparent fixed layer running the full width of the
     top bar, and it sits over .top-navbar. Left alone it swallows every click
     aimed at the theme, search, alerts, refresh and account buttons on the
     right. Only the links themselves should take pointer input. */
  .sidebar, .sidebar-nav, .nav-section { pointer-events: none; }
  .nav-item { pointer-events: auto; }
  .sidebar-nav::-webkit-scrollbar { display: none; }
  .nav-section { display: flex; flex-direction: row; align-items: center; gap: 2px; }
  .nav-section + .nav-section { margin-left: 10px; padding-left: 10px; border-left: 1px solid var(--px-line); }
  .nav-label { display: none; }
  .nav-item { padding: 6px 9px; font-size: 14px; line-height: 20px; border-bottom: 2px solid transparent; }
  /* Narrow desktops get the icons; the word goes with them on wide ones below. */
  .nav-item .material-symbols-rounded { display: inline-block; font-size: 20px; }
  .nav-text {
    position: absolute; width: 1px; height: 1px; overflow: hidden;
    clip-path: inset(50%); white-space: nowrap;
  }
  .sidebar-footer { display: none; }
  .sidebar-backdrop { display: none; }
  .mobile-toolbar { display: none !important; }
  .main-content {
    padding: calc(var(--px-chrome) + 20px) 20px 48px;
    overflow: visible;
    min-height: 100vh;
  }
  .call-tape { top: var(--px-chrome); }
  /* Never let the bar crush the icon cluster — a shrunken control is an
     unclickable one. */
  .top-navbar-actions { flex-shrink: 0; }
}

/* Wide enough that brand + nine labelled tabs + the icon cluster share one row
   without touching: 216 + nav + 288 reserve. Labels start condensed at 13px and
   go full size once there is room for them. */
@media (min-width: 1240px) {
  .nav-item .material-symbols-rounded { display: none; }
  .nav-text { position: static; width: auto; height: auto; overflow: visible; clip-path: none; }
  .nav-item { padding: 6px 8px; font-size: 13px; }
  .nav-section + .nav-section { margin-left: 10px; padding-left: 10px; }
}
@media (min-width: 1340px) {
  .nav-item { padding: 6px 10px; font-size: 14px; }
  .nav-section + .nav-section { margin-left: 14px; padding-left: 14px; }
}

/* ---------- mobile ------------------------------------------------------- */
@media (max-width: 900px) {
  :root { --px-tape: 76px; }

  /* The legacy sheet paints this bar with --arena-white; on the floor it is
     chrome, not paper. */
  .mobile-toolbar {
    background: var(--px-ground) !important;
    border-bottom: 1px solid var(--px-line) !important;
  }
  .mobile-toolbar > span:nth-child(2) {
    font-family: var(--font-display);
    font-weight: 800;
    letter-spacing: .16em;
    text-transform: uppercase;
    font-size: 14px !important;
  }

  .call-tape { top: 52px; margin: 0 -16px 16px; }
  .tape-head { padding: 0 12px 0 16px; }
  .tape-viewport { overflow-x: auto; }
  .tape-viewport::after { display: none; }
  .tape-track { animation: none !important; padding: 10px 16px; }
  .tape-card { min-width: 268px; }
  .tape-wave { display: none; }
  .page-title { font-size: 24px; line-height: 32px; }
  .floor-head { align-items: flex-start; padding-bottom: 12px; margin-bottom: 14px; gap: 14px }
  .floor-title { font-size: 27px }
  .floor-actions { margin-left: 0; width: 100% }
  .floor-actions .btn { flex: 1 1 auto; justify-content: center }
  .ledger { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: 18px }
  /* Seven cells in two columns: the last one closes the row instead of
     leaving a gutter-coloured hole. */
  .ledger-cell:last-child { grid-column: 1 / -1 }
  .ledger-cell { padding: 12px 14px 14px }
  .floor-grid, .floor-grid-a, .floor-grid-b, .floor-grid-c { grid-template-columns: minmax(0, 1fr); gap: 14px; margin-bottom: 14px }
  .chart-box { height: 184px }
  .chart-box-hero { height: 232px }
  .card-head { margin-bottom: 10px }
  .feed-scroll { max-height: 320px }
  .campaigns-grid { grid-template-columns: minmax(0, 1fr); gap: 14px }

  /* Eight columns cannot live at 390px. The call log becomes one card per
     call and data-label supplies the field name the header used to carry. */
  .table-wrap { overflow-x: visible }
  #calls-table { display: block; width: 100% }
  #calls-table thead { display: none }
  #calls-table tbody { display: block }
  #calls-table tr {
    display: block;
    border: 1px solid var(--px-line);
    border-left: 3px solid var(--px-line-2);
    padding: 10px 12px;
    margin-bottom: 10px;
    background: var(--px-surface);
  }
  #calls-table tr.row-live { border-left-color: var(--px-live) }
  #calls-table td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    border: none;
    padding: 3px 0;
    font-size: 13px;
  }
  #calls-table td::before {
    content: attr(data-label);
    font-family: var(--font-mono);
    font-size: 9px;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--px-ink-3);
    flex: 0 0 auto;
  }
  #calls-table td[data-label="Phone"] {
    font-family: var(--font-mono);
    font-size: 11px;
    white-space: nowrap;
  }
  #calls-table td[data-label="Recording"] audio { width: min(100%, 260px) }
}

/* ---------- reduced motion ---------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .tape-track.is-marquee { animation: none !important; }
  .tape-viewport { overflow-x: auto; }
  .tape-rec, .tape-wave i, .waveform span, .live-indicator { animation: none !important; }
  .page-section.active { animation: none !important; }
  * { transition-duration: .01ms !important; }
}

/* ---------- print (managers print the call log) -------------------------- */
@media print {
  .top-navbar, .sidebar, .call-tape, .mobile-toolbar, .btn { display: none !important; }
  body, .main-content { background: #fff !important; color: #000 !important; padding: 0 !important; }
  .card, table { border-color: #ddd !important; background: #fff !important; }
  td, th, .ledger-value, .page-title { color: #000 !important; }
}

/* ---------- surfaces the legacy sheet paints with --arena-white ----------- */
html { color-scheme: dark; }
.filter-bar, .kb-stat, .conv-row, .phone-row, .version-item, .prompt-editor {
  background: var(--px-surface);
  border: 1px solid var(--px-line);
}
.conv-row { padding: 14px 16px; margin-bottom: 10px; cursor: pointer; }
.conv-row:hover { background: var(--px-surface-2); border-color: var(--px-line-2); }
.phone-row { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; }
.kb-stat-value {
  font-family: var(--font-mono);
  color: var(--px-ink);
  font-variant-numeric: tabular-nums;
}
.kb-stat-label { letter-spacing: .12em; color: var(--px-ink-3); }

/* Alert chips: the legacy sheet has four hues; the floor has two. */
.notif-icon { border: 1px solid var(--px-line); }
.notif-icon.success { background: var(--px-quiet-2); color: var(--px-ink); }
.notif-icon.info { background: var(--px-quiet); color: var(--px-s3); }
.notif-icon.warning { background: var(--px-live-soft); color: var(--px-live); border-color: rgba(255, 70, 85, .3); }
.notif-icon.error { background: var(--px-live-soft); color: var(--px-live); border-color: var(--px-live-soft); }
audio { width: 100%; max-width: 200px; height: 30px; }

/* live = Night Red, everywhere */
.badge-live {
  background: var(--px-live-soft);
  color: var(--px-live);
  border: 1px solid var(--px-live-line);
}

/* ---------- call detail: cells, conversation turns, dial popup history ------ */
.cd-label {
  display: block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--px-ink-3);
  margin-bottom: 4px;
}
.cd-value { font-size: 13px; color: var(--px-ink); }
.cd-block {
  background: var(--px-ground);
  border: 1px solid var(--px-line);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 20px;
  color: var(--px-ink-2);
}
.cd-block.is-error { border-color: var(--px-live-line); color: var(--px-live); }
.cd-list { margin: 6px 0 0 18px; padding: 0; font-size: 13px; color: var(--px-ink-2); }
.cd-list li { margin-bottom: 4px; }
.cd-empty {
  font-size: 12px;
  color: var(--px-ink-3);
  background: var(--px-ground);
  border: 1px dashed var(--px-line);
  border-radius: 8px;
  padding: 12px;
}
.call-turns { display: flex; flex-direction: column; gap: 8px; max-height: 320px; overflow-y: auto; }
.call-turn {
  border: 1px solid var(--px-line);
  border-radius: 10px;
  padding: 8px 10px;
  background: var(--px-ground);
}
.call-turn.is-bot { border-color: var(--px-line-2); background: var(--px-quiet); }
.call-turn-who {
  display: block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--px-ink-3);
  margin-bottom: 2px;
}
.call-turn-text { font-size: 13px; line-height: 19px; color: var(--px-ink); white-space: pre-wrap; }
.dial-recent {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--px-line);
  border-radius: 8px;
  margin-bottom: 6px;
  cursor: pointer;
  background: var(--px-ground);
}
.dial-recent:hover { border-color: var(--px-line-2); background: var(--px-quiet); }
