
:root {
  --bg: #07101c;
  --surface: #0d1826;
  --surface-2: #111f30;
  --surface-3: #17283b;
  --line: rgba(255, 255, 255, 0.09);
  --text: #edf4fb;
  --muted: #91a4b8;
  --accent: #36c990;
  --accent-2: #5fd9ac;
  --danger: #ff6b72;
  --warning: #f1c65b;
  --shadow: 0 18px 55px rgba(0, 0, 0, 0.28);
  --radius: 18px;
  --sidebar: 268px;
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: dark;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 85% 5%, rgba(54, 201, 144, 0.08), transparent 28rem),
    var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.5;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input {
  font: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar) minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 26px 20px;
  background: rgba(7, 16, 28, 0.92);
  border-right: 1px solid var(--line);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 13px;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 1.04rem;
  letter-spacing: 0.01em;
}

.brand small {
  color: var(--muted);
  font-size: 0.75rem;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(95, 217, 172, 0.36);
  border-radius: 13px;
  background: linear-gradient(145deg, rgba(54, 201, 144, 0.22), rgba(54, 201, 144, 0.06));
  color: var(--accent-2);
  font-weight: 800;
  letter-spacing: -0.04em;
}

.brand-large .brand-mark {
  width: 52px;
  height: 52px;
  border-radius: 16px;
}

.nav {
  display: grid;
  gap: 6px;
  margin-top: 42px;
}

.nav a {
  display: grid;
  grid-template-columns: 26px 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 12px 13px;
  border-radius: 12px;
  color: var(--muted);
  transition: 160ms ease;
}

.nav a:hover:not(.disabled),
.nav a.active {
  background: var(--surface-2);
  color: var(--text);
}

.nav a.active {
  box-shadow: inset 3px 0 0 var(--accent);
}

.nav a small {
  font-size: 0.67rem;
  color: #607489;
}

.nav a.disabled {
  cursor: default;
  opacity: 0.62;
}

.nav-icon {
  color: var(--accent-2);
  font-size: 1.1rem;
}

.sidebar-footer {
  margin-top: auto;
  display: grid;
  gap: 14px;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}

.user-chip strong,
.user-chip small {
  display: block;
}

.user-chip small {
  color: var(--muted);
  text-transform: capitalize;
}

.avatar {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--surface-3);
  color: var(--accent-2);
  font-weight: 800;
}

.main {
  min-width: 0;
  padding: 0 34px;
}

.topbar {
  min-height: 112px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid var(--line);
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(1.65rem, 2.5vw, 2.35rem);
  letter-spacing: -0.035em;
}

h2 {
  margin-bottom: 10px;
  font-size: clamp(1.25rem, 2vw, 1.7rem);
  letter-spacing: -0.025em;
}

h3 {
  margin-bottom: 8px;
}

.eyebrow {
  margin-bottom: 4px;
  color: var(--accent-2);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.topbar-meta {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-size: 0.85rem;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 5px rgba(54, 201, 144, 0.11);
}

.content {
  display: grid;
  gap: 26px;
  padding: 32px 0 44px;
}

.hero-card,
.panel,
.metric-card,
.module-card {
  border: 1px solid var(--line);
  background: linear-gradient(145deg, rgba(17, 31, 48, 0.96), rgba(13, 24, 38, 0.96));
  box-shadow: var(--shadow);
}

.hero-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 26px;
  padding: 32px;
  border-radius: 22px;
}

.hero-card.compact {
  padding: 25px 28px;
}

.hero-card p {
  max-width: 780px;
  margin-bottom: 0;
  color: var(--muted);
}

