:root {
  --bg: #0d1117;
  --panel: #161b22;
  --panel-2: #1c2128;
  --border: #30363d;
  --text: #e6edf3;
  --muted: #8b949e;
  --accent: #58a6ff;
  --green: #3fb950;
  --red: #f85149;
  --amber: #d29922;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.45;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  /* Safety net: nothing may widen the page past the phone screen. Set on
     body only (not html) so the sticky header keeps working. */
  overflow-x: hidden;
}

a {
  color: var(--accent);
}

.wrap {
  max-width: 1000px;
  margin: 0 auto;
  padding: 0 16px 32px;
}

/* Every page (Home included, 2026-10-02) gets a wider wrapper so a
   4-across tile row of live books has room to lay out - added by JS on
   the .wrap element on every route. */
.wrap.wrap-wide {
  max-width: 1400px;
}

/* -- header -- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--bg);
  padding-top: calc(20px + env(safe-area-inset-top, 0px));
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}

.topbar h1 {
  font-size: 1.4rem;
  margin: 0 0 6px;
}

.updated-row {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 0.85rem;
  margin-bottom: 12px;
}

.tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 2px;
  scrollbar-width: none;
}

.tabs::-webkit-scrollbar {
  display: none;
}

.tab {
  flex: 0 0 auto;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--muted);
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 600;
  white-space: nowrap;
}

.tab.active {
  background: rgba(88, 166, 255, 0.15);
  border-color: rgba(88, 166, 255, 0.5);
  color: var(--accent);
}

.section-block {
  margin-bottom: 32px;
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.badge.stale {
  background: rgba(248, 81, 73, 0.18);
  color: var(--red);
  border: 1px solid rgba(248, 81, 73, 0.4);
}

.stat-tiles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 22px;
}

@media (min-width: 640px) {
  .stat-tiles {
    grid-template-columns: repeat(4, 1fr);
  }
}

.tile {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
}

.tile .label {
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}

.tile .value {
  font-size: 1.25rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.tile .sub {
  color: var(--muted);
  font-size: 0.75rem;
  margin-top: 2px;
}

/* -- money coloring (never color-only: signs are always present in the text) -- */

.pos { color: var(--green); }
.neg { color: var(--red); }
.zero { color: var(--text); }

/* -- sections -- */

section {
  margin-bottom: 32px;
}

h2 {
  font-size: 1.05rem;
  margin: 0 0 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

.chart-box {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  position: relative;
  height: 260px;
}

.chart-box canvas {
  max-width: 100%;
}

.chart-caption {
  color: var(--muted);
  font-size: 0.78rem;
  margin-top: 6px;
}

/* -- sport cards -- */

#sport-cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

@media (min-width: 700px) {
  #sport-cards {
    grid-template-columns: 1fr 1fr;
  }
}

.sport-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
}

.sport-card h3 {
  margin: 0 0 10px;
  font-size: 1rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.sport-tag {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  font-size: 0.7rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.stat-row {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin: 10px 0;
  font-size: 0.85rem;
}

.stat-row .stat {
  color: var(--muted);
}

.stat-row .stat b {
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.no-results {
  color: var(--muted);
  font-style: italic;
  font-size: 0.85rem;
  margin: 8px 0;
}

/* -- Calendar tab: full month sheet (Blake 2026-10-02) --------------------
   Replaced the old 7-day week row with its own tab: a real month sheet,
   Sun-Sat columns, rows = the weeks of the shown month (Central time),
   leading/trailing days from adjacent months greyed, today highlighted,
   prev/next month arrows. Chips: LIVE (solid, sport-colored, floor
   shown), SETTLED (muted solid, +/-$ result), WATCHLIST (dashed outline
   - listed on Kalshi, no book running yet; a ".not-listed" modifier is
   the same dashed look for an event Kalshi has not listed yet, paired
   with a small "listing?" marker on its expected listing day and a
   dotted SVG connector between the two, drawn by app.js's
   drawCalConnectors). A multi-day event (a golf tournament) spans its
   days as one bar across a week row. See app.js's renderCalendarPage for
   how the desktop grid, the phone day list, and the connector overlay
   are all built from the same classified data in one pass. */

:root {
  --sport-nfl: var(--accent);
  --sport-nascar: var(--amber);
  --sport-f1: #bc8cff;
  --sport-golf: var(--green);
  --sport-ufc: var(--red);
}

.cal-month-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-bottom: 14px;
}

.cal-month-label {
  margin: 0;
  font-size: 1.1rem;
  min-width: 11ch;
  text-align: center;
}

.cal-month-nav-btn {
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  width: 34px;
  height: 34px;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
}

.cal-month-nav-btn:hover,
.cal-month-nav-btn:focus-visible {
  border-color: var(--accent);
  color: var(--accent);
  outline: none;
}

.cal-month-grid-wrap {
  position: relative;
}

.cal-month-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}

.cal-month-dow {
  font-weight: 700;
  font-size: 0.78rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
  grid-row: 1;
}

.cal-month-cell {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 72px;
  padding: 4px;
  border-radius: 8px;
  border: 1px solid transparent;
}

.cal-month-cell.today {
  background: rgba(88, 166, 255, 0.06);
  border-color: var(--accent);
}

.cal-month-cell.outside {
  opacity: 0.38;
}

.cal-month-cell-num {
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--muted);
}

.cal-month-cell.today .cal-month-cell-num {
  color: var(--accent);
}

.cal-day-empty {
  color: var(--muted);
  font-size: 0.78rem;
  margin: 2px 0 0;
}

