/**
 * Fhorsite shared UI — theme tokens, component rhythm, mobile layout.
 * Scoped to daily race table, race detail, sire insights, tracker, P&L, and picks pages.
 */

:root {
  --fhor-bg: #f1f5f9;
  --fhor-surface: #ffffff;
  --fhor-surface-muted: #f8fafc;
  --fhor-ink: #0f172a;
  --fhor-ink-muted: #64748b;
  --fhor-border: #e2e8f0;
  --fhor-primary: #2563eb;
  --fhor-primary-strong: #1d4ed8;
  --fhor-accent: #059669;
  --fhor-danger: #dc2626;
  --fhor-radius: 14px;
  --fhor-radius-sm: 10px;
  --fhor-shadow: 0 4px 18px rgba(15, 23, 42, 0.08);
  --fhor-shadow-soft: 0 2px 8px rgba(15, 23, 42, 0.06);
  --fhor-gap: 16px;
  --fhor-gap-lg: 20px;
  --fhor-pad: 16px;
  --fhor-pad-lg: 24px;
  --fhor-transition: 220ms cubic-bezier(0.22, 1, 0.36, 1);
  --fhor-fab-clearance: 72px;
}

/* -------------------------------------------------------------------------- */
/* Page shells                                                                */
/* -------------------------------------------------------------------------- */

.race-detail-page-shell,
.race-table-wrapper,
.race-detail-container {
  box-sizing: border-box;
  max-width: 100%;
}

.race-detail-page-shell {
  overflow-x: clip;
  background: var(--fhor-bg);
  padding: 12px 12px calc(24px + var(--fhor-fab-clearance));
}

.race-detail-page-shell .race-detail-container {
  padding: 0;
  margin: 0 auto;
}

.race-detail-page-shell .back-button-container,
.race-detail-page-shell .race-quick-nav {
  padding-left: 0;
  padding-right: 0;
  margin-bottom: var(--fhor-gap);
  max-width: none;
}

/* Shared card surface used across daily + detail */
.race-table-wrapper,
.race-quick-nav,
.runners-card,
.race-header-card,
.fhor-panel,
.cpc,
.pace-map {
  transition: box-shadow var(--fhor-transition), transform var(--fhor-transition), border-color var(--fhor-transition);
}

.race-table-wrapper,
.race-quick-nav,
.runners-card,
.fhor-panel {
  background: var(--fhor-surface);
  border: 1px solid var(--fhor-border);
  border-radius: var(--fhor-radius);
  box-shadow: var(--fhor-shadow-soft);
}

.fhor-panel {
  margin-top: var(--fhor-gap-lg);
  padding: var(--fhor-pad-lg);
  overflow: hidden;
}

.fhor-panel + .fhor-panel {
  margin-top: var(--fhor-gap);
}

.fhor-panel__title {
  color: var(--fhor-ink);
  margin: 0 0 16px;
  text-align: center;
  font-size: clamp(1.05rem, 3.6vw, 1.4rem);
  font-weight: 800;
  letter-spacing: -0.01em;
  line-height: 1.25;
}

.fhor-panel__hint {
  text-align: center;
  margin: 0 0 12px;
  font-size: 12px;
  color: var(--fhor-ink-muted);
  font-style: italic;
}

.fhor-chart-box {
  position: relative;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  margin: 12px 0 0;
  padding: 12px;
  background: linear-gradient(180deg, var(--fhor-surface-muted) 0%, #fff 100%);
  border: 1px solid var(--fhor-border);
  border-radius: var(--fhor-radius-sm);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.fhor-chart-box > canvas {
  display: block;
  width: 100% !important;
  max-width: none;
}

.fhor-chart-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--fhor-gap);
  margin: 12px 0 0;
  width: 100%;
}

.fhor-chart-card {
  background: var(--fhor-surface-muted);
  border: 1px solid var(--fhor-border);
  border-radius: var(--fhor-radius-sm);
  padding: 14px;
  min-width: 0;
}

.fhor-chart-card h3 {
  color: var(--fhor-ink);
  margin: 0 0 12px;
  text-align: center;
  font-size: 15px;
  font-weight: 700;
}

.fhor-chart-card__canvas {
  position: relative;
  height: 320px;
  width: 100%;
  max-width: 100%;
}

.fhor-legend-row {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px 18px;
  margin-top: 14px;
  padding: 12px;
  background: var(--fhor-surface-muted);
  border-radius: var(--fhor-radius-sm);
  border: 1px solid var(--fhor-border);
}

.fhor-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  color: #374151;
}

.fhor-legend-swatch {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  flex-shrink: 0;
}

/* -------------------------------------------------------------------------- */
/* Daily race table                                                           */
/* -------------------------------------------------------------------------- */

.race-table-wrapper {
  padding: var(--fhor-pad-lg);
  margin-bottom: calc(24px + var(--fhor-fab-clearance));
  overflow-x: hidden;
}

.race-filters,
.race-date-tabs {
  background: var(--fhor-surface-muted);
  border: 1px solid var(--fhor-border);
  border-radius: var(--fhor-radius-sm);
}

.race-date-tabs {
  display: flex;
  flex-direction: row;
  gap: 8px;
}

.race-date-tab {
  flex: 1;
  min-width: 0;
  transition: background var(--fhor-transition), border-color var(--fhor-transition), transform var(--fhor-transition), box-shadow var(--fhor-transition);
}

#race-table-container {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--fhor-radius-sm);
  border: 1px solid var(--fhor-border);
  background: var(--fhor-surface);
}

/* -------------------------------------------------------------------------- */
/* Race detail header / nav                                                   */
/* -------------------------------------------------------------------------- */

.back-button {
  width: auto;
  max-width: 100%;
}

.race-quick-nav {
  overflow: visible;
}

.race-quick-nav-times {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 4px;
  scrollbar-width: thin;
  max-width: 100%;
}

.race-time-slot {
  flex: 0 0 auto;
  white-space: nowrap;
}

.course-selector-wrapper {
  width: 100%;
  max-width: 100%;
}

.course-dropdown {
  width: 100%;
  max-width: min(100vw - 24px, 420px);
  z-index: 1200;
}

.race-header-card {
  margin-bottom: var(--fhor-gap-lg);
}