.badge {
  display: inline-flex;
  margin-bottom: 13px;
  padding: 5px 9px;
  border-radius: 999px;
  background: rgba(54, 201, 144, 0.13);
  color: var(--accent-2);
  font-size: 0.72rem;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.badge-muted {
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
}

.metric-grid,
.module-grid {
  display: grid;
  gap: 16px;
}

.metric-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.module-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.metric-card,
.module-card {
  padding: 22px;
  border-radius: var(--radius);
}

.metric-card strong {
  display: block;
  margin: 8px 0 3px;
  font-size: 1.16rem;
}

.metric-card small,
.module-card p {
  color: var(--muted);
}

.metric-label {
  color: var(--muted);
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.module-card {
  min-height: 170px;
}

.module-card p {
  margin-bottom: 0;
}

.section-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  margin-top: 5px;
}

.section-heading h2 {
  margin-bottom: 0;
}

.panel {
  padding: 26px;
  border-radius: var(--radius);
}

.code-panel {
  overflow: auto;
  min-height: 260px;
  margin: 20px 0 0;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #07101a;
  color: #b9c9d9;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.8rem;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 11px;
  cursor: pointer;
  font-weight: 750;
  transition: 160ms ease;
}

.button:disabled {
  cursor: wait;
  opacity: 0.7;
}

.button-primary {
  background: var(--accent);
  color: #04150e;
}

.button-primary:hover {
  background: var(--accent-2);
}

.button-secondary {
  border-color: rgba(95, 217, 172, 0.28);
  background: rgba(54, 201, 144, 0.08);
  color: var(--accent-2);
}

.button-secondary:hover,
.button-ghost:hover {
  background: rgba(255, 255, 255, 0.07);
}

.button-ghost {
  border-color: var(--line);
  background: transparent;
  color: var(--muted);
}

.button-full {
  width: 100%;
}

.positive {
  color: var(--accent-2);
}

.negative {
  color: var(--danger);
}

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

.center {
  text-align: center;
}

footer {
  padding: 22px 0 28px;
  border-top: 1px solid var(--line);
  color: #617488;
  font-size: 0.76rem;
}

.login-body {
  overflow-x: hidden;
}

.login-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(380px, 0.85fr);
  min-height: 100vh;
}

.login-intro {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: clamp(34px, 6vw, 82px);
  border-right: 1px solid var(--line);
  background:
    linear-gradient(150deg, rgba(54, 201, 144, 0.07), transparent 42%),
    rgba(7, 16, 28, 0.74);
}

.login-intro h1 {
  max-width: 720px;
  margin-top: 15px;
  font-size: clamp(2.3rem, 5vw, 5rem);
  line-height: 1.02;
}

.lead {
  max-width: 640px;
  color: var(--muted);
  font-size: 1.08rem;
}

.login-footnote {
  margin-bottom: 0;
  color: #617488;
  font-size: 0.8rem;
}

.login-panel {
  display: grid;
  place-items: center;
  padding: 30px;
}

.login-card {
  width: min(100%, 430px);
  display: grid;
  gap: 20px;
  padding: 32px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(13, 24, 38, 0.92);
  box-shadow: var(--shadow);
}

.login-card label {
  display: grid;
  gap: 8px;
  color: #c7d4e0;
  font-size: 0.84rem;
  font-weight: 700;
}

.login-card input {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 11px;
  outline: none;
  background: #08131f;
  color: var(--text);
}

.login-card input:focus {
  border-color: rgba(95, 217, 172, 0.65);
  box-shadow: 0 0 0 4px rgba(54, 201, 144, 0.08);
}

.alert {
  padding: 12px 14px;
  border-radius: 11px;
  font-size: 0.84rem;
}

.alert-error {
  border: 1px solid rgba(255, 107, 114, 0.3);
  background: rgba(255, 107, 114, 0.08);
  color: #ff9ca1;
}

@media (max-width: 1100px) {
  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .module-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 850px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    padding: 16px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin-top: 18px;
  }

  .sidebar-footer {
    margin-top: 18px;
  }

  .main {
    padding: 0 18px;
  }

  .login-layout {
    grid-template-columns: 1fr;
  }

  .login-intro {
    min-height: 44vh;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
}

@media (max-width: 620px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
    justify-content: center;
    min-height: 132px;
  }

  .hero-card {
    align-items: flex-start;
    flex-direction: column;
    padding: 24px;
  }

  .metric-grid {
    grid-template-columns: 1fr;
  }

  .nav {
    grid-template-columns: 1fr;
  }

  .login-intro {
    padding: 28px 22px;
  }

  .login-panel {
    padding: 22px 14px;
  }

  .login-card {
    padding: 24px;
  }
}

/* Turf Lab Lot 2 — Dashboard du jour */
.hidden {
  display: none !important;
}

.warning-text {
  color: var(--warning);
}