.cal-chip {
  display: block;
  border-radius: 6px;
  padding: 3px 7px;
  margin-bottom: 4px;
  font-size: 0.72rem;
  line-height: 1.35;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
  border: 1px solid transparent;
}

/* Two colors only: amber = first posted on Kalshi, blue = the event day. */
.cal-chip.posted {
  background: color-mix(in srgb, var(--amber) 22%, var(--panel));
  border-color: var(--amber);
}

.cal-chip.event {
  background: color-mix(in srgb, var(--accent) 22%, var(--panel));
  border-color: var(--accent);
}

.cal-chip:hover,
.cal-chip:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 1px;
}

/* Phones get a vertical list grouped by day instead of the 7-column grid -
   same chip markup, built once in renderCalendarPage and shown/hidden
   here so there is only one source of truth. */
.cal-month-list {
  display: none;
}

@media (max-width: 700px) {
  .cal-month-grid-wrap { display: none; }
  .cal-month-list { display: block; }
}

.cal-list-day {
  padding: 8px 0;
  border-bottom: 1px solid var(--panel-2);
}

.cal-list-day:first-child {
  padding-top: 0;
}

.cal-list-day.today .cal-list-day-head {
  color: var(--accent);
}

.cal-list-day-head {
  font-weight: 700;
  font-size: 0.78rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin: 0 0 6px;
}

.cal-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 0.74rem;
  margin: 14px 0 0;
}

.cal-legend-swatch {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 4px;
  flex-shrink: 0;
}

.cal-legend-swatch.posted {
  background: color-mix(in srgb, var(--amber) 22%, var(--panel));
  border: 1px solid var(--amber);
}

.cal-legend-swatch.event {
  background: color-mix(in srgb, var(--accent) 22%, var(--panel));
  border: 1px solid var(--accent);
}

.cal-legend-label {
  margin-right: 12px;
}

/* -- calendar detail popover (reuses the tile-modal overlay/backdrop, a
   smaller dialog) -- */

.cal-popover-dialog {
  max-width: 380px;
}

.cal-popover-title {
  margin: 0 28px 10px 0;
  font-size: 1.02rem;
}

.cal-popover-line {
  margin: 0 0 8px;
  font-size: 0.86rem;
  color: var(--text);
}

.cal-popover-jump-btn {
  margin-top: 6px;
  background: var(--panel-2);
  border: 1px solid var(--accent);
  color: var(--accent);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 0.82rem;
  cursor: pointer;
}

.cal-popover-jump-btn:hover,
.cal-popover-jump-btn:focus-visible {
  background: color-mix(in srgb, var(--accent) 16%, var(--panel-2));
  outline: none;
}

details.strategy {
  margin-top: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  background: var(--panel-2);
}

details.strategy summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 0.88rem;
}

details.strategy ul {
  margin: 10px 0 4px;
  padding-left: 20px;
}

details.strategy li {
  margin-bottom: 6px;
  font-size: 0.85rem;
  color: var(--muted);
}

/* -- live books -- */

.book-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 16px;
}

.book-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  cursor: pointer;
}

.book-head:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
}

.book-head-quick {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

.book-head-floor {
  font-weight: 700;
}

.chevron {
  width: 0;
  height: 0;
  border-left: 5px solid transparent;
  border-right: 5px solid transparent;
  border-top: 6px solid var(--muted);
  flex-shrink: 0;
  transition: transform 0.15s ease;
}

.book-card.collapsed .chevron {
  transform: rotate(-90deg);
}

.book-head-title-wrap {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-right: auto;
  min-width: 0;
}

.book-head .title {
  font-size: 1.05rem;
  font-weight: 700;
}

.phase-badge {
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border: 1px solid var(--border);
}

.phase-badge.in-play {
  background: rgba(63, 185, 80, 0.15);
  color: var(--green);
  border-color: rgba(63, 185, 80, 0.4);
}

.phase-badge.pre-game {
  background: rgba(88, 166, 255, 0.15);
  color: var(--accent);
  border-color: rgba(88, 166, 255, 0.4);
}

.hb-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.hb-dot.ok { background: var(--green); }
.hb-dot.warn { background: var(--amber); }
.hb-dot.bad { background: var(--red); }

.book-meta {
  color: var(--muted);
  font-size: 0.82rem;
  margin-bottom: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
}

.heartbeat-stale-note {
  color: var(--amber);
  font-weight: 600;
}

.collected-block {
  margin: 4px 0 12px;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--panel-2);
  border: 1px solid var(--border);
}

.collected-main {
  font-size: 1.15rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.collected-margin {
  font-size: 0.88rem;
  font-weight: 600;
  margin-top: 4px;
}

.collected-margin.pending {
  color: var(--muted);
  font-weight: 400;
  font-style: italic;
}

.collected-contracts {
  color: var(--muted);
  font-size: 0.78rem;
  margin-top: 4px;
}

.outlook-block {
  margin: 10px 0;
  font-size: 0.82rem;
}

.outlook-line {
  margin-bottom: 4px;
}

.outlook-line.pending {
  color: var(--muted);
  font-style: italic;
}

/* 2026-09-28: activity watchdog + floor mode (house21/activity.py,
   house21/ingame.py's floor-mode functions), passed through by the
   publisher straight from the bot's own heartbeat.json. */
.activity-block {
  margin: 0 0 12px;
}

.floor-mode-banner {
  padding: 6px 12px;
  border-radius: 8px;
  background: rgba(63, 185, 80, 0.12);
  border: 1px solid var(--green);
  color: var(--green);
  font-size: 0.88rem;
  font-weight: 700;
  margin-bottom: 6px;
}

.activity-stats {
  color: var(--muted);
  font-size: 0.78rem;
}

.activity-cause {
  color: var(--amber);
  font-size: 0.82rem;
  font-weight: 600;
  margin-top: 2px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

thead th {
  text-align: left;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
}

tbody td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--panel-2);
  font-variant-numeric: tabular-nums;
}