.race-title {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.race-details-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.race-detail-item {
  min-width: 0;
  align-items: flex-start;
}

.race-detail-value {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.runners-card {
  overflow: hidden;
}

.runners-header {
  padding: var(--fhor-pad);
}

.fhor-picks {
  margin: 0 var(--fhor-pad) var(--fhor-pad);
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  border: 1px solid #93c5fd;
  border-radius: var(--fhor-radius-sm);
  padding: 12px 14px;
}

.fhor-picks__title {
  font-weight: 800;
  color: #1e3a8a;
  font-size: 13px;
  margin: 0 0 8px;
}

.fhor-picks__list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 12px;
  line-height: 1.4;
}

.fhor-picks__chip {
  background: #fff;
  border: 1px solid #bfdbfe;
  border-radius: 999px;
  padding: 6px 10px;
  color: #1e40af;
  font-weight: 700;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.fhor-picks__chip--ew-simple {
  background: #fff7ed;
  border-color: #fdba74;
  color: #9a3412;
}

.fhor-picks__chip--ew-edge {
  background: #f5f3ff;
  border-color: #c4b5fd;
  color: #5b21b6;
}

.runners-table-wrapper {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.lin5-legend {
  margin: 8px 12px 14px;
  padding: 12px;
  font-size: 12px;
  color: var(--fhor-ink-muted);
  line-height: 1.5;
  background: var(--fhor-surface);
  border: 1px solid var(--fhor-border);
  border-radius: var(--fhor-radius-sm);
}

/* Expanded runner details — stay in viewport while table scrolls */
.details-row > td {
  padding: 12px !important;
  vertical-align: top;
}

.runner-sr-history {
  background: var(--fhor-surface);
  border: 1px solid var(--fhor-border);
  border-radius: var(--fhor-radius-sm);
  padding: 14px;
  box-shadow: var(--fhor-shadow-soft);
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
}

.details-row > td {
  position: sticky;
  left: 0;
  z-index: 2;
  background: rgba(239, 246, 255, 0.95);
  backdrop-filter: blur(4px);
}

.runner-sr-history__title {
  margin: 0 0 12px;
  color: var(--fhor-ink);
  font-size: 15px;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.runner-sr-history__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(148px, 1fr));
  gap: 10px;
}

.runner-sr-card {
  background: var(--fhor-surface-muted);
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--fhor-border);
  border-left-width: 4px;
  border-left-style: solid;
  min-width: 0;
}

.runner-sr-card__label {
  font-size: 10px;
  color: var(--fhor-ink-muted);
  font-weight: 700;
  text-transform: uppercase;
  margin-bottom: 6px;
  letter-spacing: 0.04em;
}

.runner-sr-card__row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
  font-size: 12px;
}

.runner-sr-card__row:last-child {
  margin-bottom: 0;
}

.runner-sr-card__key {
  color: #64748b;
  flex-shrink: 0;
}

.runner-sr-card__val {
  font-weight: 700;
  color: #059669;
  text-align: right;
  overflow-wrap: anywhere;
}

.runner-sr-history__meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(148px, 1fr));
  gap: 10px;
  margin-top: 10px;
}

/* Pace / CPC sit in the same visual rhythm */
.race-detail-page-shell .cpc,
.race-detail-page-shell .pace-map {
  margin-top: var(--fhor-gap);
  margin-bottom: var(--fhor-gap);
}

.race-detail-page-shell .cpc-wrap,
.race-detail-page-shell .pace-map {
  border-radius: var(--fhor-radius);
  box-shadow: var(--fhor-shadow-soft);
}

/* -------------------------------------------------------------------------- */
/* Floating quick links — collapse on small screens                           */
/* -------------------------------------------------------------------------- */

.fhor-fab {
  position: fixed;
  right: 14px;
  bottom: 14px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  font-family: inherit;
}

.fhor-fab__links {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-end;
}

.fhor-fab__link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 999px;
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  text-decoration: none;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.22);
  white-space: nowrap;
  transition: transform var(--fhor-transition), box-shadow var(--fhor-transition), opacity var(--fhor-transition);
}

.fhor-fab__link:hover {
  transform: translateY(-1px);
  color: #fff;
}