.metric-grid-6 {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.metric-grid-5 {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.dashboard-columns {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.text-link {
  color: var(--accent-2);
  font-size: 0.84rem;
  font-weight: 750;
}

.text-link:hover {
  text-decoration: underline;
}

.compact-list {
  display: grid;
  gap: 8px;
  margin-top: 18px;
}

.compact-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 13px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(7, 16, 28, 0.45);
  transition: 160ms ease;
}

.compact-row:hover {
  transform: translateY(-1px);
  border-color: rgba(95, 217, 172, 0.28);
  background: rgba(17, 31, 48, 0.8);
}

.course-code {
  min-width: 54px;
  color: var(--accent-2);
  font-size: 0.82rem;
  font-weight: 850;
}

.compact-main strong,
.compact-main small {
  display: block;
}

.compact-main small {
  color: var(--muted);
  font-size: 0.76rem;
}

.signal-pills {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 5px;
}

.signal-pill,
.status-badge,
.type-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 800;
}

.signal-pill {
  min-width: 28px;
  padding: 4px 7px;
}

.signal-pill.steam {
  background: rgba(54, 201, 144, 0.13);
  color: var(--accent-2);
}

.signal-pill.drift {
  background: rgba(241, 198, 91, 0.12);
  color: var(--warning);
}

.status-badge {
  padding: 5px 8px;
  border: 1px solid var(--line);
}

.status-fresh,
.status-upcoming {
  color: var(--accent-2);
  background: rgba(54, 201, 144, 0.08);
}

.status-warning,
.status-live {
  color: var(--warning);
  background: rgba(241, 198, 91, 0.08);
}

.status-stale,
.status-finished {
  color: var(--danger);
  background: rgba(255, 107, 114, 0.07);
}

.status-unknown {
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
}

.type-badge {
  padding: 5px 8px;
  background: rgba(255, 255, 255, 0.055);
  color: #c4d2df;
}

.table-shell {
  width: 100%;
  overflow-x: auto;
  margin-top: 19px;
  border: 1px solid var(--line);
  border-radius: 14px;
}

.data-table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
  background: rgba(7, 16, 28, 0.36);
}

.data-table th,
.data-table td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

.data-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #0d1927;
  color: var(--muted);
  font-size: 0.69rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.data-table td {
  font-size: 0.83rem;
}

.data-table tbody tr:last-child td {
  border-bottom: 0;
}

.data-table tbody tr:hover {
  background: rgba(95, 217, 172, 0.035);
}

.data-table strong,
.data-table small {
  display: block;
}

.data-table small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.7rem;
}

.course-cell {
  min-width: 190px;
}

.course-cell strong {
  color: var(--accent-2);
}

.table-empty {
  padding: 36px !important;
  color: var(--muted);
  text-align: center !important;
}

.filter-panel {
  display: grid;
  grid-template-columns: repeat(5, minmax(130px, 1fr)) auto;
  align-items: end;
  gap: 12px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(13, 24, 38, 0.76);
}

.filter-panel label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.035em;
}

.filter-panel select {
  width: 100%;
  min-height: 42px;
  padding: 0 36px 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: none;
  background: #08131f;
  color: var(--text);
}

.filter-panel select:focus {
  border-color: rgba(95, 217, 172, 0.6);
}

.market-table {
  min-width: 1420px;
}

.focused-row {
  outline: 2px solid rgba(95, 217, 172, 0.52);
  outline-offset: -2px;
  background: rgba(54, 201, 144, 0.07) !important;
}

@media (max-width: 1380px) {
  .metric-grid-6 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .metric-grid-5 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .filter-panel {
    grid-template-columns: repeat(3, minmax(150px, 1fr));
  }
}

@media (max-width: 980px) {
  .dashboard-columns {
    grid-template-columns: 1fr;
  }

  .metric-grid-6,
  .metric-grid-5 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .filter-panel {
    grid-template-columns: repeat(2, minmax(140px, 1fr));
  }
}