tbody tr.zero-row {
  opacity: 0.55;
}

tfoot td {
  padding: 8px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.8rem;
}

.table-scroll {
  overflow-x: auto;
}

.show-more-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--accent);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 0.8rem;
  margin-top: 8px;
  cursor: pointer;
}

.fills-details {
  margin-top: 10px;
}

.fills-details > summary {
  cursor: pointer;
  color: var(--accent);
  font-size: 0.85rem;
}

.fills-details .table-scroll {
  margin-top: 8px;
}

.fills-summary-line {
  color: var(--muted);
  font-size: 0.78rem;
  margin: 8px 0 0;
}

.side-sell { color: var(--green); }
.side-buyback { color: var(--red); }

/* -- live book tiles (Blake 2026-10-02: a laptop-fitting tile grid
   instead of stacked collapsible cards, used by both the sport pages and
   Home - Home mixes every sport's live books in one grid, tagged per
   tile via .sport-tag.

   2026-10-02 revision (Blake): content integrity wins over forcing a
   fixed height. Tiles are sized to their own content (auto height), never
   clipped and never shrunk below a readable floor - the old
   `height: calc((100vh - var(--tiles-chrome))/2)` formula measured the
   grid's offsetTop to guess "everything above it", which works on a sport
   page (h2 right above the grid) but is wrong on Home, where the grid sits
   far down the page below the stat tiles / chart / calendar - that pushed
   --tiles-chrome to a huge number, collapsing the formula toward its
   240px min-height floor and squeezing all 7 outcome rows into a tiny
   scrollable sliver. Tiles now simply grow to fit their content; a modest
   font-size scale-down between 1100 and 1500px width (see
   .book-tile-outcome-row below) is what keeps 2 rows x 4 columns of full
   NFL tiles fitting a 1440x900 laptop with no scrolling - a shorter
   viewport (1280x800 and below) is allowed to scroll a little instead of
   clipping anything. --tiles-chrome/remeasureTilesChrome are gone. -- */

.book-tile-grid-wrap {
  margin-bottom: 24px;
}

.book-tile-grid {
  display: grid;
  /* minmax(0, ...) not plain 1fr: with an auto minimum the single phone
     column grows to the tile's intrinsic width, which the outcome rows'
     fr tracks inflate to ~480px, and the whole page scrolled sideways
     (Blake 2026-10-08). */
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}