.fhor-fab__link--tracker { background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%); }
.fhor-fab__link--picks { background: linear-gradient(135deg, #0f766e 0%, #115e59 100%); }
.fhor-fab__link--backtest { background: linear-gradient(135deg, #1d4ed8 0%, #1e40af 100%); }
.fhor-fab__link--sires { background: linear-gradient(135deg, #059669 0%, #047857 100%); }
.fhor-fab__link--admin { background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%); }

.fhor-fab__toggle {
  display: none;
  width: 52px;
  height: 52px;
  border: none;
  border-radius: 50%;
  background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
  color: #fff;
  font-size: 22px;
  cursor: pointer;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.28);
  align-items: center;
  justify-content: center;
  transition: transform var(--fhor-transition), background var(--fhor-transition);
}

.fhor-fab__toggle:hover,
.fhor-fab__toggle:focus-visible {
  transform: scale(1.04);
  outline: none;
}

.fhor-fab.is-open .fhor-fab__toggle {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
}

/* -------------------------------------------------------------------------- */
/* Mobile                                                                     */
/* -------------------------------------------------------------------------- */

@media (max-width: 900px) {
  .fhor-chart-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  :root {
    --fhor-pad: 12px;
    --fhor-pad-lg: 14px;
    --fhor-gap: 12px;
    --fhor-gap-lg: 14px;
  }

  .race-detail-page-shell {
    padding: 8px 8px calc(20px + var(--fhor-fab-clearance));
  }

  .race-table-wrapper {
    padding: 12px;
    border-radius: 12px;
  }

  .race-filters {
    grid-template-columns: 1fr 1fr !important;
    gap: 10px !important;
    padding: 12px !important;
  }

  .race-filters .filter-group:has(#race-country-filter),
  .race-filters .filter-group:has(#race-course-filter),
  .race-filters .filter-group:has(.race-reset-button),
  .race-filters > .race-reset-button,
  .race-filters .filter-group:last-child {
    grid-column: 1 / -1;
  }

  .race-date-tabs {
    flex-direction: row !important;
    padding: 8px !important;
  }

  .race-date-tab {
    padding: 10px 12px !important;
    font-size: 13px !important;
    width: auto !important;
  }

  .race-table {
    min-width: 720px !important;
  }

  .back-button-container {
    margin-bottom: 10px;
  }

  .back-button {
    width: 100%;
    justify-content: center;
    box-sizing: border-box;
  }

  .race-quick-nav-top {
    flex-direction: column;
    align-items: stretch !important;
    gap: 10px;
    padding: 12px !important;
  }

  .race-quick-nav-breadcrumb {
    margin-bottom: 0 !important;
  }

  .course-selector-btn {
    width: 100%;
    justify-content: space-between;
    box-sizing: border-box;
  }

  .course-dropdown {
    left: 0 !important;
    right: 0 !important;
    max-width: none;
    max-height: min(60vh, 420px);
  }

  .race-header-top,
  .race-header-bottom {
    padding: 14px !important;
  }

  .race-meta-time {
    font-size: 13px !important;
    letter-spacing: 0.02em;
    line-height: 1.35;
  }

  .race-title {
    font-size: 18px !important;
    margin-bottom: 12px !important;
  }

  .race-details-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 8px !important;
  }

  .race-detail-item {
    padding: 8px !important;
    gap: 8px !important;
  }

  .race-detail-icon {
    font-size: 16px !important;
  }

  .race-detail-label {
    font-size: 9px !important;
  }

  .race-detail-value {
    font-size: 12px !important;
  }

  .runners-title {
    font-size: 18px !important;
    flex-wrap: wrap;
  }

  .runners-subtitle {
    font-size: 12px !important;
  }

  .fhor-picks {
    margin-left: 12px;
    margin-right: 12px;
  }

  .fhor-picks__chip {
    border-radius: 10px;
    width: 100%;
    box-sizing: border-box;
  }

  .filter-controls {
    padding: 10px 12px !important;
  }

  .lin5-legend {
    margin: 8px;
    font-size: 11px;
  }

  .runner-sr-history__grid,
  .runner-sr-history__meta {
    grid-template-columns: 1fr 1fr;
  }

  .fhor-panel {
    padding: 14px 12px;
    border-radius: 12px;
  }

  .fhor-chart-box {
    padding: 8px;
  }

  .fhor-chart-card__canvas {
    height: 280px;
  }

  /* Collapsible FAB */
  .fhor-fab__toggle {
    display: inline-flex;
  }

  .fhor-fab__links {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    pointer-events: none;
    transform: translateY(8px);
    transition: max-height var(--fhor-transition), opacity var(--fhor-transition), transform var(--fhor-transition);
  }

  .fhor-fab.is-open .fhor-fab__links {
    max-height: 420px;
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
  }

  .fhor-fab__link {
    font-size: 12px;
    padding: 9px 12px;
  }
}

.runners-mobile-toolbar {
  display: none;
}

.runners-table .runner-cell {
  vertical-align: middle;
}

.runners-table tbody tr.details-row {
  display: none;
}

.runners-table tbody tr.details-row.is-open {
  display: table-row;
}

@media (max-width: 480px) {
  .race-filters {
    grid-template-columns: 1fr !important;
  }

  .race-details-grid {
    grid-template-columns: 1fr !important;
  }

  .runner-sr-history__grid,
  .runner-sr-history__meta {
    grid-template-columns: 1fr;
  }

  .race-meta-time {
    font-size: 12px !important;
  }

  .fhor-panel__title {
    font-size: 1.05rem;
  }

  .runners-table tbody tr.runner-row {
    padding: 10px;
    gap: 7px 10px;
  }

  .runners-mobile-toolbar {
    margin: 0 8px 10px;
  }
}

/* Prevent accidental page-wide horizontal scroll from nested min-widths */
@media (max-width: 768px) {
  .race-detail-container,
  .premium-ratings-container,
  .runners-card,
  .fhor-panel,
  .fhor-chart-grid,
  .fhor-chart-card {
    max-width: 100%;
    min-width: 0;
  }

  .runners-mobile-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 12px 12px;
    padding: 10px 12px;
    background: var(--fhor-surface-muted);
    border: 1px solid var(--fhor-border);
    border-radius: var(--fhor-radius-sm);
  }

  .runners-mobile-toolbar__label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--fhor-ink-muted);
    flex-shrink: 0;
  }

  .runners-mobile-toolbar__select {
    flex: 1;
    min-width: 0;
    padding: 10px 12px;
    border: 2px solid var(--fhor-border);
    border-radius: 8px;
    background: #fff;
    font-size: 16px;
    font-weight: 600;
    color: var(--fhor-ink);
    outline: none;
  }

  .runners-mobile-toolbar__select:focus {
    border-color: var(--fhor-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
  }

  .runners-table-wrapper {
    overflow: visible !important;
    padding: 0 8px 12px;
  }

  .runners-table,
  .runners-table thead,
  .runners-table tbody,
  .runners-table tr,
  .runners-table th,
  .runners-table td {
    display: block;
    width: 100%;
    max-width: 100%;
  }

  .runners-table {
    min-width: 0 !important;
    border: none !important;
    border-collapse: separate;
    border-spacing: 0;
  }

  .runners-table thead {
    display: none !important;
  }

  .runners-table tbody {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }

  .runners-table tbody tr.runner-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 12px;
    align-items: start;
    margin: 0;
    padding: 12px;
    background: var(--fhor-surface) !important;
    border: 1px solid var(--fhor-border) !important;
    border-radius: 12px;
    box-shadow: var(--fhor-shadow-soft);
    transition: box-shadow var(--fhor-transition), transform var(--fhor-transition), border-color var(--fhor-transition);
  }

  .runners-table tbody tr.runner-row:hover {
    background: var(--fhor-surface) !important;
    transform: none;
  }

  .runners-table tbody tr.runner-row.non-runner {
    border-left: 4px solid #2563eb !important;
    background: linear-gradient(135deg, #eff6ff 0%, #fff 55%) !important;
  }

  .runners-table tbody tr.runner-row.hidden,
  .runners-table tbody tr.details-row.hidden {
    display: none !important;
  }

  .runners-table tbody tr.runner-row td.runner-cell {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    padding: 0 !important;
    border: none !important;
    background: transparent !important;
    min-width: 0;
    font-size: 13px;
    line-height: 1.35;
  }

  .runners-table tbody tr.runner-row td.runner-cell::before {
    content: attr(data-label);
    flex: 0 0 auto;
    max-width: 46%;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--fhor-ink-muted);
  }

  .runners-table tbody tr.runner-row td.runner-cell > * {
    text-align: right;
    margin-left: auto;
  }

  .runners-table tbody tr.runner-row td.runner-cell--cloth {
    order: -30;
    grid-column: 1;
    justify-content: flex-start;
  }

  .runners-table tbody tr.runner-row td.runner-cell--cloth::before {
    display: none;
  }

  .runners-table tbody tr.runner-row td.runner-cell--cloth > * {
    margin-left: 0;
    text-align: left;
  }

  .runners-table tbody tr.runner-row td.runner-cell--details {
    order: -29;
    grid-column: 2;
    justify-content: flex-end;
  }

  .runners-table tbody tr.runner-row td.runner-cell--details::before {
    display: none;
  }

  .runners-table tbody tr.runner-row td.runner-cell--details > * {
    margin-left: 0;
  }

  .runners-table tbody tr.runner-row td.runner-cell--details .toggle-details-btn {
    width: auto;
    min-width: 84px;
    padding: 8px 12px !important;
  }

  .runners-table tbody tr.runner-row td.runner-cell--name {
    order: -28;
    grid-column: 1 / -1;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    padding-bottom: 8px !important;
    margin-bottom: 2px;
    border-bottom: 1px solid var(--fhor-border) !important;
  }

  .runners-table tbody tr.runner-row td.runner-cell--name::before {
    display: none;
  }

  .runners-table tbody tr.runner-row td.runner-cell--name > * {
    margin-left: 0;
    text-align: left;
    width: 100%;
  }

  .runners-table tbody tr.runner-row td.runner-cell--name .horse-name-link,
  .runners-table tbody tr.runner-row td.runner-cell--name > div:first-child {
    font-size: 16px !important;
    line-height: 1.25;
  }

  .runners-table tbody tr.runner-row td.runner-cell--primary {
    background: #f8fafc !important;
    border-radius: 8px;
    padding: 8px 10px !important;
  }

  .runners-table tbody tr.runner-row td.runner-cell--wide {
    grid-column: 1 / -1;
    align-items: flex-start;
  }

  .runners-table tbody tr.runner-row td.runner-cell--wide > * {
    text-align: right;
  }

  .runners-table tbody tr.details-row {
    display: none;
    margin: -4px 0 4px;
    padding: 0;
    background: transparent !important;
    border: none !important;
    box-shadow: none;
  }

  .runners-table tbody tr.details-row.is-open {
    display: block !important;
  }

  .runners-table tbody tr.details-row > td {
    display: block;
    position: static !important;
    left: auto !important;
    width: 100%;
    max-width: 100%;
    padding: 0 !important;
    border: none !important;
    background: transparent !important;
    backdrop-filter: none;
  }

  .runners-table tbody tr.details-row .runner-sr-history {
    border-radius: 12px;
  }

  .lin5-cell {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 4px;
    justify-content: flex-end;
    align-items: center;
  }
}

/* -------------------------------------------------------------------------- */
/* Daily race table — mobile cards                                            */
/* -------------------------------------------------------------------------- */

.race-filters-toggle,
.race-mobile-toolbar {
  display: none;
}

.race-table-scroll {
  width: 100%;
  max-width: 100%;
}

.race-class-badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 6px;
  background: #dbeafe;
  color: #1e40af;
  font-weight: 600;
  font-size: 11px;
}

.race-runners-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #eff6ff;
  color: #2563eb;
  font-weight: 700;
  font-size: 12px;
}