@media (max-width: 620px) {
  .metric-grid-6,
  .metric-grid-5,
  .filter-panel {
    grid-template-columns: 1fr;
  }

  .compact-row {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .compact-row > :last-child {
    grid-column: 1 / -1;
    justify-self: start;
  }
}

/* Correctif cache/alertes + Lots 3 et 4 */
[hidden] {
  display: none !important;
}

.action-group {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.alert-success {
  border: 1px solid rgba(54, 201, 144, 0.34);
  background: rgba(54, 201, 144, 0.09);
  color: var(--accent-2);
}

.context-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 20px;
}

.context-item {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(7, 16, 28, 0.42);
}

.context-item span,
.context-item strong {
  display: block;
}

.context-item span {
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.context-item strong {
  margin-top: 5px;
  font-size: 0.94rem;
}

.runner-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}

.runner-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(7, 16, 28, 0.55);
  color: var(--muted);
  cursor: pointer;
}

.runner-chip.active {
  border-color: color-mix(in srgb, var(--runner-color) 62%, transparent);
  background: color-mix(in srgb, var(--runner-color) 12%, transparent);
  color: var(--text);
}

.runner-color {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--runner-color);
}

.chart-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.chart-panel {
  min-width: 0;
}

.svg-chart {
  min-height: 360px;
  margin-top: 16px;
  overflow-x: auto;
}

.svg-chart svg {
  display: block;
  width: 100%;
  min-width: 640px;
  height: auto;
}

.chart-grid-line {
  stroke: rgba(255, 255, 255, 0.09);
  stroke-width: 1;
}

.chart-grid-line.vertical {
  stroke-dasharray: 3 5;
}

.chart-label {
  fill: #7f93a8;
  font-size: 11px;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 7px 14px;
  margin-bottom: 9px;
  color: var(--muted);
  font-size: 0.7rem;
}

.chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.chart-legend i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
}

.chart-empty {
  display: grid;
  min-height: 300px;
  place-items: center;
}

.race-table {
  min-width: 1660px;
}

.runner-number {
  display: grid !important;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: rgba(95, 217, 172, 0.1);
  color: var(--accent-2);
}

.result-badge {
  display: inline-grid;
  place-items: center;
  min-width: 28px;
  height: 28px;
  border-radius: 9px;
  background: rgba(95, 217, 172, 0.1);
  color: var(--accent-2);
  font-weight: 850;
}

.performance-filters input {
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: none;
  background: #08131f;
  color: var(--text);
}

.threshold-list {
  display: grid;
  gap: 15px;
  margin-top: 18px;
}

.threshold-row {
  display: grid;
  gap: 7px;
}

.threshold-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.threshold-head span {
  color: var(--muted);
  font-size: 0.75rem;
  text-align: right;
}

.threshold-track {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.055);
}

.threshold-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(54, 201, 144, 0.55), var(--accent));
}

.insight-card {
  margin-top: 18px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(7, 16, 28, 0.45);
}

.insight-card p {
  color: #c7d4df;
}

.runs-table {
  min-width: 1120px;
}

.run-detail-table {
  min-width: 1150px;
}

@media (max-width: 1200px) {
  .context-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .chart-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .context-grid {
    grid-template-columns: 1fr;
  }

  .threshold-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .threshold-head span {
    text-align: left;
  }
}

/* Turf Lab Lot 5 — Fiches chevaux et favoris */
.horse-search-panel label {
  display: block;
  margin-bottom: 9px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.horse-search-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.horse-search-row input {
  min-height: 48px;
  padding: 0 15px;
  border: 1px solid var(--line);
  border-radius: 11px;
  outline: none;
  background: #08131f;
  color: var(--text);
  font: inherit;
}

.horse-search-row input:focus {
  border-color: rgba(95, 217, 172, 0.62);
  box-shadow: 0 0 0 4px rgba(54, 201, 144, 0.08);
}

.search-results {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 15px;
}

.search-result {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(7, 16, 28, 0.44);
}

.search-result:hover {
  border-color: rgba(95, 217, 172, 0.32);
  background: rgba(54, 201, 144, 0.055);
}

.search-result strong,
.search-result small {
  display: block;
}

.search-result small {
  color: var(--muted);
  font-size: 0.72rem;
}

.search-icon {
  color: var(--accent-2);
  font-size: 1.2rem;
}

.search-empty {
  grid-column: 1 / -1;
  padding: 18px 0;
}

.favorite-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.favorite-card {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(7, 16, 28, 0.45);
}

.favorite-card a {
  min-width: 0;
}

.favorite-card strong,
.favorite-card small {
  display: block;
}

.favorite-card strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.favorite-card small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.7rem;
}