@media (min-width: 700px) {
  .book-tile-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1100px) {
  .book-tile-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.book-tile {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow: visible;
  text-align: left;
  height: auto;
  min-height: 0;
  min-width: 0;
}

.book-tile:hover,
.book-tile:focus-visible {
  border-color: var(--accent);
  outline: none;
}

.book-tile.in-play {
  border-color: rgba(63, 185, 80, 0.5);
  box-shadow: 0 0 0 1px rgba(63, 185, 80, 0.15) inset;
}

.book-tile-row1 {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
}

.book-tile-title-wrap {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-right: auto;
  overflow: hidden;
  min-width: 0;
}

.book-tile-title {
  font-size: 0.85rem;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Short secondary label under/beside a tile's title - only sports whose
   data carries one show it (UFC: "Method of victory"); every other
   sport's tile is unchanged. */
.book-tile-subtitle {
  font-size: 0.72rem;
  font-weight: 400;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Minimize control (Blake 2026-10-02): a small chevron in the tile header
   that collapses the tile to just its header (title/phase/floor/premium -
   row1 + row2), remembered per book via getTileMinimizedPref/
   setTileMinimizedPref (same localStorage pattern as the sport-page
   book-card's getCardCollapsedPref, under its own key so minimizing a
   tile never collapses that book's full-card modal). Sits inside row1,
   stops click propagation so it never opens the tile's modal. */
.book-tile-min-btn {
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--panel-2);
  color: var(--muted);
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}

.book-tile-min-btn:hover,
.book-tile-min-btn:focus-visible {
  color: var(--text);
  border-color: var(--accent);
  outline: none;
}

.book-tile.minimized .book-tile-outcome-strip,
.book-tile.minimized .book-tile-row4 {
  display: none;
}

.book-tile-row2 {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  flex: 0 0 auto;
}

.book-tile-floor {
  font-size: 1.15rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.book-tile-floor-label {
  color: var(--muted);
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-weight: 600;
  margin-left: 4px;
}

.book-tile-row2-small {
  color: var(--muted);
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

.book-tile-outcome-strip {
  flex: 1 1 auto;
  min-height: 0;
  /* Content integrity wins (Blake 2026-10-02): never scrolls or clips its
     own rows - a tile grows to fit all 7 instead. See the .book-tile
     comment above for the full story on why the old fixed-height formula
     made this strip scroll internally and look "tiny". */
  overflow: visible;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 13px;
  line-height: 1.5;
}

/* Modest, readable-floor font scale-down only in the laptop band where
   4 columns x 2 rows of full NFL tiles need to fit 1440x900 with no
   scrolling (Blake 2026-10-02). clamp()'s own floor keeps every outcome
   row >= 12px at every width in this band; below 1100px the grid is only
   1-2 columns wide so there is no pressure and the row stays at the base
   13px above; at/above ~1444px it settles back at 13px. */
@media (min-width: 1100px) and (max-width: 1500px) {
  .book-tile-outcome-strip {
    font-size: clamp(12px, 0.9vw, 13px);
  }
}

.book-tile-outcome-row {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) 0.6fr 0.6fr 0.9fr 0.6fr;
  gap: 4px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.book-tile-outcome-row .ol {
  overflow: hidden;
  text-overflow: ellipsis;
}

.book-tile-outcome-row .or,
.book-tile-outcome-row .oh,
.book-tile-outcome-row .oo,
.book-tile-outcome-row .op {
  text-align: right;
}

.book-tile-row4 {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.7rem;
  flex: 0 0 auto;
  white-space: nowrap;
  overflow: hidden;
}

.book-tile-row4 .book-tile-coverage-wrap {
  margin-left: auto;
  font-weight: 700;
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.book-tile-row4 .book-tile-coverage {
  font-weight: 700;
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
}
.book-tile-row4 .book-tile-coverage.pos { color: var(--green); }
.book-tile-row4 .book-tile-coverage.neg { color: var(--red); }
.book-tile-row4 .book-tile-coverage.none { color: var(--muted, #888); }
/* Blake 2026-10-19: posted book sum (sum of our asks over every outcome), white */
.book-tile-row4 .book-tile-booksum-slash { color: var(--muted, #888); font-weight: 400; }
.book-tile-row4 .book-tile-booksum { color: #fff; }

.book-tile-row4 .floor-mode-tag {
  background: rgba(63, 185, 80, 0.15);
  color: var(--green);
  border: 1px solid rgba(63, 185, 80, 0.4);
  border-radius: 999px;
  padding: 0 6px;
  font-weight: 700;
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* -- tile modal (reuses the full book-card markup) -- */

.tile-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(1, 4, 9, 0.72);
  z-index: 100;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 5vh 16px calc(5vh + env(safe-area-inset-bottom, 0px));
  overflow-y: auto;
}

.tile-modal-dialog {
  position: relative;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  max-width: 640px;
  width: 100%;
  padding: 16px;
  margin: auto;
}

.tile-modal-dialog .book-card {
  margin-bottom: 0;
}

.tile-modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 999px;
  width: 30px;
  height: 30px;
  font-size: 0.95rem;
  line-height: 1;
  cursor: pointer;
  z-index: 1;
}

.tile-modal-close:hover,
.tile-modal-close:focus-visible {
  border-color: var(--accent);
  color: var(--accent);
}

body.modal-open {
  overflow: hidden;
}

/* -- settled table -- */

#settled-table-wrap {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 4px 12px;
}

/* -- settled events are clickable everywhere they are listed (Blake,
   2026-10-05): the sport page's settled table, and the calendar's settled
   popover. Both open the same side-by-side modal (openSettledModal). -- */

tr.settled-row {
  cursor: pointer;
}

tr.settled-row:hover,
tr.settled-row:focus-visible {
  background: var(--panel-2);
}

tr.settled-row:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.settled-row-chevron {
  margin-left: 8px;
  color: var(--muted);
  font-size: 0.85rem;
}

.cal-popover-settled-btn {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  border-radius: 6px;
  padding: 6px 6px;
  margin: 0 0 4px;
  font: inherit;
  cursor: pointer;
}

.cal-popover-settled-btn:hover,
.cal-popover-settled-btn:focus-visible {
  background: var(--panel-2);
  outline: none;
}

/* -- settled event modal (same overlay/dialog shell as .tile-modal-*) -- */

.settled-modal-dialog {
  max-width: 760px;
}

.settled-modal-title {
  margin: 0 28px 4px 0;
  font-size: 1.15rem;
}

.settled-modal-sub {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 0.85rem;
}

.settled-modal-result {
  font-size: 1.6rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.settled-modal-table-heading {
  font-size: 0.95rem;
  margin: 0 0 8px;
}

.settled-modal-note {
  color: var(--muted);
  font-size: 0.8rem;
  margin: 0 0 8px;
}

tr.settled-side-winner {
  background: color-mix(in srgb, var(--green) 14%, transparent);
}

tr.settled-side-winner td:first-child {
  font-weight: 700;
}

@media (max-width: 480px) {
  .settled-modal-dialog {
    padding: 14px 12px;
  }

  .settled-modal-result {
    font-size: 1.35rem;
  }
}

/* -- states -- */

.state-msg {
  color: var(--muted);
  padding: 20px 0;
  text-align: center;
}

.state-msg.error {
  color: var(--red);
}

footer {
  color: var(--muted);
  font-size: 0.8rem;
  padding: 20px 0 40px;
  border-top: 1px solid var(--border);
}

[hidden] {
  display: none !important;
}

img {
  max-width: 100%;
}

/* -- game clock score line (Blake 2026-10-04) -- */

.phase-badge {
  white-space: nowrap;
}

.book-tile-score {
  color: var(--muted);
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
  margin-top: -2px;
}

/* -- live fills drawer (Blake 2026-10-04) -- */

.fills-toggle {
  position: fixed;
  right: 16px;
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  z-index: 40;
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 16px;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
}

.fills-toggle:hover,
.fills-toggle:focus-visible {
  border-color: var(--accent);
  outline: none;
}

body.fills-open .fills-toggle {
  display: none;
}

.fills-unread {
  display: inline-block;
  min-width: 20px;
  margin-left: 8px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--bg);
  font-size: 0.72rem;
  text-align: center;
}

.fills-backdrop {
  display: none;
}

.fills-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 340px;
  max-width: 100vw;
  z-index: 50;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border-left: 1px solid var(--border);
  transform: translateX(100%);
  visibility: hidden;
  transition: transform 0.2s ease, visibility 0s linear 0.2s;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}

body.fills-open .fills-drawer {
  transform: translateX(0);
  visibility: visible;
  transition: transform 0.2s ease, visibility 0s;
}

.fills-head {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 2px 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  flex: 0 0 auto;
}

.fills-head h2 {
  margin: 0;
  font-size: 1rem;
}

.fills-sub {
  color: var(--muted);
  font-size: 0.72rem;
  margin-right: auto;
}

.fills-close {
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 10px;
  font: inherit;
  font-size: 0.8rem;
  cursor: pointer;
}

.fills-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--border);
  flex: 0 0 auto;
}

.fills-chip {
  background: var(--panel-2);
  color: var(--muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px 10px;
  font: inherit;
  font-size: 0.75rem;
  cursor: pointer;
}

.fills-chip:hover,
.fills-chip:focus-visible {
  border-color: var(--accent);
  outline: none;
}

.fills-chip.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--bg);
  font-weight: 700;
}

.fills-list {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 4px 0;
}

.fills-empty {
  color: var(--muted);
  font-size: 0.85rem;
  padding: 12px 14px;
}

.fill-row {
  padding: 6px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 0.8rem;
  line-height: 1.3;
}

.fill-row-top,
.fill-row-main {
  display: flex;
  gap: 8px;
  align-items: baseline;
}

.fill-time {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  flex: 0 0 auto;
}

.fill-book {
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-right: auto;
  min-width: 0;
}

.fill-margin {
  flex: 0 0 auto;
  font-variant-numeric: tabular-nums;
  font-size: 0.72rem;
}

.fill-label {
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-right: auto;
  min-width: 0;
}

.fill-what {
  color: var(--green);
  flex: 0 0 auto;
  font-variant-numeric: tabular-nums;
}

.fill-row.buyback .fill-what {
  color: var(--amber);
}

.fill-row.fill-new {
  animation: fill-flash 2.5s ease-out;
}

@keyframes fill-flash {
  from { background: rgba(88, 166, 255, 0.35); }
  to { background: transparent; }
}

@media (min-width: 1100px) {
  /* Wide screens: the drawer takes a column on the right and the page
     shrinks to make room instead of sitting underneath it. */
  body.fills-open {
    padding-right: 340px;
  }
  body.fills-open .book-tile-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1800px) {
  body.fills-open .book-tile-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 1099px) {
  /* Narrow screens and phones: full-height overlay with a dimmed backdrop. */
  .fills-drawer {
    width: min(380px, 100vw);
  }
  body.fills-open .fills-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 45;
    background: rgba(1, 4, 9, 0.6);
  }
}

@media (prefers-reduced-motion: reduce) {
  .fills-drawer { transition: none; }
  .fill-row.fill-new { animation: none; }
}

.cal-month-cell .cal-chip {
  margin-bottom: 0;
}

/* -- finished books waiting for Kalshi to settle -- */
.awaiting-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}

.awaiting-card {
  background: var(--panel);
  border: 1px solid var(--amber);
  border-radius: 10px;
  padding: 12px 14px;
}

.awaiting-title {
  font-weight: 700;
  margin-bottom: 6px;
}

.awaiting-badge {
  background: color-mix(in srgb, var(--amber) 22%, var(--panel));
  color: var(--amber);
  border: 1px solid var(--amber);
}

.awaiting-big {
  font-size: 1.6rem;
  font-weight: 700;
  margin: 8px 0 2px;
}

.awaiting-sub {
  color: var(--muted);
  font-size: 0.8rem;
  margin-top: 2px;
}

tr.awaiting-row td {
  font-style: italic;
}

/* -- LIVE tab (2026-10-14, reworked 2026-10-15): a grid of the Home book tiles, each with its feed box right under it, see live.js -- */

#page-live {
  padding-bottom: 24px;
}

.lv-empty-state {
  color: var(--muted);
  padding: 24px 0;
}

.lv-banners {
  position: sticky;
  top: 140px; /* live.js sets the real value from the header's height */
  z-index: 15;
  max-height: 32vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}

.lv-banners:empty {
  margin-bottom: 0;
}

.lv-banners:not(:empty) {
  background: var(--bg);
  padding: 0 0 8px;
}

.lv-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px 8px 14px;
  border-radius: 10px;
  background: #2d1517; /* solid on purpose: the strip is sticky and page content scrolls under it */
  border: 1px solid rgba(248, 81, 73, 0.55);
  flex-shrink: 0;
}

.lv-banner-text {
  margin-right: auto;
  font-weight: 600;
  min-width: 0;
  overflow-wrap: anywhere;
}

.lv-banner-x {
  background: none;
  border: 0;
  color: var(--muted);
  font-size: 1.3rem;
  line-height: 1;
  padding: 2px 6px;
  cursor: pointer;
}

.lv-unit {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  scroll-margin-top: 150px;
}

/* Title bar used only when a unit has no Home tile (the fleet notes, or a
   book whose numbers have not arrived yet). Sized like a tile by live.js. */
.lv-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  align-content: flex-start;
  gap: 8px 10px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
}