@media (max-width: 768px) {
  .race-table-wrapper {
    overflow-x: hidden !important;
  }

  .race-filters-toggle {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 10px;
    padding: 12px 14px;
    border: 1px solid var(--fhor-border);
    border-radius: var(--fhor-radius-sm);
    background: var(--fhor-surface-muted);
    color: var(--fhor-ink);
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
  }

  .race-filters-toggle__state {
    color: var(--fhor-primary);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
  }

  .race-table-wrapper > .race-filters {
    display: none;
    margin-bottom: 12px;
  }

  .race-table-wrapper > .race-filters.is-open {
    display: grid !important;
  }

  .race-mobile-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 12px;
    padding: 10px 12px;
    background: var(--fhor-surface-muted);
    border: 1px solid var(--fhor-border);
    border-radius: var(--fhor-radius-sm);
  }

  .race-mobile-toolbar__label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--fhor-ink-muted);
    flex-shrink: 0;
  }

  .race-mobile-toolbar__select {
    flex: 1;
    min-width: 0;
    padding: 10px 12px;
    border: 2px solid var(--fhor-border);
    border-radius: 8px;
    background: #fff;
    font-size: 16px;
    font-weight: 600;
    color: var(--fhor-ink);
  }

  #race-table-container {
    overflow: visible !important;
    border: none !important;
    background: transparent !important;
  }

  .race-table-scroll {
    overflow: visible;
  }

  .race-table,
  .race-table thead,
  .race-table tbody,
  .race-table tr,
  .race-table th,
  .race-table td {
    display: block;
    width: 100%;
    max-width: 100%;
  }

  .race-table {
    min-width: 0 !important;
    border: none !important;
    border-collapse: separate;
    border-spacing: 0;
  }

  .race-table thead {
    display: none !important;
  }

  .race-table tbody {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }

  .race-table tbody tr.race-course-header,
  .race-table tbody tr[data-course-header] {
    display: block;
    border-radius: 10px;
    overflow: hidden;
    margin-top: 4px;
  }

  .race-table tbody tr.race-course-header td,
  .race-table tbody tr[data-course-header] td {
    padding: 10px 12px !important;
    font-size: 13px !important;
  }

  .race-table tbody tr.race-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 12px;
    padding: 12px;
    background: var(--fhor-surface) !important;
    border: 1px solid var(--fhor-border) !important;
    border-radius: 12px;
    box-shadow: var(--fhor-shadow-soft);
  }

  .race-table tbody tr.race-row:hover {
    background: var(--fhor-surface) !important;
  }

  .race-table tbody tr.race-row td.race-cell {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    padding: 0 !important;
    border: none !important;
    min-width: 0;
    font-size: 13px;
  }

  .race-table tbody tr.race-row td.race-cell::before {
    content: attr(data-label);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--fhor-ink-muted);
    flex-shrink: 0;
  }

  .race-table tbody tr.race-row td.race-cell > * {
    margin-left: auto;
    text-align: right;
  }

  .race-table tbody tr.race-row td.race-cell--time {
    order: -20;
    grid-column: 1;
    justify-content: flex-start;
    font-size: 18px;
    color: var(--fhor-primary);
    font-weight: 700;
  }

  .race-table tbody tr.race-row td.race-cell--time::before {
    display: none;
  }

  .race-table tbody tr.race-row td.race-cell--runners {
    order: -19;
    grid-column: 2;
    justify-content: flex-end;
  }

  .race-table tbody tr.race-row td.race-cell--runners::before {
    display: none;
  }

  .race-table tbody tr.race-row td.race-cell--title {
    order: -18;
    grid-column: 1 / -1;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    padding-bottom: 8px !important;
    border-bottom: 1px solid var(--fhor-border) !important;
  }

  .race-table tbody tr.race-row td.race-cell--title::before {
    display: none;
  }

  .race-table tbody tr.race-row td.race-cell--title > * {
    margin-left: 0;
    text-align: left;
    width: 100%;
  }

  .race-table tbody tr.race-row td.race-cell--title .race-link {
    font-size: 15px;
    line-height: 1.3;
  }

  .race-table tbody tr.race-row td.race-cell--prize {
    grid-column: 1 / -1;
    background: #f0fdf4;
    border-radius: 8px;
    padding: 8px 10px !important;
    color: #059669;
    font-weight: 700;
  }

  .race-table tbody tr.race-row td.race-cell--dist,
  .race-table tbody tr.race-row td.race-cell--furlongs {
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  }
}