.favorite-star {
  color: var(--warning);
  margin-right: 6px;
}

.favorite-remove {
  width: 31px;
  height: 31px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.favorite-remove:hover {
  border-color: rgba(255, 107, 114, 0.35);
  color: var(--danger);
}

.empty-state {
  grid-column: 1 / -1;
  padding: 30px;
  border: 1px dashed var(--line);
  border-radius: 14px;
  text-align: center;
  color: var(--muted);
}

.empty-state strong {
  display: block;
  color: var(--text);
}

.empty-state p {
  margin: 5px 0 0;
}

.button-favorite-active {
  border-color: rgba(241, 198, 91, 0.42);
  background: rgba(241, 198, 91, 0.09);
  color: var(--warning);
}

.alert-warning {
  border: 1px solid rgba(241, 198, 91, 0.3);
  background: rgba(241, 198, 91, 0.08);
  color: var(--warning);
}

.horse-identity-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.horse-courses-table {
  min-width: 1050px;
}

.history-result {
  display: inline-grid;
  place-items: center;
  min-width: 31px;
  height: 29px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.055);
  font-weight: 800;
}

.history-result.result-win {
  background: rgba(54, 201, 144, 0.13);
  color: var(--accent-2);
}

.history-result.result-place {
  background: rgba(241, 198, 91, 0.11);
  color: var(--warning);
}

.analysis-blocks {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.analysis-block {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(7, 16, 28, 0.4);
}

.analysis-block summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 15px 17px;
  cursor: pointer;
  list-style: none;
  font-weight: 750;
}

.analysis-block summary::-webkit-details-marker {
  display: none;
}

.analysis-block summary::after {
  content: "+";
  color: var(--accent-2);
  font-size: 1.2rem;
}

.analysis-block[open] summary::after {
  content: "−";
}

.analysis-block summary small {
  margin-left: auto;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 500;
}

.analysis-block-body {
  padding: 0 16px 16px;
}

.analysis-table-shell {
  margin-top: 0;
}

.analysis-table {
  min-width: 760px;
}

.horse-link {
  display: block;
  color: var(--accent-2);
  font-weight: 800;
}

.horse-link:hover {
  text-decoration: underline;
}

@media (max-width: 980px) {
  .favorite-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  .horse-search-row,
  .search-results,
  .favorite-grid,
  .horse-identity-grid {
    grid-template-columns: 1fr;
  }
}

/* Turf Lab Lot 6 — Top LCT du jour et export CSV */
.lct-tabs {
  display: inline-flex;
  gap: 5px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(7, 16, 28, 0.55);
}

.lct-tab {
  min-height: 40px;
  padding: 0 17px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-weight: 750;
}

.lct-tab.active {
  background: var(--surface-3);
  color: var(--text);
  box-shadow: inset 0 -2px 0 var(--accent);
}

.lct-tab-panel {
  display: grid;
  gap: 26px;
}

.lct-today-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-left: 4px solid var(--accent);
  background:
    linear-gradient(
      120deg,
      rgba(54, 201, 144, 0.1),
      rgba(13, 24, 38, 0.96) 42%
    );
}

.lct-today-toolbar h2 {
  color: var(--accent-2);
}

.lct-today-toolbar p {
  margin-bottom: 0;
}

.lct-toolbar-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: flex-end;
  gap: 10px;
}

.lct-toolbar-controls label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 750;
}

.lct-toolbar-controls select {
  min-width: 190px;
  min-height: 42px;
  padding: 0 36px 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #08131f;
  color: var(--text);
}

.sort-switch {
  display: inline-flex;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.sort-switch button {
  min-height: 40px;
  padding: 0 14px;
  border: 0;
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.025);
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 750;
}

.sort-switch button:last-child {
  border-right: 0;
}

.sort-switch button.active {
  background: rgba(54, 201, 144, 0.13);
  color: var(--accent-2);
}

.lct-day-summary {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  overflow: hidden;
  border: 1px solid rgba(95, 217, 172, 0.24);
  border-radius: 17px;
  background: rgba(13, 24, 38, 0.88);
}