.lv-title {
  font-size: 0.95rem;
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
}

.lv-sub {
  color: var(--muted);
  font-size: 0.78rem;
}

.lv-livepill {
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border: 1px solid var(--border);
  color: var(--muted);
}

.lv-livepill.is-live {
  background: rgba(63, 185, 80, 0.15);
  color: var(--green);
  border-color: rgba(63, 185, 80, 0.4);
}

/* The Home tile, reused as-is. Its minimize button is hidden here (the feed
   box underneath is sized to the full tile) and a tile minimized on Home
   still shows in full. */
.lv-tile-slot .book-tile {
  height: auto;
}

.lv-tile-slot .book-tile-min-btn {
  display: none;
}

.lv-tile-slot .book-tile.minimized .book-tile-outcome-strip {
  display: block;
}

.lv-tile-slot .book-tile.minimized .book-tile-row4 {
  display: flex;
}

.lv-tile-slot .book-tile.lv-tile-open {
  border-color: var(--accent);
}

/* Fills drop-down under a clicked tile */
.lv-fills {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 10px;
  max-height: 260px;
  overflow: auto;
  font-size: 0.8rem;
}

.lv-fills-head {
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 700;
}

.lv-fills .table-scroll {
  margin-top: 6px;
}

.lv-fills table {
  font-size: 0.72rem;
}