@media (max-width: 480px) {
  .race-table tbody tr.race-row {
    padding: 10px;
    gap: 7px 10px;
  }
}

/* -------------------------------------------------------------------------- */
/* Shared page chrome (daily sires, my tracker)                               */
/* -------------------------------------------------------------------------- */

.fhor-page-header h1,
.fhor-page-header h3 {
  margin: 0 0 6px;
  color: var(--fhor-ink);
  font-size: 24px;
  font-weight: 800;
}

.fhor-page-header p {
  margin: 0 0 16px;
  color: var(--fhor-ink-muted);
  font-size: 14px;
}

.fhor-btn {
  border: none;
  border-radius: var(--fhor-radius-sm);
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background var(--fhor-transition), color var(--fhor-transition), border-color var(--fhor-transition);
}

.fhor-btn--primary {
  background: var(--fhor-primary);
  color: #fff;
}

.fhor-btn--primary:hover {
  background: var(--fhor-primary-strong);
}

.fhor-btn--secondary {
  background: var(--fhor-surface-muted);
  color: var(--fhor-ink);
  border: 1px solid var(--fhor-border);
}

/* -------------------------------------------------------------------------- */
/* Daily Sire Insights                                                        */
/* -------------------------------------------------------------------------- */

.daily-sires-insights-wrapper {
  box-sizing: border-box;
  max-width: 100%;
  background: var(--fhor-surface);
  border: 1px solid var(--fhor-border);
  border-radius: var(--fhor-radius);
  box-shadow: var(--fhor-shadow-soft);
  padding: var(--fhor-pad-lg);
  margin: 0 auto;
}

.sire-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.sire-header-row h3 {
  margin: 0;
  color: var(--fhor-ink);
  font-size: 24px;
  font-weight: 800;
}

.sire-date-label {
  font-size: 12px;
  color: var(--fhor-ink-muted);
  font-weight: 600;
}

.sire-filters-toggle {
  display: none;
}

.sire-mobile-toolbar {
  display: none;
}