.lct-day-summary > article {
  padding: 22px 16px;
  border-right: 1px solid var(--line);
  text-align: center;
}

.lct-day-summary > article:nth-child(5) {
  border-right: 0;
}

.lct-day-summary article strong,
.lct-day-summary article span {
  display: block;
}

.lct-day-summary article strong {
  margin-bottom: 4px;
  color: #63a8ff;
  font-size: 1.65rem;
}

.lct-day-summary article strong.winner-text {
  color: #ffd34f;
}

.lct-day-summary article strong.placed-text {
  color: var(--accent-2);
}

.lct-day-summary article span {
  color: var(--muted);
  font-size: 0.76rem;
}

.lct-day-summary footer {
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 17px;
  border-top: 1px solid var(--line);
  color: #cbd7e2;
  font-size: 0.8rem;
}

.lct-selection-panel {
  padding: 0;
  overflow: hidden;
}

.lct-selection-panel > .section-heading {
  padding: 24px 25px 0;
}

.lct-selection-panel .table-shell {
  border-right: 0;
  border-bottom: 0;
  border-left: 0;
  border-radius: 0;
}

.lct-ranking-table {
  min-width: 1320px;
}

.lct-ranking-table th {
  padding-top: 15px;
  padding-bottom: 15px;
}

.lct-ranking-table td {
  padding-top: 19px;
  padding-bottom: 19px;
}

.lct-ranking-table tbody tr {
  transition: 150ms ease;
}

.lct-ranking-table tbody tr:hover {
  background: rgba(95, 217, 172, 0.05);
}

.lct-row-winner {
  background: rgba(166, 128, 39, 0.32) !important;
}

.lct-row-placed {
  background: rgba(128, 86, 37, 0.22) !important;
}

.lct-row-lost {
  opacity: 0.58;
}

.rank-medal {
  font-size: 1.55rem;
}

.rank-number {
  display: inline-grid;
  place-items: center;
  width: 31px;
  height: 31px;
  border-radius: 50%;
  color: #9bb0c4;
  font-weight: 850;
}

.lct-course-cell {
  min-width: 175px;
}

.lct-course-cell strong,
.lct-course-cell small,
.lct-course-cell em {
  display: block;
}

.lct-course-cell strong {
  color: #6da7ff;
}

.lct-course-cell small {
  color: #a5b7c8;
}

.lct-course-cell em {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.71rem;
  font-style: normal;
}

.lct-horse-cell {
  min-width: 185px;
}

.lct-horse-cell a {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #5798ff;
}

.lct-horse-cell strong {
  font-size: 0.94rem;
}

.lct-people-cell {
  min-width: 195px;
}

.lct-people-cell strong,
.lct-people-cell small {
  display: block;
}

.lct-people-cell small {
  color: var(--muted);
}

.lct-elo-cell span {
  display: block;
  color: #6fa7ff;
  font-size: 0.76rem;
}

.lct-stats-cell strong,
.lct-stats-cell span,
.lct-stats-cell small {
  display: block;
}

.lct-stats-cell span {
  color: var(--accent-2);
}

.lct-stats-cell small {
  color: #62a7ff;
}

.lct-score-cell strong {
  color: var(--accent-2);
  font-size: 1.65rem;
  line-height: 1;
}

.lct-score-cell small {
  color: var(--muted);
}

.lct-odds-cell strong {
  color: #dce8f2;
  font-size: 1.05rem;
}

.lct-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 92px;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 800;
  white-space: nowrap;
}

.lct-status.status-winner {
  background: rgba(241, 198, 91, 0.18);
  color: #ffd759;
}

.lct-status.status-placed {
  background: rgba(54, 201, 144, 0.15);
  color: var(--accent-2);
}

.lct-status.status-lost {
  background: rgba(255, 107, 114, 0.14);
  color: #ff8c92;
}

.lct-status.status-upcoming {
  background: rgba(98, 167, 255, 0.13);
  color: #78b1ff;
}

.lct-status.status-live,
.lct-status.status-pending {
  background: rgba(255, 255, 255, 0.065);
  color: #c3d0dc;
}

.history-hero {
  margin-top: 0;
}