.lv-fills th,
.lv-fills td {
  padding: 4px 6px;
  white-space: nowrap;
}

/* buttons */

.lv-btn {
  font: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 7px 16px;
  border-radius: 999px;
  border: 1px solid rgba(88, 166, 255, 0.55);
  background: rgba(88, 166, 255, 0.18);
  color: var(--accent);
  cursor: pointer;
}

.lv-btn:hover:not(:disabled) {
  background: rgba(88, 166, 255, 0.28);
}

.lv-btn:disabled {
  opacity: 0.45;
  cursor: default;
}

.lv-btn-small {
  padding: 4px 12px;
}

.lv-btn-ghost {
  background: var(--panel);
  border-color: var(--border);
  color: var(--text);
}

.lv-btn-go {
  background: rgba(63, 185, 80, 0.18);
  border-color: rgba(63, 185, 80, 0.55);
  color: var(--green);
}

.lv-link {
  background: none;
  border: 0;
  padding: 0 2px;
  font: inherit;
  font-size: 0.78rem;
  color: var(--accent);
  text-decoration: underline;
  cursor: pointer;
}

.lv-reddot {
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-left: 8px;
  border-radius: 50%;
  background: var(--red);
  vertical-align: middle;
}

/* plan card */

.lv-plan {
  background: var(--panel);
  padding: 10px 12px;
}

.lv-plan-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
}

.lv-plan-age {
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
}

.lv-plan-headline {
  font-size: 0.95rem;
  margin: 6px 0 10px;
  overflow-wrap: anywhere;
}