.sire-insights-filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.daily-sires-insights-wrapper .filter-group label {
  display: block;
  margin-bottom: 6px;
  color: var(--fhor-ink);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.sire-insights-filters select,
.sire-insights-filters input[type="date"] {
  width: 100%;
  border: 1px solid var(--fhor-border);
  border-radius: var(--fhor-radius-sm);
  background: var(--fhor-surface);
  color: var(--fhor-ink);
  padding: 9px 10px;
  font-size: 13px;
}

.sire-insights-filters select:focus,
.sire-insights-filters input[type="date"]:focus {
  outline: none;
  border-color: var(--fhor-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.sire-actions-row {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.sire-insights-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--fhor-border);
  border-radius: var(--fhor-radius-sm);
  background: var(--fhor-surface);
}

.sire-insights-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 960px;
}

.sire-insights-table th,
.sire-insights-table td {
  padding: 11px 12px;
  border-bottom: 1px solid #f3f4f6;
  text-align: left;
  vertical-align: middle;
}

.sire-insights-table thead th {
  background: var(--fhor-ink);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.sire-insights-table tbody tr:hover {
  background: var(--fhor-surface-muted);
}

.sire-insights-table .horse-name {
  font-weight: 700;
  color: var(--fhor-ink);
}

.sire-insights-table .sire-name {
  color: var(--fhor-ink);
  font-weight: 700;
}

.sire-insights-table .ta-right {
  text-align: right !important;
}

.sire-insights-table .sort-indicator {
  margin-left: 6px;
  opacity: 0.7;
  font-size: 10px;
}

.sire-empty-cell {
  padding: 16px;
  text-align: center;
  color: var(--fhor-ink-muted);
}

.sire-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 700;
  border: 1px solid transparent;
}

.sire-pill-blue { background: #eff6ff; border-color: #bfdbfe; color: #1e40af; }
.sire-pill-violet { background: #f5f3ff; border-color: #ddd6fe; color: #5b21b6; }
.sire-pill-emerald { background: #ecfdf5; border-color: #a7f3d0; color: #065f46; }
.sire-pill-amber { background: #fffbeb; border-color: #fde68a; color: #92400e; }
.sire-pill-slate { background: #f8fafc; border-color: #e2e8f0; color: #334155; }
.sire-pill-empty { color: #9ca3af; }

.prb-score {
  display: inline-flex;
  min-width: 50px;
  justify-content: center;
  border-radius: 8px;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 800;
}

.prb-strong { background: #dcfce7; color: #166534; }
.prb-good { background: #ecfeff; color: #155e75; }
.prb-neutral { background: #f3f4f6; color: #374151; }
.prb-weak { background: #fee2e2; color: #991b1b; }

@media (max-width: 768px) {
  .daily-sires-insights-wrapper {
    padding: var(--fhor-pad);
    overflow-x: hidden;
  }

  .sire-header-row h3 {
    font-size: 20px;
  }

  .sire-filters-toggle {
    display: flex;
    margin-bottom: 10px;
  }

  .daily-sires-insights-wrapper > .sire-insights-filters {
    display: none;
    margin-bottom: 12px;
  }

  .daily-sires-insights-wrapper > .sire-insights-filters.is-open {
    display: grid !important;
  }

  .sire-mobile-toolbar {
    display: flex;
    margin-bottom: 12px;
  }

  .sire-insights-table-wrap {
    overflow-x: hidden;
    border: none;
    background: transparent;
  }

  .sire-insights-table {
    min-width: 0;
    border-collapse: separate;
    border-spacing: 0 10px;
  }

  .sire-insights-table thead {
    display: none;
  }

  .sire-insights-table tbody {
    display: block;
  }

  .sire-insights-table tbody tr.sire-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 12px;
    padding: 12px;
    background: var(--fhor-surface) !important;
    border: 1px solid var(--fhor-border) !important;
    border-radius: 12px;
    box-shadow: var(--fhor-shadow-soft);
  }

  .sire-insights-table tbody tr.sire-row:hover {
    background: var(--fhor-surface) !important;
  }

  .sire-insights-table tbody tr.sire-row td.sire-cell {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    padding: 0 !important;
    border: none !important;
    min-width: 0;
    font-size: 13px;
  }

  .sire-insights-table tbody tr.sire-row td.sire-cell::before {
    content: attr(data-label);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--fhor-ink-muted);
    flex-shrink: 0;
  }

  .sire-insights-table tbody tr.sire-row td.sire-cell > * {
    margin-left: auto;
    text-align: right;
  }

  .sire-insights-table tbody tr.sire-row td.sire-cell--sire {
    order: -20;
    grid-column: 1 / -1;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    padding-bottom: 8px !important;
    border-bottom: 1px solid var(--fhor-border) !important;
    font-size: 16px;
    font-weight: 800;
    color: var(--fhor-primary);
  }

  .sire-insights-table tbody tr.sire-row td.sire-cell--sire::before {
    display: none;
  }

  .sire-insights-table tbody tr.sire-row td.sire-cell--sire > * {
    margin-left: 0;
    text-align: left;
  }

  .sire-insights-table tbody tr.sire-row td.sire-cell--prb {
    order: -19;
    grid-column: 1 / -1;
    background: #f0fdf4;
    border-radius: 8px;
    padding: 8px 10px !important;
  }

  .sire-insights-table tbody tr.sire-row--empty {
    display: block;
    padding: 16px;
    background: var(--fhor-surface) !important;
    border: 1px solid var(--fhor-border) !important;
    border-radius: 12px;
  }

  .sire-insights-table tbody tr.sire-row--empty td.sire-empty-cell {
    display: block;
    text-align: center;
    padding: 0 !important;
    border: none !important;
  }

  .sire-insights-table tbody tr.sire-row--empty td.sire-empty-cell::before {
    display: none;
  }
}

/* -------------------------------------------------------------------------- */
/* My Tracker                                                                 */
/* -------------------------------------------------------------------------- */

.my-tracker-dashboard {
  box-sizing: border-box;
  max-width: 1200px;
  margin: 24px auto;
  padding: 0 16px calc(30px + var(--fhor-fab-clearance));
}

.my-tracker-empty {
  background: var(--fhor-surface);
  border: 1px solid var(--fhor-border);
  border-radius: var(--fhor-radius-sm);
  padding: 16px;
  color: var(--fhor-ink-muted);
}

.my-tracker-table-wrap {
  background: var(--fhor-surface);
  border: 1px solid var(--fhor-border);
  border-radius: var(--fhor-radius);
  overflow: auto;
  box-shadow: var(--fhor-shadow-soft);
}

.my-tracker-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 0;
}

.my-tracker-table th,
.my-tracker-table td {
  padding: 12px;
  border-bottom: 1px solid #f3f4f6;
  text-align: left;
  vertical-align: top;
}

.my-tracker-table th {
  background: var(--fhor-surface-muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--fhor-ink-muted);
  font-weight: 700;
}

.my-tracker-table .tracker-cell--horse {
  font-weight: 700;
  color: var(--fhor-ink);
}

.my-tracker-details summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--fhor-primary);
  list-style: none;
}

.my-tracker-details summary::-webkit-details-marker {
  display: none;
}

.my-tracker-details summary::before {
  content: "▸ ";
  display: inline-block;
  transition: transform var(--fhor-transition);
}

.my-tracker-details[open] summary::before {
  transform: rotate(90deg);
}

.my-tracker-notes-dropdown {
  margin-top: 8px;
  border: 1px solid var(--fhor-border);
  border-radius: var(--fhor-radius-sm);
  background: var(--fhor-surface-muted);
  padding: 10px;
}

.my-tracker-note-item {
  border-bottom: 1px solid var(--fhor-border);
  padding: 10px 0;
}

.my-tracker-note-item:last-child {
  border-bottom: none;
}

.my-tracker-note-meta {
  font-size: 11px;
  color: var(--fhor-ink-muted);
  margin-bottom: 6px;
}

.my-tracker-note-text {
  font-size: 13px;
  color: var(--fhor-ink);
  margin-bottom: 8px;
  white-space: normal;
}

.my-tracker-delete-btn {
  white-space: nowrap;
}

@media (max-width: 768px) {
  .my-tracker-dashboard {
    padding: 0 12px calc(24px + var(--fhor-fab-clearance));
  }

  .my-tracker-header h1 {
    font-size: 24px;
  }

  .my-tracker-table-wrap {
    overflow-x: hidden;
    border: none;
    background: transparent;
    box-shadow: none;
  }

  .my-tracker-table {
    border-collapse: separate;
    border-spacing: 0 10px;
  }

  .my-tracker-table thead {
    display: none;
  }

  .my-tracker-table tbody {
    display: block;
  }

  .my-tracker-table tbody tr.tracker-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 14px;
    background: var(--fhor-surface);
    border: 1px solid var(--fhor-border);
    border-radius: 12px;
    box-shadow: var(--fhor-shadow-soft);
  }

  .my-tracker-table tbody tr.tracker-row td.tracker-cell {
    display: block;
    padding: 0 !important;
    border: none !important;
  }

  .my-tracker-table tbody tr.tracker-row td.tracker-cell::before {
    content: attr(data-label);
    display: block;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--fhor-ink-muted);
    margin-bottom: 4px;
  }

  .my-tracker-table tbody tr.tracker-row td.tracker-cell--horse {
    font-size: 17px;
    color: var(--fhor-primary);
  }

  .my-tracker-table tbody tr.tracker-row td.tracker-cell--horse::before {
    display: none;
  }

  .my-tracker-table tbody tr.tracker-row td.tracker-cell--date {
    font-weight: 600;
  }

  .my-tracker-table tbody tr.tracker-row td.tracker-cell--comments {
    padding-top: 8px !important;
    border-top: 1px solid var(--fhor-border) !important;
    margin-top: 4px;
  }
}

/* -------------------------------------------------------------------------- */
/* Shared utilities (alerts, stat chips)                                      */
/* -------------------------------------------------------------------------- */

.fhor-stat-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--fhor-surface-muted);
  border: 1px solid var(--fhor-border);
  border-radius: var(--fhor-radius-sm);
  padding: 6px 10px;
  font-size: 13px;
  color: var(--fhor-ink);
}

.fhor-stat-chip--info {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1e40af;
}

.fhor-stat-chip--success {
  background: #ecfdf5;
  border-color: #a7f3d0;
  color: #065f46;
}

.fhor-alert {
  margin-bottom: 14px;
  padding: 12px 14px;
  border-radius: var(--fhor-radius-sm);
  font-size: 13px;
}

.fhor-alert--error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
}

.fhor-alert--warn {
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: #92400e;
}

.fhor-btn--accent {
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #6ee7b7;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.fhor-btn--accent:hover {
  background: #d1fae5;
}

/* -------------------------------------------------------------------------- */
/* Admin P&L Dashboard                                                        */
/* -------------------------------------------------------------------------- */

.admin-pnl-dashboard {
  box-sizing: border-box;
  max-width: 1200px;
  margin: 24px auto;
  padding: 0 16px calc(30px + var(--fhor-fab-clearance));
}

.pnl-filters-toggle {
  display: none;
}

.admin-pnl-form {
  background: var(--fhor-surface);
  border: 1px solid var(--fhor-border);
  border-radius: var(--fhor-radius);
  padding: 14px;
  margin-bottom: 14px;
  box-shadow: var(--fhor-shadow-soft);
}

.admin-pnl-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
}