@media (max-width: 1180px) {
  .lct-today-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .lct-toolbar-controls {
    justify-content: flex-start;
  }

  .lct-day-summary {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .lct-day-summary > article:nth-child(3) {
    border-right: 0;
  }

  .lct-day-summary > article:nth-child(4),
  .lct-day-summary > article:nth-child(5) {
    border-top: 1px solid var(--line);
  }
}

@media (max-width: 700px) {
  .lct-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
  }

  .lct-toolbar-controls {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }

  .lct-toolbar-controls select,
  .sort-switch,
  .lct-toolbar-controls .button {
    width: 100%;
  }

  .sort-switch button {
    flex: 1;
  }

  .lct-day-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .lct-day-summary > article {
    border-top: 1px solid var(--line);
  }

  .lct-day-summary > article:first-child,
  .lct-day-summary > article:nth-child(2) {
    border-top: 0;
  }

  .lct-day-summary > article:nth-child(even) {
    border-right: 0;
  }

  .lct-day-summary footer {
    align-items: flex-start;
    flex-direction: column;
  }
}

/* Turf Lab 1.7 — fiabilisation LCT et centre d'alertes */
.lct-day-summary {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.lct-day-summary > article:nth-child(5) {
  border-right: 1px solid var(--line);
}

.lct-day-summary > article:nth-child(6) {
  border-right: 0;
}

.lct-row-non-runner {
  opacity: 0.48;
  background: rgba(241, 198, 91, 0.045) !important;
}

.lct-status.status-non_runner {
  background: rgba(241, 198, 91, 0.13);
  color: var(--warning);
}

.score-details {
  position: relative;
  min-width: 110px;
}

.score-details summary {
  display: inline-flex;
  cursor: pointer;
  color: var(--accent-2);
  font-size: 0.75rem;
  font-weight: 800;
}

.score-details > div {
  position: absolute;
  z-index: 8;
  right: 0;
  top: 26px;
  width: 300px;
  display: grid;
  gap: 7px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #0b1724;
  box-shadow: var(--shadow);
}

.score-details span {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  color: #c7d4df;
  font-size: 0.72rem;
}

.score-details b {
  color: var(--muted);
  font-weight: 600;
  text-transform: capitalize;
}

.score-details small {
  padding-top: 7px;
  border-top: 1px solid var(--line);
  color: var(--muted);
}

.alert-filters {
  grid-template-columns: repeat(4, minmax(140px, 1fr)) auto;
}

.alerts-list {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.market-alert {
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr) 130px 110px;
  align-items: center;
  gap: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--muted);
  border-radius: 14px;
  background: rgba(7, 16, 28, 0.46);
}

.market-alert.severity-critical {
  border-left-color: var(--danger);
  background: rgba(255, 107, 114, 0.055);
}

.market-alert.severity-high {
  border-left-color: var(--warning);
}

.market-alert.severity-medium {
  border-left-color: #62a7ff;
}

.market-alert.severity-low {
  border-left-color: #607489;
  opacity: 0.82;
}

.alert-severity span,
.alert-severity small {
  display: block;
}

.alert-severity span {
  font-size: 0.76rem;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.alert-severity small {
  margin-top: 3px;
  color: var(--muted);
}

.alert-main h3 {
  margin-bottom: 3px;
  font-size: 0.98rem;
}

.alert-main p {
  margin-bottom: 8px;
  color: #b9c8d6;
  font-size: 0.8rem;
}

.alert-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.favorite-alert-badge {
  padding: 3px 7px;
  border-radius: 999px;
  background: rgba(241, 198, 91, 0.12);
  color: var(--warning);
  font-size: 0.64rem;
  font-weight: 800;
}

.alert-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 12px;
  color: var(--muted);
  font-size: 0.7rem;
}

.alert-value {
  text-align: right;
}

.alert-value strong,
.alert-value small {
  display: block;
}

.alert-value strong {
  color: var(--accent-2);
}

.alert-value small {
  color: var(--muted);
  font-size: 0.68rem;
}

.alert-actions {
  display: grid;
  justify-items: stretch;
  gap: 8px;
}

.alert-actions .button {
  min-height: 34px;
  font-size: 0.72rem;
}