.lv-plan-chips {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.lv-plan-checks {
  color: var(--muted);
  font-size: 0.8rem;
}

.lv-conf-note {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.lv-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 1px 9px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  border: 1px solid var(--border);
  background: var(--panel-2);
  color: var(--muted);
  white-space: nowrap;
}

.lv-chip-phase {
  color: var(--accent);
  border-color: rgba(88, 166, 255, 0.4);
  background: rgba(88, 166, 255, 0.12);
}

.lv-conf-high { color: var(--green); border-color: rgba(63, 185, 80, 0.45); background: rgba(63, 185, 80, 0.12); }
.lv-conf-medium { color: var(--amber); border-color: rgba(210, 153, 34, 0.45); background: rgba(210, 153, 34, 0.12); }
.lv-conf-low { color: var(--red); border-color: rgba(248, 81, 73, 0.45); background: rgba(248, 81, 73, 0.12); }

.lv-sections {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  margin-top: 10px;
}

.lv-sections-solo {
  margin-top: 0;
}

.lv-sec {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  min-width: 0;
}

.lv-sec h4,
.lv-steps h4 {
  margin: 0 0 6px;
  font-size: 0.8rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.lv-sec ul {
  margin: 0;
  padding-left: 18px;
  font-size: 0.88rem;
}

.lv-sec li {
  margin-bottom: 4px;
  overflow-wrap: anywhere;
}

.lv-steps {
  margin-top: 14px;
}

.lv-steps-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.lv-step {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 4px 12px;
  padding: 7px 0;
  border-top: 1px solid var(--border);
  font-size: 0.88rem;
}

.lv-step:first-child {
  border-top: 0;
}

.lv-step-when {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 2px 10px;
  align-items: baseline;
}

.lv-step-abs {
  font-weight: 600;
}

.lv-cd {
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  font-size: 0.82rem;
}

.lv-step-what {
  overflow-wrap: anywhere;
}

.lv-step-detail {
  color: var(--muted);
}

/* Next move per side (top of the Plan panel) */

.lv-moves {
  margin: 8px 0 12px;
}

.lv-moves h4 {
  margin: 0 0 6px;
  font-size: 0.8rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.lv-moves-scroll {
  overflow-x: auto;
}

.lv-moves-tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.lv-moves-tbl th {
  padding: 4px 8px;
  text-align: left;
  color: var(--muted);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.lv-moves-tbl td {
  padding: 6px 8px;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--border);
  overflow-wrap: anywhere;
}

.lv-moves-tbl .num {
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.lv-mv-side {
  font-weight: 600;
  min-width: 84px;
}

.lv-mv-rest {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.lv-mv-neg { color: var(--red); font-weight: 600; }
.lv-mv-pos { color: var(--green); }

.lv-mv-stuck {
  display: inline-block;
  margin-left: 6px;
  padding: 0 6px;
  border-radius: 999px;
  border: 1px solid rgba(210, 153, 34, 0.55);
  background: rgba(210, 153, 34, 0.14);
  color: var(--amber);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  vertical-align: 1px;
}

.lv-mv-also {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.74rem;
}

.lv-mv-note {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.76rem;
}

/* Narrow boxes (phones, small tiles): each side becomes a small stacked card */
@container (max-width: 560px) {
  .lv-moves-tbl thead { display: none; }
  .lv-moves-tbl,
  .lv-moves-tbl tbody { display: block; }
  .lv-moves-tbl tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 1px 10px;
    padding: 6px 0;
    border-bottom: 1px solid var(--border);
    line-height: 1.3;
  }
  .lv-moves-tbl td { display: block; padding: 0; border: 0; min-width: 0; }
  .lv-moves-tbl td.lv-mv-side { grid-column: 1; grid-row: 1; min-width: 0; }
  .lv-moves-tbl td.lv-mv-exp { grid-column: 2; grid-row: 1; }
  .lv-moves-tbl td.lv-mv-rest,
  .lv-moves-tbl td.lv-mv-move,
  .lv-moves-tbl td.lv-mv-when { grid-column: 1 / -1; white-space: normal; }
  .lv-moves-tbl td.lv-mv-rest { color: var(--muted); font-size: 0.76rem; }
  .lv-moves-tbl td.lv-mv-rest::before { content: "Resting "; }
  .lv-moves-tbl td.lv-mv-move { font-weight: 600; }
}

.lv-sides-scroll {
  margin-top: 14px;
  overflow-x: auto;
}

.lv-sides {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.lv-sides th,
.lv-sides td {
  padding: 5px 8px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.lv-sides th {
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.lv-sides .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.lv-side-status {
  text-transform: capitalize;
}

.lv-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  margin-right: 6px;
  background: var(--muted);
}

.lv-dot-even { background: var(--green); }
.lv-dot-lagging { background: var(--amber); }
.lv-dot-heavy { background: var(--red); }

/* feed */

/* The feed box: same width as the tile above it; live.js sets its height
   to the tile's height. Header bar on top, scrolling feed in the middle,
   one-line chat row pinned at the bottom. Plan text and audit alerts open
   as panels over the feed area. */

.lv-box {
  display: flex;
  flex-direction: column;
  height: 300px;
  min-height: 0;
  min-width: 0;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  container-type: inline-size;
}

.lv-bar {
  flex: 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  border-bottom: 1px solid var(--border);
}

.lv-bar-title {
  margin-right: auto;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.lv-btn-tiny {
  padding: 2px 10px;
  font-size: 0.74rem;
}

/* Narrow boxes (phones, small tiles): drop the "Live feed" label so the five
   buttons fit on one row and the feed keeps its height. */
@container (max-width: 420px) {
  .lv-bar { gap: 3px; padding: 5px 6px; }
  .lv-bar-title { display: none; }
  .lv-bar .lv-btn-tiny { padding: 2px 6px; font-size: 0.7rem; }
  .lv-bar .lv-btn-tiny:first-of-type { margin-left: auto; }
}

.lv-btn-ghost.is-on {
  border-color: var(--accent);
  color: var(--accent);
}

.lv-box-body {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
}

.lv-plan,
.lv-drawer {
  position: absolute;
  inset: 0;
  z-index: 2;
  overflow: auto;
  overscroll-behavior: contain;
  background: var(--panel);
}

.lv-drawer {
  padding: 4px 12px;
}

.lv-audit {
  padding: 8px 0 8px 10px;
  border-left: 3px solid var(--border);
  margin: 6px 0;
  font-size: 0.88rem;
}

.lv-audit-warn { border-left-color: var(--amber); }
.lv-audit-critical { border-left-color: var(--red); }

.lv-audit-head {
  display: flex;
  gap: 8px;
  color: var(--muted);
  font-size: 0.75rem;
}

.lv-audit-body {
  overflow-wrap: anywhere;
}

.lv-feedwrap {
  position: absolute;
  inset: 0;
}

.lv-feed {
  height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 8px 10px;
}

.lv-empty {
  color: var(--muted);
  font-size: 0.88rem;
  padding: 8px 0;
}

.lv-newpill {
  position: absolute;
  left: 50%;
  bottom: 12px;
  transform: translateX(-50%);
  padding: 6px 16px;
  border-radius: 999px;
  border: 1px solid rgba(88, 166, 255, 0.6);
  background: var(--accent);
  color: var(--bg);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.lv-row {
  margin: 0 0 8px;
}

.lv-item {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr);
  gap: 10px;
  padding: 4px 0 4px 8px;
  border-left: 3px solid transparent;
  font-size: 0.9rem;
}

.lv-time {
  color: var(--muted);
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
  padding-top: 2px;
}

.lv-item-body {
  min-width: 0;
  overflow-wrap: anywhere;
}

.lv-item-title {
  margin-right: 6px;
}

.lv-k-update { border-left-color: var(--border); }

.lv-k-status {
  color: var(--muted);
  font-size: 0.82rem;
}

.lv-k-text { border-left-color: rgba(88, 166, 255, 0.5); }

.lv-k-plan {
  background: rgba(210, 153, 34, 0.1);
  border-left-color: var(--amber);
  border-radius: 6px;
  padding: 6px 8px;
}

.lv-k-action {
  border-left-color: var(--accent);
  background: rgba(88, 166, 255, 0.08);
  border-radius: 6px;
  padding: 6px 8px;
}

.lv-sev-warn { border-left-color: var(--amber); color: var(--amber); }
.lv-sev-critical { border-left-color: var(--red); color: var(--red); font-weight: 600; }
.lv-sev-warn .lv-time, .lv-sev-critical .lv-time { color: var(--muted); font-weight: 400; }

.lv-tag {
  display: inline-block;
  margin-right: 6px;
  padding: 0 7px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border: 1px solid var(--border);
  color: var(--muted);
}

.lv-tag-plan { color: var(--amber); border-color: rgba(210, 153, 34, 0.5); }
.lv-tag-action { color: var(--accent); border-color: rgba(88, 166, 255, 0.5); }
.lv-tag-warn { color: var(--amber); border-color: rgba(210, 153, 34, 0.5); }
.lv-tag-critical { color: var(--red); border-color: rgba(248, 81, 73, 0.5); }

/* chat bubbles */

.lv-row-in,
.lv-row-out {
  display: flex;
}

.lv-row-in { justify-content: flex-end; }

.lv-bubble {
  max-width: 85%;
  padding: 8px 12px;
  border-radius: 14px;
  font-size: 0.9rem;
  overflow-wrap: anywhere;
}

.lv-bubble-in {
  background: rgba(88, 166, 255, 0.2);
  border: 1px solid rgba(88, 166, 255, 0.45);
  border-bottom-right-radius: 4px;
}

.lv-bubble-out {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}

.lv-bubble-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.lv-who {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.lv-bubble-text {
  white-space: pre-wrap;
}

.lv-bubble-meta {
  margin-top: 4px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 0.72rem;
  color: var(--muted);
}

.lv-hint {
  margin-top: 6px;
  font-size: 0.78rem;
  color: var(--amber);
}

.lv-chip-received { color: var(--muted); }
.lv-chip-working { color: var(--accent); border-color: rgba(88, 166, 255, 0.4); }
.lv-chip-answer { color: var(--green); border-color: rgba(63, 185, 80, 0.4); }
.lv-chip-proposal { color: var(--amber); border-color: rgba(210, 153, 34, 0.5); }
.lv-chip-done { color: var(--green); border-color: rgba(63, 185, 80, 0.4); background: rgba(63, 185, 80, 0.12); }
.lv-chip-error { color: var(--red); border-color: rgba(248, 81, 73, 0.45); }
.lv-chip-cancelled { color: var(--muted); }

.lv-spin {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 2px solid rgba(88, 166, 255, 0.3);
  border-top-color: var(--accent);
  animation: lv-spin 0.8s linear infinite;
}

@keyframes lv-spin {
  to { transform: rotate(360deg); }
}

.lv-proposal {
  margin-top: 8px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--bg);
  border: 1px solid rgba(210, 153, 34, 0.5);
}

.lv-prop-summary {
  font-weight: 700;
  margin-bottom: 4px;
}

.lv-prop-steps {
  margin: 4px 0;
  padding-left: 20px;
}

.lv-prop-risk {
  margin: 6px 0;
  color: var(--amber);
  font-size: 0.85rem;
}

.lv-prop-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.lv-prop-done {
  font-size: 0.8rem;
  color: var(--muted);
}

/* chat box */

.lv-chat {
  position: relative;
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 6px 8px;
  border-top: 1px solid var(--border);
}

.lv-chat-line {
  display: flex;
  align-items: center;
  gap: 6px;
}

.lv-chat-input {
  display: block;
  flex: 1 1 auto;
  min-width: 0;
  height: 34px;
  font: inherit;
  font-size: 16px; /* 16px keeps iPhones from zooming in on focus */
  line-height: 20px;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
  resize: none;
  overflow: hidden;
}

.lv-chat-input:focus-visible,
.lv-pass input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.lv-pass {
  /* floats over the bottom of the feed so asking for the passcode never squeezes the feed to nothing */
  position: absolute;
  left: 0;
  right: 0;
  bottom: 100%;
  z-index: 3;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 6px 10px;
  padding: 8px;
  background: var(--panel-2);
  border-top: 1px solid var(--border);
}

.lv-pass label {
  display: block;
  flex: 1 1 220px;
  min-width: 0;
  font-size: 0.8rem;
  color: var(--muted);
}

.lv-pass input {
  display: block;
  width: 100%;
  margin-top: 6px;
  font: inherit;
  font-size: 16px;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 7px 10px;
}

.lv-pass-msg {
  flex-basis: 100%;
  color: var(--red);
  font-size: 0.8rem;
}

.lv-pass-msg:empty {
  display: none;
}

@media (max-width: 600px) {
  .lv-item { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .lv-time { padding-top: 0; }
  .lv-step { grid-template-columns: minmax(0, 1fr); }
  .lv-step-when { flex-direction: row; gap: 10px; align-items: baseline; flex-wrap: wrap; }
  .lv-bubble { max-width: 94%; }
  .lv-sides { font-size: 0.8rem; }
  .lv-sides th, .lv-sides td { padding: 5px 4px; }
  .lv-sides td:first-child { white-space: normal; min-width: 70px; }
  .lv-dot { margin-right: 4px; }
}

/* Feed rows sit in a narrow box, so the time stacks above the text */
.lv-box .lv-item { grid-template-columns: minmax(0, 1fr); gap: 0; font-size: 0.85rem; }
.lv-box .lv-time { padding-top: 0; }
.lv-box .lv-bubble { max-width: 94%; }

/* LIVE tab: hide the floating Live fills button so it never covers a chat box */
body.on-live .fills-toggle {
  display: none;
}