.admin-pnl-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.admin-pnl-field--wide {
  grid-column: span 2;
}

.admin-pnl-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--fhor-ink-muted);
}

.admin-pnl-field input[type="date"],
.admin-pnl-field input[type="text"],
.admin-pnl-field input[type="number"] {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--fhor-border);
  border-radius: var(--fhor-radius-sm);
  background: var(--fhor-surface);
  color: var(--fhor-ink);
  font-size: 13px;
  box-sizing: border-box;
}

.admin-pnl-field input:focus {
  outline: none;
  border-color: var(--fhor-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

.admin-pnl-fieldset {
  grid-column: 1 / -1;
  border: 1px solid var(--fhor-border);
  border-radius: var(--fhor-radius-sm);
  padding: 10px 12px;
  margin: 0;
}

.admin-pnl-fieldset .admin-pnl-label {
  padding: 0 4px;
}

.admin-pnl-check {
  display: block;
  font-size: 13px;
  color: var(--fhor-ink);
  line-height: 1.7;
}

.admin-pnl-form-actions {
  margin-top: 12px;
}

.admin-pnl-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}

.admin-pnl-table-wrap {
  background: var(--fhor-surface);
  border: 1px solid var(--fhor-border);
  border-radius: var(--fhor-radius);
  overflow: auto;
  box-shadow: var(--fhor-shadow-soft);
}

.admin-pnl-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 900px;
}

.admin-pnl-table th,
.admin-pnl-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #f3f4f6;
  text-align: left;
  vertical-align: middle;
}

.admin-pnl-table th {
  background: var(--fhor-surface-muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--fhor-ink-muted);
  white-space: nowrap;
}

.pnl-cell--strategy {
  font-weight: 700;
}

.pnl-profit--pos {
  color: #065f46;
}

.pnl-profit--neg {
  color: #991b1b;
}

.pnl-cell--roi {
  font-weight: 700;
}