@media (max-width: 1180px) {
  .lct-day-summary {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .lct-day-summary > article:nth-child(3),
  .lct-day-summary > article:nth-child(6) {
    border-right: 0;
  }

  .market-alert {
    grid-template-columns: 92px minmax(0, 1fr) 110px;
  }

  .alert-actions {
    grid-column: 1 / -1;
    grid-template-columns: auto auto;
    justify-content: end;
  }
}

@media (max-width: 760px) {
  .alert-filters {
    grid-template-columns: 1fr;
  }

  .market-alert {
    grid-template-columns: 1fr;
  }

  .alert-value {
    text-align: left;
  }

  .alert-actions {
    grid-template-columns: 1fr;
    justify-content: stretch;
  }

  .score-details > div {
    position: fixed;
    right: 14px;
    left: 14px;
    top: 25vh;
    width: auto;
  }
}

/* Turf Lab 1.8 — Ajustements UI cockpit, tableaux et alertes */
.data-table thead th.sortable-column {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.data-table thead th.sortable-column::after {
  content: "⇅";
  display: inline-block;
  margin-left: 7px;
  color: #61768a;
  font-size: 0.72rem;
  opacity: 0.72;
}

.data-table thead th.sortable-column.sort-asc::after {
  content: "↑";
  color: var(--accent-2);
  opacity: 1;
}

.data-table thead th.sortable-column.sort-desc::after {
  content: "↓";
  color: var(--accent-2);
  opacity: 1;
}

.data-table thead th.sortable-column:focus-visible {
  outline: 2px solid rgba(95, 217, 172, 0.58);
  outline-offset: -3px;
}

.race-arrival-panel {
  border-left: 4px solid var(--accent);
  background:
    linear-gradient(
      120deg,
      rgba(54, 201, 144, 0.09),
      rgba(13, 24, 38, 0.96) 45%
    );
}

.race-arrival-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.arrival-card {
  display: grid;
  grid-template-columns: auto auto minmax(125px, 1fr);
  align-items: center;
  gap: 9px;
  min-width: 220px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(7, 16, 28, 0.54);
}

.arrival-card:hover {
  border-color: rgba(95, 217, 172, 0.35);
  background: rgba(54, 201, 144, 0.065);
}

.arrival-place {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.065);
  color: var(--text);
  font-weight: 900;
}

.arrival-place-1 .arrival-place {
  background: rgba(241, 198, 91, 0.18);
  color: #ffd759;
}

.arrival-place-2 .arrival-place,
.arrival-place-3 .arrival-place {
  background: rgba(54, 201, 144, 0.13);
  color: var(--accent-2);
}

.arrival-runner-number {
  display: grid;
  place-items: center;
  width: 27px;
  height: 27px;
  border-radius: 9px;
  background: rgba(98, 167, 255, 0.12);
  color: #78b1ff;
  font-size: 0.76rem;
  font-weight: 850;
}

.arrival-main strong,
.arrival-main small {
  display: block;
}

.arrival-main small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.68rem;
}

.race-table-controls {
  display: flex;
  align-items: end;
  justify-content: flex-end;
  gap: 14px;
}

.race-table-controls label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 750;
}

.race-table-controls select {
  min-width: 175px;
  min-height: 38px;
  padding: 0 34px 0 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #08131f;
  color: var(--text);
}

.variation-steam {
  color: var(--accent-2);
  font-weight: 800;
}

.variation-drift {
  color: var(--danger);
  font-weight: 800;
}

.chart-hover-overlay {
  cursor: crosshair;
  pointer-events: all;
}

.chart-hover-line {
  stroke: rgba(255, 255, 255, 0.82);
  stroke-width: 1.4;
  stroke-dasharray: 5 4;
  pointer-events: none;
}

.chart-hover-label {
  pointer-events: none;
}

.chart-hover-label rect {
  fill: #07111d;
  stroke: rgba(95, 217, 172, 0.4);
}

.chart-hover-label text {
  fill: #dce8f2;
  font-size: 11px;
  font-weight: 750;
}

@media (max-width: 760px) {
  .race-table-controls {
    width: 100%;
    align-items: stretch;
    flex-direction: column;
  }

  .race-table-controls select {
    width: 100%;
  }

  .race-arrival-list {
    display: grid;
    grid-template-columns: 1fr;
  }

  .arrival-card {
    min-width: 0;
  }
}