@media (max-width: 768px) {
  .admin-pnl-dashboard {
    padding: 0 12px calc(24px + var(--fhor-fab-clearance));
  }

  .pnl-filters-toggle {
    display: flex;
    margin-bottom: 10px;
  }

  .admin-pnl-form {
    display: none;
    padding: 12px;
  }

  .admin-pnl-form.is-open {
    display: block;
  }

  .admin-pnl-field--wide {
    grid-column: 1 / -1;
  }

  .admin-pnl-table-wrap {
    overflow-x: hidden;
    border: none;
    background: transparent;
    box-shadow: none;
  }

  .admin-pnl-table {
    min-width: 0;
    border-collapse: separate;
    border-spacing: 0 10px;
  }

  .admin-pnl-table thead {
    display: none;
  }

  .admin-pnl-table tbody {
    display: block;
  }

  .admin-pnl-table tbody tr.pnl-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 12px;
    padding: 14px;
    background: var(--fhor-surface);
    border: 1px solid var(--fhor-border);
    border-radius: 12px;
    box-shadow: var(--fhor-shadow-soft);
  }

  .admin-pnl-table tbody tr.pnl-row td.pnl-cell {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    padding: 0 !important;
    border: none !important;
    font-size: 13px;
  }

  .admin-pnl-table tbody tr.pnl-row td.pnl-cell::before {
    content: attr(data-label);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--fhor-ink-muted);
    flex-shrink: 0;
  }

  .admin-pnl-table tbody tr.pnl-row td.pnl-cell > * {
    margin-left: auto;
    text-align: right;
  }

  .admin-pnl-table tbody tr.pnl-row td.pnl-cell--strategy {
    order: -20;
    grid-column: 1 / -1;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    padding-bottom: 8px !important;
    border-bottom: 1px solid var(--fhor-border) !important;
    font-size: 16px;
    color: var(--fhor-primary);
  }

  .admin-pnl-table tbody tr.pnl-row td.pnl-cell--strategy::before {
    display: none;
  }

  .admin-pnl-table tbody tr.pnl-row td.pnl-cell--roi {
    order: -19;
    grid-column: 1 / -1;
    background: #f0fdf4;
    border-radius: 8px;
    padding: 8px 10px !important;
    font-size: 15px;
  }

  .admin-pnl-table tbody tr.pnl-row td.pnl-cell--roi.pnl-profit--neg {
    background: #fef2f2;
  }
}

/* -------------------------------------------------------------------------- */
/* Points Engine — Published Picks                                            */
/* -------------------------------------------------------------------------- */

.points-today-picks {
  max-width: 1100px;
  margin: 24px auto;
  padding: 0 16px calc(40px + var(--fhor-fab-clearance));
}

.tp-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
  margin-bottom: 14px;
}

.tp-date-form {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
}

.tp-toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tp-card {
  background: var(--fhor-surface);
  border: 2px solid var(--fhor-ink);
  border-radius: var(--fhor-radius);
  padding: 18px 20px;
  margin-bottom: 16px;
}

.tp-card h1 {
  margin: 0 0 4px;
  font-size: 26px;
  font-weight: 800;
  color: var(--fhor-ink);
}

.tp-card-date {
  margin: 0 0 10px;
  font-size: 16px;
  color: var(--fhor-ink);
}

.tp-card-date span {
  color: var(--fhor-ink-muted);
}

.tp-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.tp-course-block {
  background: var(--fhor-surface);
  border: 1px solid var(--fhor-border);
  border-radius: var(--fhor-radius);
  margin-bottom: 14px;
  overflow: hidden;
  box-shadow: var(--fhor-shadow-soft);
}

.tp-course-header {
  background: var(--fhor-ink);
  color: #fff;
  padding: 10px 14px;
  font-size: 15px;
  font-weight: 800;
}

.tp-course-count {
  font-weight: 600;
  opacity: 0.85;
}

.tp-course-header--missing {
  background: #991b1b;
}

.tp-picks-table-wrap {
  overflow: auto;
}

.tp-picks-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
  font-size: 14px;
}

.tp-picks-table th,
.tp-picks-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #f3f4f6;
  text-align: left;
  vertical-align: top;
}

.tp-picks-table th {
  background: var(--fhor-surface-muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--fhor-ink-muted);
}

.tp-pick-cell--time {
  font-weight: 700;
  white-space: nowrap;
}

.tp-pick-cell--race {
  color: #475569;
  font-size: 13px;
}

.tp-pick-cell--win {
  font-weight: 800;
  color: var(--fhor-ink);
}

.tp-pick-cell--source {
  font-size: 11px;
  color: var(--fhor-ink-muted);
}

.tp-missing-list {
  margin: 0;
  padding: 12px 18px 12px 32px;
  font-size: 13px;
  color: #7f1d1d;
}

@media print {
  .tp-no-print {
    display: none !important;
  }

  .points-today-picks {
    max-width: none !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .tp-card,
  .tp-course-block {
    break-inside: avoid;
    page-break-inside: avoid;
  }

  body {
    background: #fff !important;
  }
}

@media (max-width: 768px) {
  .points-today-picks {
    padding: 0 12px calc(24px + var(--fhor-fab-clearance));
    overflow-x: hidden;
  }

  .tp-card h1 {
    font-size: 22px;
  }

  .tp-picks-table-wrap {
    overflow-x: hidden;
  }

  .tp-picks-table {
    min-width: 0;
    border-collapse: separate;
    border-spacing: 0 10px;
  }

  .tp-picks-table thead {
    display: none;
  }

  .tp-picks-table tbody {
    display: block;
    padding: 10px;
  }

  .tp-picks-table tbody tr.tp-pick-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 12px;
    background: var(--fhor-surface-muted);
    border: 1px solid var(--fhor-border);
    border-radius: 10px;
    margin-bottom: 0;
  }

  .tp-picks-table tbody tr.tp-pick-row td.tp-pick-cell {
    display: block;
    padding: 0 !important;
    border: none !important;
  }

  .tp-picks-table tbody tr.tp-pick-row td.tp-pick-cell::before {
    content: attr(data-label);
    display: block;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--fhor-ink-muted);
    margin-bottom: 3px;
  }

  .tp-picks-table tbody tr.tp-pick-row td.tp-pick-cell--time {
    display: flex;
    align-items: baseline;
    gap: 10px;
    padding-bottom: 8px !important;
    border-bottom: 1px solid var(--fhor-border) !important;
    font-size: 18px;
    color: var(--fhor-primary);
  }

  .tp-picks-table tbody tr.tp-pick-row td.tp-pick-cell--time::before {
    display: none;
  }

  .tp-picks-table tbody tr.tp-pick-row td.tp-pick-cell--win {
    font-size: 16px;
    background: #f0fdf4;
    border-radius: 8px;
    padding: 8px 10px !important;
  }

  .tp-picks-table tbody tr.tp-pick-row td.tp-pick-cell--race {
    font-size: 14px;
    color: var(--fhor-ink);
  }

  .tp-picks-table tbody tr.tp-pick-row td.tp-pick-cell--source {
    padding-top: 6px !important;
    border-top: 1px dashed var(--fhor-border) !important;
    margin-top: 4px;
  }
}
