:root {
  --bg: #f4f2ea;
  --surface: #ffffff;
  --surface-soft: #eeece4;
  --sidebar: #111315;
  --sidebar-soft: #202427;
  --text: #111315;
  --muted: #656964;
  --line: #d7d6ce;
  --line-strong: #bdbdb4;
  --accent: #c8d92f;
  --accent-strong: #96a624;
  --accent-soft: #f0f4c9;
  --gold: #aa915a;
  --gold-deep: #806b3f;
  --green: #738770;
  --green-soft: #e9eee6;
  --red: #d64d45;
  --red-soft: #f9e5e2;
  --positive: #087a3e;
  --negative: #c62828;
  --amber: #a77814;
  --amber-soft: #f8edd3;
  --blue: #667b91;
  --blue-soft: #e7edf1;
  --shadow: 0 18px 60px rgba(17, 19, 21, .08);
  --radius: 2px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.layout {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 244px minmax(0, 1fr);
  transition: grid-template-columns .2s ease;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background: var(--sidebar);
  color: #e7eeee;
  padding: 24px 14px;
  display: flex;
  flex-direction: column;
  z-index: 30;
  overflow-x: hidden;
  transition: padding .2s ease;
}

.sidebar [hidden] {
  display: none !important;
}

.sidebar-collapse {
  position: absolute;
  bottom: 18px;
  right: 10px;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 2px;
  background: rgba(255, 255, 255, .06);
  color: #c8cac5;
  font-size: 17px !important;
  line-height: 1;
}

.sidebar-collapse:hover {
  color: white;
  background: rgba(255, 255, 255, .12);
}

.layout.sidebar-collapsed {
  grid-template-columns: 68px minmax(0, 1fr);
}

.layout.sidebar-collapsed .sidebar {
  padding-inline: 8px;
}

.layout.sidebar-collapsed .brand {
  height: 48px;
  margin-bottom: 20px;
  padding: 0;
}

.layout.sidebar-collapsed .brand-logo,
.layout.sidebar-collapsed .nav-title,
.layout.sidebar-collapsed .nav a span:not(.nav-icon) {
  display: none;
}

.layout.sidebar-collapsed .brand::after {
  content: "F";
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  color: var(--accent);
  font-size: 22px;
  font-weight: 900;
}

.layout.sidebar-collapsed .nav a {
  justify-content: center;
  padding-inline: 8px;
}

.layout.sidebar-collapsed .nav-icon {
  width: auto;
}

.layout.sidebar-collapsed .sidebar-collapse {
  right: 20px;
}

.brand {
  display: flex;
  align-items: center;
  margin: 0 0 20px;
  padding: 8px 6px 10px;
  background: transparent;
}

.brand-logo {
  display: block;
  width: 190px;
  max-width: 100%;
  height: auto;
  object-fit: contain;
}

.nav-title {
  color: #868b86;
  text-transform: uppercase;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .12em;
  padding: 10px 12px 7px;
}

.nav {
  display: grid;
  gap: 4px;
}

.nav a {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border-radius: 2px;
  color: #c8cac5;
  font-size: 13px;
  font-weight: 590;
  transition: .16s ease;
}

body:not(.nav-authorized) .nav a[data-nav] {
  visibility: hidden;
}

body:not(.nav-authorized) .nav a[href="/docs"] {
  visibility: hidden;
}

.nav a:hover {
  background: rgba(255, 255, 255, .055);
  color: white;
}

.nav a.active {
  color: var(--sidebar);
  background: var(--accent);
  box-shadow: inset 3px 0 0 var(--gold);
}

.nav-icon {
  width: 18px;
  text-align: center;
  font-size: 14px;
  opacity: .9;
}

.sidebar-foot {
  margin-top: auto;
  padding: 14px 10px 4px;
  color: #7d9094;
  font-size: 11px;
  line-height: 1.55;
}

.workspace {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  min-height: 64px;
  background: rgba(244, 242, 234, .96);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar-left,
.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.page-title {
  font-weight: 750;
  font-size: 15px;
  letter-spacing: -.01em;
}

.mobile-menu {
  display: none;
  border: 0;
  background: transparent;
  font-size: 12px;
  padding: 2px;
}

.pipeline-pill {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 2px 2px;
  color: var(--muted);
  font-size: 11px;
  background: white;
}

.pipeline-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 3px var(--green-soft);
}

.pipeline-dot.warn {
  background: var(--amber);
  box-shadow: 0 0 0 3px var(--amber-soft);
}

.pipeline-dot.bad {
  background: var(--red);
  box-shadow: 0 0 0 3px var(--red-soft);
}

.page {
  width: 100%;
  max-width: 1500px;
  margin: 0 auto;
  padding: 26px 28px 54px;
}

.hero-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}

.hero-row h1 {
  margin: 0;
  font-size: 24px;
  line-height: 1.2;
  letter-spacing: -.03em;
  font-weight: 500;
}

.hero-row p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
  max-width: 760px;
}

.prediction-controls {
  flex-wrap: nowrap;
}

.prediction-controls>* {
  flex: 0 0 auto;
}

.actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.btn {
  height: 38px;
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: 2px;
  padding: 8px 13px;
  font-weight: 800;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  white-space: nowrap;
  transition: .15s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  background: var(--sidebar);
  color: white;
  border-color: var(--sidebar);
}

.btn-accent {
  background: var(--accent);
  color: var(--sidebar);
  border-color: var(--accent);
}

.btn-secondary {
  background: white;
  color: var(--text);
  border-color: var(--line-strong);
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
  border-color: transparent;
}

.btn-danger {
  background: var(--red-soft);
  color: var(--red);
  border-color: #f3cccc;
}

.btn-success {
  background: var(--green-soft);
  color: var(--green);
  border-color: #c9e8da;
}

.btn-export {
  background: #e0862b;
  color: #fff;
  border-color: #e0862b;
}

.btn-export:hover {
  background: #c46f1c;
  border-color: #c46f1c;
}

.export-bookmaker-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 6px 14px;
}

.export-bookmaker-option {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 400;
  cursor: pointer;
}

.export-bookmaker-option input {
  width: auto;
  margin: 0;
}

.btn-sm {
  height: 30px;
  min-height: 30px;
  padding: 5px 9px;
  font-size: 11px;
  border-radius: 2px;
}

.btn-block {
  width: 100%;
}

.table-filter-link {
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--text);
  font-weight: 800;
  text-align: left;
  text-decoration: underline;
  text-decoration-color: var(--gold);
  text-underline-offset: 3px;
}

.table-filter-link:hover,
.table-filter-link:focus-visible {
  color: var(--gold-deep);
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 13px;
  margin-bottom: 18px;
}

.kpi {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  border-top: 3px solid var(--gold);
}

.kpi-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
  margin-bottom: 9px;
}

.kpi-value {
  font-size: 25px;
  font-weight: 780;
  letter-spacing: -.035em;
  line-height: 1;
}

.kpi-meta {
  margin-top: 8px;
  font-size: 10px;
  color: var(--muted);
}

.positive {
  color: var(--positive) !important;
  font-weight: 700;
}

.negative {
  color: var(--negative) !important;
  font-weight: 700;
}

.neutral {
  color: var(--text) !important;
}

.grid-2 {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(300px, .65fr);
  gap: 15px;
}

.grid-even {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 15px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 15px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  min-width: 0;
}

.card-head {
  min-height: 52px;
  padding: 14px 17px;
  border-bottom: 1px solid var(--line);
  border-top: 3px solid var(--accent);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.card-title {
  margin: 0;
  font-size: 13px;
  font-weight: 760;
}

.card-body {
  padding: 17px;
}

.card-body.flush {
  padding: 0;
}

.security-kpis {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.security-search {
  width: min(260px, 42vw);
}

.security-role-list,
.permission-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.security-role-badge,
.permission-list span {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 4px 7px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--surface-soft);
  color: var(--text);
  font-size: 10px;
  font-weight: 700;
}

.table-actions {
  display: flex;
  justify-content: flex-end;
  gap: 4px;
  min-width: 250px;
}

.security-role-section {
  margin-top: 22px;
}

.security-groups-card {
  margin-top: 16px;
}

.section-heading {
  margin-bottom: 12px;
}

.section-heading h2 {
  margin: 0;
  font-size: 16px;
}

.security-role-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.security-role-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 3px solid var(--gold);
  border-radius: var(--radius);
  padding: 16px;
  min-width: 0;
}

.security-role-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.security-role-card-head span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
}

.security-role-card p {
  min-height: 32px;
  margin: 8px 0 12px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.role-system-label,
.role-manage-btn {
  margin-top: 12px;
}

.role-data-scope {
  margin-bottom: 10px;
  color: var(--muted);
  text-transform: capitalize;
}

.role-scope-field {
  margin-top: 14px;
}

.role-picker {
  margin: 18px 0 0;
  padding: 0;
  border: 0;
}

.role-picker legend {
  margin-bottom: 8px;
  font-size: 11px;
  font-weight: 750;
}

.role-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.role-options-stacked {
  grid-template-columns: 1fr;
}

.permission-options {
  display: grid;
  gap: 14px;
  max-height: 330px;
  overflow: auto;
}

.permission-section h3 {
  margin: 0 0 7px;
  font-size: 11px;
  text-transform: uppercase;
  color: var(--muted);
}

.permission-section-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.permission-option {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 2px;
  cursor: pointer;
}

.permission-option:has(input:checked) {
  background: var(--green-soft);
  border-color: var(--green);
}

.permission-option input {
  width: auto;
  margin: 2px 0 0;
}

.permission-option span,
.permission-option small {
  display: block;
  min-width: 0;
}

.permission-option strong {
  font-size: 11px;
}

.permission-option small {
  margin-top: 3px;
  color: var(--muted);
  line-height: 1.35;
}

.form-grid-wide {
  grid-column: 1 / -1;
}

.group-add-member {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto auto;
  align-items: center;
  gap: 8px;
  margin-bottom: 15px;
}

.check-line {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  white-space: nowrap;
}

.check-line input {
  width: auto;
}

.group-member-list {
  display: grid;
  gap: 7px;
}

.group-member-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 10px;
  border: 1px solid var(--line);
}

.group-member-row small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
}

.role-option {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 2px;
  cursor: pointer;
}

.role-option:has(input:checked) {
  border-color: var(--accent-strong);
  background: var(--accent-soft);
}

.role-option input {
  width: auto;
  margin: 2px 0 0;
}

.role-option span,
.role-option small {
  display: block;
  min-width: 0;
}

.role-option small {
  margin-top: 3px;
  color: var(--muted);
  line-height: 1.35;
}

@media (max-width: 820px) {

  .security-role-grid,
  .role-options,
  .permission-section-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .group-add-member {
    grid-template-columns: minmax(0, 1fr);
  }

  .table-actions {
    min-width: 220px;
  }
}

/* Touch devices can report a desktop-sized layout viewport; keep the app shell mobile. */
html.mobile-app-mode .layout,
html.mobile-app-mode .layout.sidebar-collapsed {
  display: block !important;
  grid-template-columns: 1fr !important;
}

html.mobile-app-mode .layout .sidebar,
html.mobile-app-mode .layout.sidebar-collapsed .sidebar,
html.mobile-app-mode .mobile-menu,
html.mobile-app-mode .sidebar-collapse,
html.mobile-app-mode .mobile-nav-close {
  display: none !important;
}

html.mobile-app-mode .workspace {
  width: 100% !important;
  min-width: 0 !important;
}

html.mobile-app-mode .topbar {
  position: sticky !important;
  top: 0;
  z-index: 100;
  min-height: 56px;
  padding: 8px 12px !important;
  background: #ffffff !important;
  border-bottom: 1px solid #dbe5e1;
  box-shadow: 0 2px 12px rgba(16, 27, 26, .08);
}

html.mobile-app-mode .page {
  width: 100% !important;
  max-width: none !important;
  padding: 14px 10px 96px !important;
}

html.mobile-app-mode body,
html.mobile-app-mode button,
html.mobile-app-mode input,
html.mobile-app-mode select,
html.mobile-app-mode textarea {
  font-size: 16px;
}

html.mobile-app-mode .page-title {
  font-size: 17px;
  font-weight: 800;
}

html.mobile-app-mode h1 {
  font-size: 30px !important;
  line-height: 1.12;
}

html.mobile-app-mode h2 {
  font-size: 22px !important;
}

html.mobile-app-mode .card,
html.mobile-app-mode .kpi,
html.mobile-app-mode .bet-draft-banner,
html.mobile-app-mode .drop {
  font-size: 15px;
}

html.mobile-app-mode .small,
html.mobile-app-mode .muted,
html.mobile-app-mode .help,
html.mobile-app-mode .hint {
  font-size: 14px !important;
}

html.mobile-app-mode label,
html.mobile-app-mode .field label,
html.mobile-app-mode .card-title,
html.mobile-app-mode .bet-wizard-progress strong {
  font-size: 15px !important;
}

html.mobile-app-mode .bet-wizard-progress button,
html.mobile-app-mode .bet-wizard-progress span {
  min-height: 48px;
  font-size: 14px !important;
}

html.mobile-app-mode .field input,
html.mobile-app-mode .field select,
html.mobile-app-mode .field textarea,
html.mobile-app-mode .actions>.btn {
  min-height: 52px !important;
  font-size: 17px !important;
}

html.mobile-app-mode .category-label-action {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border: 1px solid #b8d8cc;
  border-radius: 9px;
  color: #176b59;
  background: #e8f3ef;
  font-size: 15px !important;
  cursor: pointer;
}

html.mobile-app-mode .mobile-quick-nav {
  position: fixed !important;
  display: grid !important;
  left: 8px !important;
  right: 8px !important;
  bottom: max(8px, env(safe-area-inset-bottom)) !important;
  z-index: 1000 !important;
  grid-template-columns: 1fr 1.3fr 1fr;
  gap: 6px;
  padding: 7px !important;
  border: 1px solid #c9ded6;
  border-radius: 18px;
  background: rgba(255, 255, 255, .98);
  box-shadow: 0 8px 28px rgba(16, 27, 26, .2);
  overflow-x: auto;
  scrollbar-width: none;
}

html.mobile-app-mode .mobile-quick-nav::-webkit-scrollbar {
  display: none;
}

html.mobile-app-mode .mobile-quick-nav a {
  display: grid !important;
  place-items: center;
  min-height: 44px;
  border-radius: 11px;
  color: #31504a;
  text-decoration: none;
  font-size: 40px !important;
  min-width: 88px;
  min-height: 72px !important;
  flex: 1 0 88px;
}

html.mobile-app-mode .mobile-quick-nav a:not(.active):not(.central) {
  background: transparent;
  color: #64736e;
}

html.mobile-app-mode .mobile-quick-nav a.active:not(.central) {
  color: #ffffff;
  background: #0f5a49;
  box-shadow: inset 0 0 0 1px #0b493b, 0 4px 12px rgba(15, 90, 73, .24);
}

html.mobile-app-mode .mobile-quick-nav a.central {
  min-height: 82px !important;
  margin-top: -20px;
  color: #ffffff;
  background: #eef5f2;
  color: #176b59;
  border: 1px solid #b8d8cc;
  box-shadow: 0 6px 16px rgba(23, 107, 89, .32);
}

html.mobile-app-mode .mobile-quick-nav a.central.active {
  color: #ffffff;
  background: #176b59;
  border-color: #176b59;
}

.login-install {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.login-install-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.login-install-note {
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

@media (max-width: 520px) {
  .login-install-actions .btn {
    flex: 1 1 100%;
  }
}

.login-remember {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
}

.login-remember input {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: #176b59;
}

html.mobile-app-mode .mobile-quick-nav a small {
  font-size: 14px !important;
  font-weight: 800;
}

html.mobile-app-mode,
html.mobile-app-mode body {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  overscroll-behavior-x: none;
}

html.mobile-app-mode .field input,
html.mobile-app-mode .field select,
html.mobile-app-mode .field textarea,
html.mobile-app-mode .filterbar input,
html.mobile-app-mode .filterbar select,
html.mobile-app-mode .actions input,
html.mobile-app-mode .actions select,
html.mobile-app-mode button,
html.mobile-app-mode .btn {
  font-size: 17px !important;
  min-height: 54px !important;
}

html.mobile-app-mode .field label,
html.mobile-app-mode .field>label,
html.mobile-app-mode .card-title {
  font-size: 16px !important;
  line-height: 1.3;
}

html.mobile-app-mode .bet-wizard-progress button {
  min-height: 54px !important;
  font-size: 15px !important;
}

html.mobile-app-mode .login-shell {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0;
  background: #f4f7f5;
}

html.mobile-app-mode .login-panel {
  min-height: 0;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 18px 14px 28px;
  order: 2;
}

html.mobile-app-mode .login-card {
  width: 100%;
  max-width: 520px;
  padding: 32px 24px 28px;
  border-radius: 20px;
  box-shadow: 0 12px 32px rgba(16, 27, 26, .14);
}

html.mobile-app-mode .login-brand .brand-logo {
  width: 150px;
  height: auto;
}

html.mobile-app-mode .login-card h1 {
  margin: 22px 0 10px;
  font-size: 32px;
  line-height: 1.1;
}

html.mobile-app-mode .login-card .field label {
  margin-bottom: 8px;
  font-size: 15px;
  font-weight: 700;
}

html.mobile-app-mode .login-card input:not([type="checkbox"]) {
  min-height: 54px;
  padding: 13px 14px;
  border-radius: 10px;
  font-size: 17px;
}

html.mobile-app-mode .login-card .btn-block {
  min-height: 54px;
  margin-top: 22px;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 800;
}

html.mobile-app-mode .login-remember {
  margin-top: 16px;
  font-size: 14px;
}

html.mobile-app-mode .login-visual {
  display: flex !important;
  order: 1;
  align-items: center;
  justify-content: center;
  min-height: 96px;
  padding: 20px 24px;
  background: #101b1a;
}

html.mobile-app-mode .login-visual-copy {
  width: 100%;
  display: flex;
  justify-content: center;
}

html.mobile-app-mode .login-visual-copy .brand-logo {
  width: 160px;
  height: auto;
}

.bet-draft-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 12px 0;
  padding: 12px 16px;
  border: 1px solid #b9d8cc;
  border-left: 4px solid #14745c;
  background: #f2faf7;
  color: #173f35;
}

.bet-draft-banner[hidden] {
  display: none !important;
}

.stack {
  display: grid;
  gap: 12px;
}

.status {
  display: inline-flex;
  align-items: center;
  border-radius: 2px;
  font-size: 10px;
  line-height: 1;
  font-weight: 760;
  padding: 5px 8px;
  border: 1px solid transparent;
  text-transform: uppercase;
  letter-spacing: .02em;
}

.status.success,
.status.won,
.status.loaded {
  color: var(--green);
  background: var(--green-soft);
  border-color: #cbe8da;
}

.status.failed,
.status.lost {
  color: var(--red);
  background: var(--red-soft);
  border-color: #f1cccc;
}

.status.open,
.status.running,
.status.pending {
  color: var(--blue);
  background: var(--blue-soft);
  border-color: #cedfea;
}

.status.partial,
.status.void,
.status.skipped,
.status.cashed_out {
  color: var(--amber);
  background: var(--amber-soft);
  border-color: #f1ddb3;
}

.table-wrap {
  width: 100%;
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}

th {
  text-align: left;
  color: #768185;
  font-weight: 760;
  background: var(--surface-soft);
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

td {
  padding: 10px 12px;
  border-bottom: 1px solid #edf0f1;
  vertical-align: middle;
}

tbody tr:hover {
  background: #fafbfb;
}

tbody tr:last-child td {
  border-bottom: 0;
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 10px;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.empty {
  min-height: 150px;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--muted);
  padding: 28px;
  font-size: 12px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 13px 15px;
}

.form-grid.cols-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.field {
  min-width: 0;
}

.field label {
  display: block;
  font-size: 10px;
  font-weight: 750;
  color: #596469;
  margin-bottom: 6px;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  height: 38px;
  min-height: 38px;
  border: 1px solid var(--line-strong);
  background: #fff;
  color: var(--text);
  border-radius: 2px;
  padding: 8px 10px;
  outline: none;
  transition: .15s;
  font-size: 12px;
}

.field textarea {
  height: auto;
  min-height: 78px;
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--accent-strong);
  box-shadow: 0 0 0 3px rgba(200, 217, 47, .18);
}

.field .hint {
  margin-top: 5px;
  color: var(--muted);
  font-size: 9px;
}

.span-2 {
  grid-column: span 2;
}

.span-3 {
  grid-column: span 3;
}

.bet-wizard-progress {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}

.bet-wizard-progress button {
  position: relative;
  min-height: 62px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border: 0;
  border-right: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  font-size: 11px;
}

.bet-wizard-progress button:last-child {
  border-right: 0;
}

.bet-wizard-progress button span {
  width: 25px;
  height: 25px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: var(--surface-soft);
  font-weight: 800;
}

.bet-wizard-progress button.active {
  color: var(--text);
  box-shadow: inset 0 -3px 0 var(--accent);
}

.bet-wizard-progress button.active span {
  border-color: var(--sidebar);
  background: var(--sidebar);
  color: white;
}

.bet-wizard-progress button.complete {
  color: var(--text);
}

.bet-wizard-progress button.complete span {
  border-color: var(--green);
  background: var(--green-soft);
  color: var(--positive);
}

.bet-wizard-progress button:disabled {
  cursor: default;
  opacity: .65;
}

.bet-wizard-content>.stack {
  display: contents;
}

.wizard-step[hidden] {
  display: none !important;
}

.bet-wizard-content .slip-summary {
  position: static;
}

.bet-wizard-actions {
  position: sticky;
  bottom: 0;
  z-index: 12;
  min-height: 66px;
  margin-top: 14px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 9px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .97);
  box-shadow: 0 -8px 24px rgba(17, 19, 21, .06);
}

.bet-wizard-actions #wizardStepLabel {
  margin-right: auto;
}

.bet-wizard-actions [hidden] {
  display: none !important;
}

.bet-type-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
}

.bet-type-card {
  position: relative;
  width: 100%;
  font: inherit;
  color: inherit;
  text-align: left;
  border: 1px solid var(--line);
  background: white;
  border-radius: 2px;
  padding: 12px;
  cursor: pointer;
  transition: .15s;
}

.bet-type-card:hover,
.bet-type-card:focus-visible {
  border-color: var(--gold);
}

.bet-type-card:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

.bet-type-card.selected {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: inset 0 0 0 1px rgba(150, 166, 36, .22);
}

.bet-type-card strong {
  display: block;
  font-size: 11px;
}

.bet-type-card span {
  display: block;
  color: var(--muted);
  font-size: 9px;
  margin-top: 4px;
}

.bet-type-card .bet-type-tooltip {
  position: absolute;
  z-index: 20;
  left: 10px;
  bottom: calc(100% + 8px);
  display: none;
  width: max-content;
  max-width: min(280px, calc(100vw - 48px));
  margin: 0;
  padding: 9px 10px;
  border-radius: 3px;
  background: #20251d;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .2);
  color: #fff;
  font-size: 10px;
  line-height: 1.45;
  pointer-events: none;
}

.bet-type-card .bet-type-tooltip::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 18px;
  border: 5px solid transparent;
  border-top-color: #20251d;
}

.bet-type-card:hover .bet-type-tooltip,
.bet-type-card:focus-visible .bet-type-tooltip {
  display: block;
}

.category-selection {
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 2px;
}

.category-option-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.category-option {
  min-height: 58px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--surface-soft);
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}

.category-option:hover,
.category-option:focus-visible {
  border-color: var(--accent);
  background: var(--accent-soft);
  outline: none;
}

.pagination {
  min-height: 34px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid var(--line);
}

.pagination-actions {
  display: flex;
  gap: 6px;
}

@media (max-width: 480px) {
  .category-option-grid {
    grid-template-columns: 1fr;
  }

  .bet-wizard-progress button {
    min-height: 54px;
    gap: 0;
  }

  .bet-wizard-progress button strong {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }
}

.selection-list {
  display: grid;
  gap: 10px;
}

.selection-card {
  border: 1px solid var(--line);
  border-radius: 2px;
  background: var(--surface-soft);
  overflow: hidden;
}

.selection-head {
  padding: 9px 11px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: white;
}

.selection-head-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.selection-num {
  font-size: 10px;
  font-weight: 780;
}

.selection-body {
  padding: 12px;
  display: grid;
  grid-template-columns: 1.5fr 1.5fr 1fr .8fr .8fr;
  gap: 10px;
  align-items: end;
}

.race-selection-field {
  grid-column: 1 / -1;
}

.bet-builder-race-buttons {
  display: grid;
  gap: 8px;
}

.selection-extra {
  padding: 0 12px 12px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.slip-summary {
  position: sticky;
  top: 84px;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid #edf0f1;
  font-size: 11px;
}

.summary-row:last-child {
  border-bottom: 0;
}

.summary-total {
  padding-top: 15px;
  margin-top: 5px;
  border-top: 1px solid var(--line-strong);
}

.summary-total strong {
  font-size: 20px;
  letter-spacing: -.02em;
}

.race-groups {
  display: grid;
  gap: 15px;
}

.course-group {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.course-head {
  padding: 13px 16px;
  background: var(--surface-soft);
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.course-head strong {
  font-size: 13px;
}

.race-row {
  display: grid;
  grid-template-columns: 72px minmax(220px, 1.4fr) repeat(4, minmax(90px, .55fr)) 90px;
  gap: 10px;
  align-items: center;
  padding: 12px 15px;
  border-bottom: 1px solid #edf0f1;
}

.race-row:last-child {
  border-bottom: 0;
}

.race-row:hover {
  background: #fafbfb;
}

.race-time {
  font-size: 16px;
  font-weight: 790;
  letter-spacing: -.02em;
}

.race-name {
  font-size: 11px;
  font-weight: 730;
}

.race-meta {
  margin-top: 4px;
  color: var(--muted);
  font-size: 9px;
}

.runner-panel {
  border-top: 1px dashed var(--line-strong);
  background: #fbfcfc;
  padding: 10px 15px 14px;
}

.runner-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 8px;
}

.runner-card {
  border: 1px solid var(--line);
  border-radius: 2px;
  background: white;
  padding: 10px;
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.runner-card.winner {
  border-color: #b5c800;
  background: #f7fbdc;
}

.runner-card.non-runner {
  opacity: .65;
}

.runner-result {
  margin-top: 6px;
  color: #435000;
  font-size: 12px;
}

.runner-prediction,
.prediction-cell span {
  display: block;
  margin-top: 5px;
  color: #496000;
  font-size: 10px;
}

.prediction-cell {
  background: #f3f9c8 !important;
}

.prediction-cell strong {
  color: #203000;
  font-size: 15px;
}

.prediction-cell .prediction-rank-badge {
  display: inline-block;
  margin-top: 3px;
  padding: 2px 6px;
  border-radius: 10px;
  font-weight: 700;
}

.odds-checker-table tr.top-three-1,
.runner-card.top-three-1 {
  background: rgba(200, 217, 47, .18);
  border-left: 4px solid #a4b51d;
}

.odds-checker-table tr.top-three-1 td {
  background: #f1f5f7;
}

.odds-checker-table tr.top-three-2,
.runner-card.top-three-2 {
  background: rgba(50, 116, 196, .12);
  border-left: 4px solid #3274c4;
}

.odds-checker-table tr.top-three-2 td {
  background: #f6f7f8;
}

.odds-checker-table tr.top-three-3,
.runner-card.top-three-3 {
  background: rgba(220, 155, 33, .14);
  border-left: 4px solid #dc9b21;
}

.odds-checker-table tr.top-three-3 td {
  background: #faf8f3;
}

.odds-checker-table tr.top-three-1 td:first-child {
  border-left: 4px solid #355f76;
}

.odds-checker-table tr.top-three-2 td:first-child {
  border-left: 4px solid #71818a;
}

.odds-checker-table tr.top-three-3 td:first-child {
  border-left: 4px solid #9b8050;
}

.top-three-1 .prediction-rank-badge {
  background: #c8d92f;
  color: #17210a;
}

.top-three-2 .prediction-rank-badge {
  background: #3274c4;
  color: #fff;
}

.top-three-3 .prediction-rank-badge {
  background: #dc9b21;
  color: #2b1b00;
}

.runner-prediction strong {
  color: #203000;
}

.bookmaker-odds {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 4px;
  margin-top: 7px;
  max-width: 280px;
}

.odds-quote {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 5px;
  border: 1px solid #d7d9d0;
  background: #fff;
  font-size: 10px;
}

.odds-quote strong {
  color: #172116;
  font-size: 11px;
}

.dashboard-race-odds {
  margin-top: 15px;
}

.dashboard-wide {
  width: 100%;
}

.dashboard-chart-tabs {
  display: flex;
  border-bottom: 1px solid var(--line);
  padding: 0 12px;
}

.dashboard-chart-tab {
  border: 1px solid transparent;
  border-bottom: 0;
  background: transparent;
  padding: 9px 12px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  cursor: pointer;
}

.dashboard-chart-tab.active {
  border-color: var(--line);
  background: var(--surface);
  color: var(--sidebar);
}

.dashboard-line-chart {
  padding: 12px 15px 16px;
}

.line-chart-scroll {
  overflow-x: auto;
}

.line-chart-scroll svg {
  display: block;
  min-width: 0;
  width: 100%;
  max-width: none;
  height: 340px;
  background: #fbfcf8;
}

.chart-axis {
  stroke: #cfd5ca;
  stroke-width: 1;
}

.chart-axis-label,
.chart-label {
  font-family: inherit;
  font-size: 10px;
  font-weight: 700;
}

.chart-grid {
  stroke: #e0e5dc;
  stroke-width: 1;
}

.chart-point {
  cursor: crosshair;
  stroke: #fff;
  stroke-width: 1;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin-top: 10px;
  font-size: 10px;
}

.chart-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.chart-legend-item i {
  width: 10px;
  height: 3px;
  display: inline-block;
}

.dashboard-race-grid {
  padding: 15px;
}

.odds-checker-controls {
  padding: 12px 15px 0;
  display: grid;
  gap: 12px;
}

.odds-controls-inline {
  display: flex;
  align-items: flex-start;
  gap: 22px;
  flex-wrap: wrap;
}

.odds-agent-select {
  flex: 1 1 260px;
}

.agent-dropdown {
  position: relative;
  min-width: 230px;
  max-width: 360px;
}

.agent-dropdown-button {
  width: 100%;
  height: 34px;
  border: 1px solid #d4d8cb;
  background: #f7f8f2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 10px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.agent-dropdown-menu {
  position: absolute;
  z-index: 30;
  top: calc(100% + 4px);
  left: 0;
  min-width: 230px;
  max-width: 360px;
  width: 100%;
  max-height: 320px;
  border: 1px solid #d4d8cb;
  background: #f7f8f2;
  box-shadow: 0 14px 28px rgba(18, 25, 22, .14);
}

.agent-dropdown-actions {
  display: flex;
  justify-content: flex-start;
  gap: 8px;
  padding: 8px;
  border-bottom: 1px solid #d4d8cb;
}

.agent-dropdown-actions button {
  border: 0;
  background: transparent;
  padding: 4px 6px;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
}

.agent-dropdown-options {
  max-height: 268px;
  overflow: auto;
  padding: 4px 0;
}

.agent-checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.agent-checkbox-row:hover {
  background: #eef2cd;
}

.agent-checkbox-row input {
  width: 14px;
  height: 14px;
}

.odds-control-group {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.odds-control-label {
  min-width: 80px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.odds-control-buttons {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
}

.odds-filter-button {
  border: 1px solid #d4d8cb;
  border-radius: 14px;
  padding: 7px 14px;
  background: #f7f8f2;
  color: #1d251a;
  font-size: 11px;
  font-weight: 750;
  cursor: pointer;
}

.odds-filter-button.selected {
  border-color: var(--accent);
  background: var(--accent);
  color: #1f1b16;
}

#dashboardAgentButtons {
  max-height: 92px;
  overflow-y: auto;
}

.odds-table-scroll {
  overflow-x: auto;
  padding: 0 15px 15px;
}

.odds-checker-table {
  min-width: 980px;
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}

.odds-checker-table th {
  background: #141a16;
  color: #fff;
  padding: 10px 8px;
  text-align: center;
  white-space: nowrap;
  font-size: 9px;
}

.odds-checker-table th:first-child,
.odds-checker-table td:first-child {
  text-align: left;
  position: sticky;
  left: 0;
  z-index: 1;
  background: #fff;
}

.odds-checker-table td {
  min-width: 64px;
  padding: 8px;
  border: 1px solid #dfe2d9;
  text-align: center;
  vertical-align: middle;
}

.odds-checker-table tr.winner td {
  background: #f4f8d2;
}

.odds-checker-table tr.winner td:first-child {
  background: #eaf2ae;
}

.odds-checker-table td.best-odds {
  background: #d7ff3f !important;
  color: #101900;
  box-shadow: inset 0 0 0 2px #a8d900;
}

.odds-checker-table td.best-odds strong {
  font-size: 15px;
}

.odds-checker-table tr.non-runner {
  opacity: .6;
}

.table-subtext,
.bookmaker-cell span {
  display: block;
  color: var(--muted);
  font-size: 9px;
  margin-top: 3px;
}

.bookmaker-cell strong,
.consensus-cell {
  font-size: 13px;
}

.dashboard-race-heading {
  display: flex;
  gap: 12px;
  align-items: baseline;
  padding-bottom: 12px;
}

.dashboard-runner-list {
  display: grid;
  gap: 6px;
}

.dashboard-runner {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) 90px minmax(260px, 2fr) 90px;
  gap: 10px;
  align-items: center;
  padding: 9px 10px;
  border: 1px solid #e0e2d8;
  background: #fff;
}

.dashboard-runner.winner {
  border-color: #b5c800;
  background: #f7fbdc;
}

.dashboard-runner.non-runner {
  opacity: .65;
}

.dashboard-runner-name,
.dashboard-runner-consensus {
  display: grid;
  gap: 3px;
}

.dashboard-runner-consensus strong {
  font-size: 18px;
}

.dashboard-bookmakers {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.dashboard-runner-action {
  text-align: right;
  font-size: 11px;
  font-weight: 700;
  color: #69705c;
}

@media (max-width: 850px) {
  .dashboard-runner {
    grid-template-columns: 1fr auto;
  }

  .dashboard-bookmakers {
    grid-column: 1 / -1;
  }
}

.runner-name {
  font-weight: 740;
  font-size: 11px;
}

.runner-meta {
  color: var(--muted);
  font-size: 9px;
  margin-top: 4px;
}

.odds {
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.chip {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 4px 7px;
  font-size: 9px;
  color: var(--muted);
  background: white;
}

.chip.accent {
  background: var(--accent-soft);
  border-color: #d8df93;
  color: var(--accent-strong);
}

.bet-type-chip {
  background: #e8f3ef;
  border-color: #9bc9b8;
  color: #145c4a;
  font-weight: 800;
  letter-spacing: .02em;
}

.result-won {
  color: #08734f;
  font-weight: 800;
}

.result-lost {
  color: #b4232f;
  font-weight: 800;
}

.result-void,
.result-non-runner {
  color: #956300;
  font-weight: 800;
}

.result-pending {
  color: var(--muted);
}

.ledger-action {
  min-width: 82px;
  font-weight: 700;
  font-size: 12px;
  text-align: center;
}

.bets-ledger-table {
  table-layout: auto;
  width: 100%;
  min-width: 1260px;
}

.bets-ledger-table .col-placed {
  width: 132px;
}

.bets-ledger-table .col-agent {
  width: 90px;
}

.bets-ledger-table .col-user {
  width: 58px;
}

.bets-ledger-table .col-category {
  width: 92px;
}

.bets-ledger-table .col-type {
  width: 94px;
}

.bets-ledger-table .col-selection {
  width: 45%;
}

.bets-ledger-table .col-expected,
.bets-ledger-table .col-return-pnl {
  width: 138px;
}

.bets-ledger-table .col-actions {
  width: 286px;
}

.bets-ledger-table th,
.bets-ledger-table td {
  padding-top: 7px;
  padding-bottom: 7px;
  line-height: 1.25;
  vertical-align: top;
}

.bets-ledger-table td:not(.ledger-selection):not(.ledger-actions-cell) {
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  word-break: normal;
}

.ledger-selection {
  min-width: 0;
  width: 100%;
}

.ledger-selection-panel {
  border: 1px solid #dde6e3;
  border-radius: 12px;
  background: linear-gradient(180deg, #ffffff 0%, #f7fbf9 100%);
  padding: 8px 10px;
}

.ledger-selection-summary {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: .04em;
  font-size: 11px;
  color: #2f4b44;
}

.ledger-selection-summary strong {
  font-size: 11px;
}

.ledger-selection-summary-loss {
  color: #b4232f;
  font-weight: 700;
}

.ledger-stake-chip {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 9px;
  border-radius: 999px;
  border: 1px solid #b9d8cb;
  background: #edf8f3;
  color: #145c4a;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: none;
}

.ledger-selection-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
  margin-bottom: 5px;
}

.ledger-selection-item:last-child {
  margin-bottom: 0;
}

.ledger-selection-main {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: nowrap;
  min-width: 160px;
}

.ledger-selection-item strong {
  display: inline;
  line-height: 1.2;
  white-space: nowrap;
  overflow-wrap: normal;
  word-break: normal;
}

.ledger-selection-meta {
  line-height: 1.2;
  white-space: nowrap;
  overflow-wrap: normal;
  word-break: normal;
}

.ledger-selection-result-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 78px;
  height: 30px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  padding: 0 10px;
  border: 1px solid rgba(16, 97, 73, .12);
  background: #eef8f3;
}

.ledger-selection-result-chip.result-won {
  color: #0b6e4a;
  background: #eaf8f1;
  border-color: #bfe5d2;
}

.ledger-selection-result-chip.result-lost {
  color: #b4232f;
  background: #fff2f3;
  border-color: #f0c0c6;
}

.ledger-selection-result-chip.result-void,
.ledger-selection-result-chip.result-non-runner {
  color: #865a00;
  background: #fff8e2;
  border-color: #ecd594;
}

.ledger-selection-result-chip.result-pending {
  color: #4b5d57;
  background: #eff3f2;
  border-color: #d7e0dd;
}

.ledger-actions-cell {
  padding-top: 6px;
}

.ledger-actions-inline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: nowrap;
}

.ledger-inline-status {
  flex: 0 0 auto;
}

.ledger-actions-desktop {
  position: relative;
}

.ledger-actions-mobile {
  display: none;
  align-items: center;
  gap: 4px;
}

.ledger-actions-menu {
  position: relative;
}

.ledger-actions-menu > summary {
  list-style: none;
  cursor: pointer;
}

.ledger-actions-menu > summary::-webkit-details-marker {
  display: none;
}

.menu-toggle-action {
  min-width: 34px;
  width: 34px;
  padding: 0;
  font-size: 18px;
  line-height: 1;
}

.ledger-actions-menu-list {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 4;
  min-width: 126px;
  display: none;
  flex-direction: column;
  gap: 5px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 8px 22px rgba(16, 27, 26, .14);
}

.ledger-actions-menu[open] .ledger-actions-menu-list {
  display: flex;
}

.ledger-actions-menu-list .ledger-action {
  width: 100%;
  justify-content: center;
}

.ledger-icon-action {
  min-width: 28px !important;
  width: 28px;
  height: 28px;
  min-height: 28px;
  padding: 0;
  font-size: 13px;
}

.ledger-pair-cell {
  min-width: 0;
}

.ledger-pair-box {
  border: 1px solid #dde6e3;
  border-radius: 10px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbfa 100%);
  padding: 7px 9px;
}

.ledger-pair-line {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.ledger-pair-line + .ledger-pair-line {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px dashed #d8e4e0;
}

.ledger-pair-label {
  color: var(--muted);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .04em;
  white-space: nowrap;
}

.ledger-pair-line strong {
  font-size: 15px;
  line-height: 1.2;
  white-space: nowrap;
}

.ledger-actions-group {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: nowrap;
  gap: 4px;
}

.ledger-actions-group .ledger-action {
  min-width: 66px;
  width: auto;
  height: 26px;
  min-height: 26px;
  padding: 2px 6px;
  font-size: 10px;
  white-space: nowrap;
}

.mobile-quick-nav {
  display: none;
}

.details-action {
  color: #174f6d;
  background: #eef7fb;
  border-color: #a8cbdc;
}

.delete-action {
  color: #8a2830;
  background: #fff2f2;
  border-color: #e4b5b9;
}

.settle-action {
  color: #ffffff;
  background: #176b59;
  border-color: #176b59;
}

.override-action {
  color: #7a4a08;
  background: #fff7df;
  border-color: #e1bd63;
}

.filterbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.filterbar input,
.filterbar select {
  height: 38px;
  min-height: 38px;
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  background: white;
  padding: 6px 9px;
  font-size: 11px;
  outline: none;
}

.actions>input,
.actions>select,
.date-control {
  height: 38px;
  min-height: 38px;
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  background: #fff;
  color: var(--text);
  padding: 7px 9px;
  font-size: 12px;
  outline: none;
}

.metric-list {
  display: grid;
  gap: 1px;
}

.metric-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid #edf0f1;
  font-size: 11px;
}

.metric-line:last-child {
  border-bottom: 0;
}

.progress {
  width: 100%;
  height: 7px;
  border-radius: 99px;
  background: #edf1f2;
  overflow: hidden;
}

.progress>i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.pnl-bar {
  display: grid;
  grid-template-columns: 82px 1fr 72px;
  align-items: center;
  gap: 10px;
  margin: 9px 0;
  font-size: 10px;
}

.pnl-track {
  height: 9px;
  background: #edf1f2;
  border-radius: 999px;
  overflow: hidden;
}

.pnl-track span {
  display: block;
  height: 100%;
  border-radius: 999px;
}

.pnl-track span.pos {
  background: var(--green);
}

.pnl-track span.neg {
  background: var(--red);
}

dialog {
  border: 0;
  border-radius: 2px;
  width: min(520px, calc(100vw - 32px));
  padding: 0;
  box-shadow: 0 24px 80px rgba(0, 0, 0, .24);
}

dialog::backdrop {
  background: rgba(8, 14, 16, .52);
}

.dialog-head {
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.dialog-body {
  padding: 18px;
  max-height: calc(100dvh - 88px);
  overflow-y: auto;
}

.dialog-foot {
  padding: 13px 18px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.toast-zone {
  position: fixed;
  right: 18px;
  bottom: 18px;
  display: grid;
  gap: 8px;
  z-index: 100;
}

.toast {
  width: min(360px, calc(100vw - 36px));
  background: var(--sidebar);
  color: white;
  border-radius: 2px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, .18);
  padding: 11px 13px;
  font-size: 11px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  animation: toastin .18s ease;
}

.toast.error {
  background: #7f2d2d;
}

.toast.success {
  background: #165d44;
}

@keyframes toastin {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.loading {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid #d7dfe1;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.skeleton {
  min-height: 12px;
  border-radius: 5px;
  background: linear-gradient(90deg, #eef1f2 25%, #f8f9f9 40%, #eef1f2 60%);
  background-size: 300% 100%;
  animation: shimmer 1.2s infinite;
}

@keyframes shimmer {
  to {
    background-position: -100% 0;
  }
}

.inline-error {
  padding: 10px 12px;
  color: var(--red);
  background: var(--red-soft);
  border: 1px solid #efcaca;
  border-radius: 2px;
  font-size: 11px;
}

.info-box {
  padding: 11px 12px;
  color: #516067;
  background: var(--blue-soft);
  border: 1px solid #cedfea;
  border-radius: 2px;
  font-size: 10px;
  line-height: 1.5;
}

.import-status {
  min-height: 68px;
  margin-bottom: 18px;
  padding: 13px 16px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--line-strong);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.import-status.running {
  border-left-color: var(--amber);
}

.import-status.success {
  border-left-color: var(--green);
}

.import-status.failed {
  border-left-color: var(--red);
}

.import-status-main,
.import-status-stats {
  display: flex;
  align-items: center;
  gap: 12px;
}

.import-status-stats {
  flex-wrap: wrap;
  justify-content: flex-end;
  color: var(--muted);
  font-size: 10px;
}

.import-status-stats span {
  white-space: nowrap;
}

@media (max-width: 820px) {
  .mobile-quick-nav {
    position: fixed;
    z-index: 50;
    left: 0;
    right: 0;
    bottom: max(0px, env(safe-area-inset-bottom));
    display: grid;
    grid-template-columns: repeat(var(--mobile-nav-columns, 3), minmax(0, 1fr));
    align-items: stretch;
    gap: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: rgba(255, 255, 255, .98);
    box-shadow: none;
  }

  .mobile-quick-nav a {
    display: grid;
    justify-items: center;
    align-content: center;
    gap: 2px;
    min-height: 46px;
    padding: 4px 2px;
    border-radius: 0;
    color: #31504a;
    text-decoration: none;
    font-size: 18px;
  }

  .mobile-quick-nav small {
    font-size: 10px;
    font-weight: 700;
  }

  .mobile-quick-nav a.central {
    min-height: 50px;
    margin-top: 0;
    color: #fff;
    background: #176b59;
    box-shadow: none;
  }

  .mobile-quick-nav a.active:not(.central) {
    color: #176b59;
    background: #e8f3ef;
  }

  body {
    padding-bottom: 52px;
  }
}

@media (max-width: 1200px) {
  .bets-ledger-table {
    table-layout: auto;
    min-width: 1140px;
  }

  .ledger-actions-inline {
    justify-content: flex-start;
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .bets-ledger-table .col-selection {
    width: 46%;
  }

  .ledger-selection-main {
    min-width: 140px;
  }
}

@media (max-width: 820px) {
  .ledger-actions-desktop {
    display: none;
  }

  .ledger-actions-mobile {
    display: flex;
  }
}

html.mobile-app-mode .ledger-actions-desktop {
  display: none;
}

html.mobile-app-mode .ledger-actions-mobile {
  display: flex;
}

@media (max-width: 820px) {
  .import-status {
    align-items: flex-start;
    flex-direction: column;
  }

  .import-status-stats {
    justify-content: flex-start;
  }
}

.divider {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 17px 0;
}

@media (max-width: 1120px) {
  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .grid-2,
  .grid-even {
    grid-template-columns: 1fr;
  }

  .slip-summary {
    position: static;
  }

  .selection-body {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .selection-extra {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .race-row {
    grid-template-columns: 60px minmax(200px, 1fr) repeat(2, 100px) 80px;
  }

  .race-row .hide-mid {
    display: none;
  }
}

@media (max-width: 820px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: min(84vw, 320px);
    height: 100dvh;
    padding: 10px 0 0;
    border-right: 1px solid rgba(255, 255, 255, .08);
    transform: translateX(-102%);
    transition: .2s ease;
    box-shadow: 10px 0 40px rgba(0, 0, 0, .2);
  }

  .sidebar-collapse {
    display: none;
  }

  .layout.sidebar-collapsed {
    grid-template-columns: 1fr;
  }

  .layout.sidebar-collapsed .sidebar {
    width: min(84vw, 320px);
    padding: 10px 0 0;
  }

  .layout.sidebar-collapsed .brand {
    height: auto;
    margin: 0 0 12px;
    padding: 8px 12px 10px;
  }

  .layout.sidebar-collapsed .brand-logo {
    display: block;
  }

  .layout.sidebar-collapsed .nav-title {
    display: block;
  }

  .layout.sidebar-collapsed .nav a span:not(.nav-icon) {
    display: inline;
  }

  .layout.sidebar-collapsed .brand::after {
    display: none;
  }

  .layout.sidebar-collapsed .nav a {
    justify-content: flex-start;
    padding-inline: 12px;
  }

  .layout.sidebar-collapsed .nav-icon {
    width: 16px;
    height: 16px;
  }

  .brand {
    padding: 8px 12px 10px;
    margin-bottom: 12px;
  }

  .nav-title {
    padding: 8px 12px 6px;
  }

  .nav {
    gap: 2px;
  }

  .nav a {
    min-height: 40px;
    gap: 10px;
    padding: 8px 12px;
    font-size: 12px;
  }

  .nav-icon {
    width: 16px;
    height: 16px;
    font-size: 12px;
  }

  .nav-icon svg {
    width: 14px;
    height: 14px;
  }

  .sidebar-foot {
    padding: 10px 12px 12px;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .mobile-menu {
    display: block;
  }

  .topbar {
    padding: 0 16px;
  }

  .page {
    padding: 20px 15px 44px;
  }

  .hero-row {
    flex-direction: column;
  }

  .form-grid,
  .form-grid.cols-3 {
    grid-template-columns: 1fr;
  }

  .span-2,
  .span-3 {
    grid-column: auto;
  }

  .race-row {
    grid-template-columns: 54px minmax(160px, 1fr) 70px;
    gap: 7px;
  }

  .race-row .hide-mobile {
    display: none;
  }
}

@media (max-width: 520px) {
  .kpi-grid {
    grid-template-columns: 1fr;
  }

  .selection-body,
  .selection-extra {
    grid-template-columns: 1fr;
  }

  .topbar-right .pipeline-pill {
    display: none;
  }
}

/* Dashboard v4 prediction decision layer. */
.dashboard-v4-predictions {
  min-width: 1580px;
}

.dashboard-v4-predictions:not(.show-model-details) .model-detail-cell {
  display: none;
}

.dashboard-v4-predictions:not(.show-model-details) {
  min-width: 980px;
}

.true-price-cell-button {
  width: 100%;
  min-width: 68px;
  min-height: 32px;
  padding: 6px 8px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font: inherit;
}

.true-price-cell-button:hover,
.true-price-cell-button:focus-visible {
  background: var(--surface-soft);
  outline: 1px solid var(--line);
}

.prediction-model-meta {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 8px 0 12px;
  color: var(--ink);
  font-size: 11px;
}

.prediction-model-meta span {
  color: var(--muted);
  font-size: 10px;
}

.dashboard-v4-predictions th:first-child,
.dashboard-v4-predictions td:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
  min-width: 190px;
  box-shadow: 1px 0 0 var(--line);
}

.dashboard-v4-predictions th:first-child {
  z-index: 3;
  background: #162321;
}

.dashboard-v4-predictions td:first-child {
  background: inherit;
}

.prediction-metric-cell,
.prediction-confidence-cell,
.prediction-ranks-cell {
  min-width: 92px;
  white-space: nowrap;
}

.prediction-metric-cell strong,
.prediction-metric-cell span,
.prediction-confidence-cell strong,
.prediction-confidence-cell span,
.prediction-ranks-cell strong,
.prediction-ranks-cell span {
  display: block;
}

.prediction-metric-cell span,
.prediction-confidence-cell span,
.prediction-ranks-cell span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 9px;
}

.prediction-signals-cell {
  min-width: 190px;
  max-width: 260px;
}

.dashboard-prediction-signals {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.dashboard-prediction-signals span {
  padding: 3px 6px;
  border: 1px solid #d5dfda;
  border-radius: 999px;
  background: #f2f6f4;
  color: #334c44;
  font-size: 8px;
  font-weight: 750;
  letter-spacing: .02em;
  line-height: 1.2;
}


.account-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border-left: 1px solid var(--line);
  padding-left: 10px;
  color: #4f5b5f;
  font-size: 11px;
  font-weight: 700;
}

.account-avatar {
  width: 25px;
  height: 25px;
  border-radius: 2px;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  border: 1px solid #d8df93;
  color: var(--accent-strong);
  font-size: 10px;
  font-weight: 800;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(360px, .9fr) minmax(440px, 1.1fr);
  background: var(--bg);
}

.login-panel {
  display: grid;
  place-items: center;
  padding: 38px;
}

.login-card {
  width: min(430px, 100%);
  background: white;
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 30px;
  box-shadow: 0 18px 55px rgba(16, 24, 26, .08);
}

.login-card h1 {
  margin: 0;
  font-size: 25px;
  letter-spacing: -.035em;
}

.login-card>p {
  margin: 8px 0 22px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.login-brand {
  margin-bottom: 28px;
}

.login-brand .brand-logo {
  width: 220px;
}

.login-visual {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(200, 217, 47, .16), transparent 42%),
    var(--sidebar);
  color: white;
  display: flex;
  align-items: flex-end;
  padding: 54px;
}

.login-visual::before,
.login-visual::after {
  content: "";
  position: absolute;
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 50%;
}

.login-visual::before {
  width: 420px;
  height: 420px;
  right: -100px;
  top: -100px;
}

.login-visual::after {
  width: 250px;
  height: 250px;
  right: 90px;
  top: 90px;
}

.login-visual-copy {
  position: relative;
  z-index: 1;
  max-width: 560px;
}

.login-visual-copy .brand-logo {
  width: min(480px, 100%);
}

.login-visual-copy h2 {
  margin: 0;
  max-width: 500px;
  font-size: 34px;
  line-height: 1.12;
  letter-spacing: -.04em;
}

.login-visual-copy p {
  margin: 14px 0 0;
  max-width: 510px;
  color: #9fb0b4;
  font-size: 13px;
  line-height: 1.6;
}

.config-note {
  margin-top: 16px;
  border: 1px solid #eedbb9;
  background: var(--amber-soft);
  color: #735015;
  border-radius: 2px;
  padding: 11px 12px;
  font-size: 10px;
  line-height: 1.55;
}

.login-error {
  display: none;
  margin-bottom: 13px;
  padding: 10px 11px;
  border: 1px solid #efcaca;
  background: var(--red-soft);
  color: var(--red);
  border-radius: 2px;
  font-size: 10px;
}

@media (max-width: 820px) {
  .account-pill {
    display: none;
  }

  .login-shell {
    grid-template-columns: 1fr;
  }

  .login-visual {
    display: none;
  }

  .login-panel {
    padding: 22px;
  }
}

/* --------------------------------------------------------------------------
   Fides design system — 2026 application-wide refresh
   -------------------------------------------------------------------------- */

:root {
  --bg: #f3f5f2;
  --surface: #ffffff;
  --surface-soft: #f7f8f6;
  --sidebar: #101b1a;
  --sidebar-soft: #172725;
  --text: #17211f;
  --muted: #65716d;
  --line: #dce2de;
  --line-strong: #c7d0cb;
  --accent: #c8a96b;
  --accent-strong: #8b6c32;
  --accent-soft: #f7f0e3;
  --gold: #c8a96b;
  --gold-deep: #806127;
  --green: #17634e;
  --green-soft: #e8f3ee;
  --red: #b83a3a;
  --red-soft: #fbeaea;
  --positive: #127151;
  --negative: #b4232b;
  --amber: #946715;
  --amber-soft: #fbf1d9;
  --blue: #315f78;
  --blue-soft: #e8f1f5;
  --shadow: 0 1px 2px rgba(16, 27, 26, .04), 0 10px 30px rgba(16, 27, 26, .045);
  --shadow-raised: 0 16px 45px rgba(16, 27, 26, .13);
  --radius: 12px;
  --radius-sm: 8px;
  --focus: 0 0 0 3px rgba(23, 99, 78, .16);
}

html,
body {
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-feature-settings: "cv02", "cv03", "cv04", "cv11";
}

body {
  background:
    radial-gradient(circle at 76% -10%, rgba(200, 169, 107, .10), transparent 25rem),
    var(--bg);
}

::selection {
  background: #dcebe5;
  color: var(--sidebar);
}

:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 2px;
}

.layout {
  grid-template-columns: 258px minmax(0, 1fr);
}

.sidebar {
  padding: 24px 16px;
  background: var(--sidebar);
  color: #eef5f1;
  border-right: 1px solid rgba(255, 255, 255, .06);
}

.sidebar::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  background: var(--accent);
}

.brand {
  min-height: 56px;
  margin-bottom: 24px;
  padding: 7px 10px 12px;
}

.brand-logo {
  width: 174px;
}

.nav-title {
  padding: 10px 12px 8px;
  color: #72817d;
  font-size: 10px;
  letter-spacing: .16em;
}

.nav {
  gap: 5px;
}

.nav a {
  min-height: 43px;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 9px;
  color: #acbab6;
  font-size: 13px;
  font-weight: 630;
}

.nav a:hover {
  background: rgba(255, 255, 255, .055);
  border-color: rgba(255, 255, 255, .06);
}

.nav a.active {
  color: #fff;
  background: #1a332e;
  border-color: rgba(200, 169, 107, .28);
  box-shadow: inset 3px 0 0 var(--accent);
}

.nav-icon {
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  color: #81908c;
  opacity: 1;
}

.nav-icon svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav a.active .nav-icon {
  color: var(--accent);
}

.sidebar-foot {
  color: #687773;
}

.sidebar-collapse {
  right: 16px;
  bottom: 18px;
  width: 32px;
  height: 32px;
  border-radius: 8px;
}

.layout.sidebar-collapsed {
  grid-template-columns: 76px minmax(0, 1fr);
}

.layout.sidebar-collapsed .sidebar-collapse {
  right: 22px;
}

.topbar {
  min-height: 70px;
  padding: 0 32px;
  background: rgba(243, 245, 242, .88);
  border-bottom-color: rgba(199, 208, 203, .8);
  backdrop-filter: blur(18px) saturate(130%);
}

.page-title {
  font-size: 14px;
  font-weight: 720;
  letter-spacing: -.012em;
}

.page-title::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  margin: 0 10px 2px 0;
  border-radius: 50%;
  background: var(--accent);
}

.pipeline-pill {
  min-height: 32px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, .72);
  color: #52615c;
}

.pipeline-dot {
  box-shadow: 0 0 0 4px rgba(23, 99, 78, .10);
}

.account-pill {
  border-left: 0;
  padding: 4px 8px 4px 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .7);
  color: #4d5a56;
}

.account-avatar {
  width: 27px;
  height: 27px;
  border: 0;
  border-radius: 50%;
  background: var(--sidebar);
  color: var(--accent);
}

.page {
  max-width: 1540px;
  padding: 34px 34px 64px;
}

.hero-row {
  align-items: center;
  margin-bottom: 24px;
}

.hero-row h1 {
  font-size: clamp(24px, 2vw, 31px);
  line-height: 1.12;
  font-weight: 690;
  letter-spacing: -.045em;
}

.hero-row p {
  max-width: 680px;
  margin-top: 8px;
  font-size: 13px;
  line-height: 1.6;
}

.actions,
.filterbar {
  gap: 9px;
}

.btn {
  height: 40px;
  min-height: 40px;
  padding: 8px 15px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 700;
  box-shadow: 0 1px 1px rgba(16, 27, 26, .03);
  transition: border-color .16s ease, background .16s ease, color .16s ease, box-shadow .16s ease, transform .16s ease;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 5px 15px rgba(16, 27, 26, .09);
}

.btn:active {
  transform: translateY(0);
}

.btn-primary {
  background: var(--sidebar);
  border-color: var(--sidebar);
}

.btn-accent {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}

.btn-accent:hover {
  background: #11543f;
  border-color: #11543f;
}

.btn-secondary {
  background: rgba(255, 255, 255, .88);
  border-color: var(--line-strong);
}

.btn-secondary:hover {
  border-color: #9eaaa4;
}

.btn-export {
  background: #e0862b;
  color: #fff;
  border-color: #e0862b;
}

.btn-export:hover {
  background: #c46f1c;
  border-color: #c46f1c;
}

.btn-ghost:hover {
  background: rgba(23, 33, 31, .055);
  color: var(--text);
}

.btn-sm {
  height: 32px;
  min-height: 32px;
  padding: 5px 10px;
  border-radius: 7px;
}

.kpi-grid {
  gap: 15px;
  margin-bottom: 20px;
}

.kpi {
  position: relative;
  overflow: hidden;
  padding: 20px;
  border: 1px solid var(--line);
  border-top: 1px solid var(--line);
  border-radius: var(--radius);
}

.kpi::after {
  content: "";
  position: absolute;
  top: 0;
  left: 20px;
  width: 38px;
  height: 3px;
  border-radius: 0 0 3px 3px;
  background: var(--accent);
}

.kpi-label {
  margin-bottom: 13px;
  color: #68746f;
  font-size: 10px;
  font-weight: 750;
  letter-spacing: .055em;
  text-transform: uppercase;
}

.kpi-value {
  font-size: clamp(25px, 2vw, 31px);
  font-weight: 720;
  letter-spacing: -.045em;
}

.kpi-meta {
  margin-top: 10px;
  font-size: 11px;
}

.grid-2,
.grid-even,
.grid-3,
.stack {
  gap: 16px;
}

.card {
  overflow: hidden;
  border-radius: var(--radius);
}

.card-head {
  min-height: 58px;
  padding: 15px 19px;
  border-top: 0;
  background: rgba(247, 248, 246, .58);
}

.card-title {
  font-size: 13px;
  font-weight: 720;
  letter-spacing: -.01em;
}

.card-body {
  padding: 19px;
}

.status {
  gap: 5px;
  border-radius: 999px;
  padding: 6px 9px;
  font-size: 9px;
  letter-spacing: .055em;
}

.status::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}

table {
  font-size: 11px;
}

th {
  padding: 11px 14px;
  background: #f7f8f6;
  color: #66736f;
  font-size: 9px;
  letter-spacing: .055em;
  text-transform: uppercase;
}

td {
  padding: 12px 14px;
  border-bottom-color: #e9eeeb;
}

tbody tr {
  transition: background .12s ease;
}

tbody tr:hover {
  background: #f7faf8;
}

.field label,
.odds-control-label {
  color: #55625e;
  font-size: 10px;
  font-weight: 750;
  letter-spacing: .025em;
}

.field input,
.field select,
.field textarea,
.filterbar input,
.filterbar select,
.actions>input,
.actions>select,
.date-control,
.agent-dropdown-button {
  height: 41px;
  min-height: 41px;
  border-color: var(--line-strong);
  border-radius: var(--radius-sm);
  background-color: #fff;
  font-size: 12px;
}

.field input:hover,
.field select:hover,
.field textarea:hover,
.filterbar input:hover,
.filterbar select:hover,
.actions>input:hover,
.actions>select:hover {
  border-color: #a9b4ae;
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.filterbar input:focus,
.filterbar select:focus,
.actions>input:focus,
.actions>select:focus {
  border-color: var(--green);
  box-shadow: var(--focus);
}

.field .hint {
  margin-top: 6px;
  font-size: 10px;
  line-height: 1.45;
}

.bet-type-grid {
  gap: 10px;
}

.bet-type-card,
.category-option {
  min-height: 70px;
  border-radius: 9px;
  padding: 13px;
}

.bet-type-card:hover,
.bet-type-card:focus-visible,
.category-option:hover,
.category-option:focus-visible {
  border-color: var(--green);
  box-shadow: 0 4px 18px rgba(23, 99, 78, .08);
}

.bet-type-card.selected {
  border-color: var(--green);
  background: var(--green-soft);
  box-shadow: inset 0 0 0 1px rgba(23, 99, 78, .12);
}

.category-selection,
.selection-card,
.summary-total,
.info-box,
.import-status {
  border-radius: 9px;
}

.selection-card {
  border-color: var(--line);
  background: #fcfdfc;
}

.selection-head {
  background: #f7f8f6;
}

.slip-summary {
  top: 92px;
  border-color: #d7c7a7;
}

.summary-total {
  background: var(--accent-soft);
  border-color: #e8d7b6;
}

.course-group {
  overflow: hidden;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.course-head {
  padding: 15px 18px;
  background: var(--sidebar-soft);
  color: #fff;
}

.race-row {
  min-height: 62px;
  padding-inline: 18px;
}

.race-row:hover {
  background: #f6faf7;
}

.race-time {
  color: var(--green);
  font-weight: 780;
}

.runner-panel {
  background: #f5f7f4;
}

.runner-card {
  border-radius: 9px;
  box-shadow: 0 1px 2px rgba(16, 27, 26, .035);
}

.runner-card.winner,
.dashboard-runner.winner,
.odds-checker-table tr.winner td {
  background: #eef7f2;
}

.prediction-rank-badge {
  border-radius: 7px !important;
}

.odds-quote,
.chip,
.odds-filter-button,
.dashboard-chart-tab {
  border-radius: 7px;
}

.odds-filter-button.selected,
.dashboard-chart-tab.active {
  background: var(--sidebar);
  border-color: var(--sidebar);
  color: #fff;
}

.agent-dropdown-menu {
  border-radius: 10px;
  box-shadow: var(--shadow-raised);
}

.metric-line {
  padding-block: 12px;
}

.progress,
.pnl-track {
  border-radius: 999px;
}

.progress>i,
.pnl-track span {
  border-radius: inherit;
}

dialog {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 28px 80px rgba(9, 20, 18, .25);
}

dialog::backdrop {
  background: rgba(8, 17, 16, .52);
  backdrop-filter: blur(3px);
}

.dialog-head,
.dialog-foot {
  background: #f8f9f7;
}

.toast {
  border-radius: 10px;
  box-shadow: var(--shadow-raised);
}

.pagination {
  border-top: 1px solid var(--line);
  background: #fafbfa;
}

.login-shell {
  background: #f4f6f3;
}

.login-panel {
  position: relative;
}

.login-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: radial-gradient(#cbd3ce 1px, transparent 1px);
  background-size: 22px 22px;
  opacity: .25;
}

.login-card {
  position: relative;
  z-index: 1;
  border-radius: 16px;
  padding: 36px;
  box-shadow: 0 22px 60px rgba(16, 27, 26, .10);
}

.login-card h1 {
  font-size: 29px;
  font-weight: 700;
}

.login-visual {
  background:
    linear-gradient(rgba(16, 27, 26, .15), rgba(16, 27, 26, .38)),
    repeating-linear-gradient(120deg, transparent 0 70px, rgba(255, 255, 255, .025) 70px 71px),
    var(--sidebar);
}

.login-visual::before,
.login-visual::after {
  border-color: rgba(200, 169, 107, .18);
}

.login-visual-copy h2 {
  font-size: clamp(34px, 4vw, 54px);
  font-weight: 650;
  letter-spacing: -.055em;
}

.login-visual-copy p {
  color: #adbbb7;
  font-size: 14px;
}

@media (max-width: 1120px) {
  .page {
    padding-inline: 26px;
  }
}

@media (max-width: 820px) {
  body::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 25;
    visibility: hidden;
    background: rgba(8, 17, 16, .42);
    opacity: 0;
    transition: opacity .2s ease, visibility .2s ease;
  }

  body:has(.sidebar.open)::after {
    visibility: visible;
    opacity: 1;
  }

  .sidebar {
    width: 268px;
    box-shadow: 18px 0 55px rgba(8, 17, 16, .28);
  }

  .mobile-menu {
    width: 36px;
    height: 36px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    font-size: 17px;
  }

  .topbar {
    min-height: 64px;
    padding-inline: 15px;
  }

  .page {
    padding: 25px 15px 48px;
  }

  .hero-row {
    align-items: stretch;
  }

  .hero-row .actions,
  .hero-row .filterbar {
    width: 100%;
  }
}

@media (max-width: 520px) {
  .hero-row h1 {
    font-size: 25px;
  }

  .kpi {
    padding: 18px;
  }

  .card-head,
  .card-body {
    padding-inline: 15px;
  }

  .actions .btn,
  .hero-row .actions>input,
  .hero-row .actions>select,
  .hero-row .filterbar>input,
  .hero-row .filterbar>select {
    flex: 1 1 auto;
  }

  .login-card {
    padding: 27px 22px;
  }
}

@media (prefers-reduced-motion: reduce) {

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
  }
}

/* Professional odds-grid palette: quiet hierarchy, no fluorescent fills. */
.odds-checker-table th {
  background: #162321;
  color: #eaf0ed;
  border-color: #2a3835;
  font-weight: 680;
}

.odds-checker-table td {
  border-color: #dfe5e1;
  background: #fff;
}

.prediction-cell {
  background: #eef3f5 !important;
  box-shadow: inset -1px 0 0 #d7e0e4;
}

.prediction-cell strong,
.prediction-cell span,
.runner-prediction,
.runner-prediction strong {
  color: #274556;
}

.odds-checker-table tr.top-three-1,
.runner-card.top-three-1 {
  background: #e5f8ff;
  border-left-color: #0076a8;
  box-shadow: inset 5px 0 0 #0076a8;
}

.odds-checker-table tr.top-three-2,
.runner-card.top-three-2 {
  background: #eaf5ff;
  border-left-color: #2d65d8;
  box-shadow: inset 5px 0 0 #2d65d8;
}

.odds-checker-table tr.top-three-3,
.runner-card.top-three-3 {
  background: #fff1d8;
  border-left-color: #d98200;
  box-shadow: inset 5px 0 0 #d98200;
}

.top-three-1 .prediction-rank-badge,
.top-three-2 .prediction-rank-badge,
.top-three-3 .prediction-rank-badge {
  color: #fff;
}

.top-three-1 .prediction-rank-badge {
  background: #0076a8;
}

.top-three-2 .prediction-rank-badge {
  background: #2d65d8;
}

.top-three-3 .prediction-rank-badge {
  background: #d98200;
}

.odds-checker-table td.best-odds {
  background: #edf5f1 !important;
  color: #125c45;
  box-shadow: inset 0 0 0 1px #aac9bc;
}

.odds-checker-table td.best-odds strong {
  color: #125c45;
  font-size: 14px;
}

.odds-checker-table tr.winner td,
.runner-card.winner,
.dashboard-runner.winner {
  background: #edf6f1;
}

.odds-checker-table tr.winner td:first-child {
  background: #e3f0ea;
}

.runner-card.winner {
  border-color: #9dc1b2;
}

.runner-result {
  color: #17634e;
}

/* Predictions overview */
.prediction-summary {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  margin-bottom: 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.prediction-summary>div {
  padding: 16px 19px;
  border-right: 1px solid var(--line);
}

.prediction-summary>div:last-child {
  border-right: 0;
}

.prediction-summary span,
.prediction-label {
  display: block;
  color: var(--muted);
  font-size: 9px;
  font-weight: 750;
  letter-spacing: .065em;
  text-transform: uppercase;
}

.prediction-summary strong {
  display: block;
  margin-top: 6px;
  font-size: 22px;
  letter-spacing: -.035em;
}

.overview-status {
  min-height: 27px;
  padding: 2px 2px 10px;
  color: var(--muted);
  font-size: 11px;
}

.prediction-pnl-card {
  margin-bottom: 20px;
}

.prediction-betting-card {
  margin-bottom: 20px;
}

.prediction-pnl-card .card-head {
  align-items: flex-start;
}

.betting-options-status {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.betting-options-grid {
  display: grid;
  gap: 14px;
}

.betting-option-group {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  overflow: hidden;
}

.betting-option-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  background: #fafbfa;
}

.betting-option-group-head h3 {
  margin: 0;
  font-size: 13px;
  letter-spacing: -.01em;
}

.betting-option-group-head span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: .055em;
}

.betting-option-list {
  display: grid;
}

.betting-option-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 190px;
  gap: 12px;
  align-items: center;
  min-width: 0;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.betting-option-row:last-child {
  border-bottom: 0;
}

.betting-option-rank {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--sidebar);
  font-size: 11px;
  font-weight: 800;
}

.betting-option-main {
  min-width: 0;
}

.betting-option-head {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.betting-option-head strong {
  font-size: 12px;
}

.betting-option-head span {
  color: var(--positive);
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.betting-option-legs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 7px;
}

.betting-option-legs span {
  min-width: 0;
  padding: 5px 7px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: #fbfcf8;
  color: var(--text);
  font-size: 10px;
  line-height: 1.35;
}

.betting-option-legs strong {
  font-weight: 850;
}

.betting-option-legs em {
  color: var(--muted);
  font-style: normal;
}

.betting-option-meta {
  display: grid;
  justify-content: end;
  gap: 4px;
  color: var(--muted);
  text-align: right;
  font-size: 10px;
  font-weight: 700;
}

.betting-option-meta span:first-child {
  color: var(--text);
  font-size: 11px;
}

.pnl-controls {
  flex-wrap: nowrap;
}

.pnl-controls>* {
  flex: 0 0 auto;
}

.pnl-stake-control {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.pnl-stake-control input,
.pnl-stake-control select {
  height: 36px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  padding: 7px 9px;
  background: #fff;
  color: var(--text);
}

.pnl-stake-control input {
  width: 110px;
}

.pnl-stake-control select {
  width: 180px;
  cursor: pointer;
}

.pnl-query-status {
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: #fafbfa;
  color: var(--muted);
  font-size: 10px;
}

.prediction-pnl-table td,
.prediction-pnl-table th {
  white-space: nowrap;
}

.prediction-pnl-table .table-subtext {
  margin-top: 3px;
}

.prediction-regions {
  display: grid;
  gap: 20px;
}

.prediction-region {
  min-width: 0;
}

.prediction-region-head {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 10px;
  padding: 7px 8px 7px 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  text-align: left;
  transition: background .15s ease;
}

.prediction-region-head:hover {
  background: rgba(23, 33, 31, .045);
}

.prediction-region-head>div {
  display: flex;
  align-items: center;
  gap: 10px;
}

.prediction-region-head h2 {
  margin: 0;
  font-size: 16px;
  letter-spacing: -.02em;
}

.prediction-region-meta {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-size: 11px;
}

.prediction-region-meta i {
  display: grid;
  width: 25px;
  height: 25px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: #53615d;
  font-style: normal;
  transition: transform .18s ease;
}

.prediction-region-head[aria-expanded="false"] .prediction-region-meta i {
  transform: rotate(-90deg);
}

.prediction-course-groups {
  display: grid;
  gap: 10px;
  padding-left: 14px;
  border-left: 1px solid var(--line);
}

.prediction-course {
  min-width: 0;
}

.prediction-course-head {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 9px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8faf8;
  color: var(--text);
  text-align: left;
}

.prediction-course-head:hover {
  border-color: #b8c3bd;
  background: #f3f6f4;
}

.prediction-course-head strong {
  font-size: 12px;
}

.prediction-course-head>span {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 10px;
}

.prediction-course-head i {
  color: #53615d;
  font-style: normal;
  transition: transform .18s ease;
}

.prediction-course-head[aria-expanded="false"] i {
  transform: rotate(-90deg);
}

.prediction-course-groups[hidden],
.prediction-tile-grid[hidden] {
  display: none !important;
}

.region-mark {
  display: grid;
  min-width: 36px;
  height: 25px;
  padding: 0 7px;
  place-items: center;
  border-radius: 6px;
  background: var(--sidebar);
  color: var(--accent);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .06em;
}

.prediction-tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: 12px;
}

.prediction-tile {
  position: relative;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow);
}

.prediction-tile::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: #aeb8b3;
}

.prediction-tile.correct::before {
  background: var(--positive);
}

.prediction-tile.missed::before {
  background: var(--negative);
}

.prediction-tile.pending::before {
  background: #71818a;
}

.prediction-tile-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 15px 11px 17px;
}

.prediction-tile-head>div {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 8px;
}

.prediction-tile-head strong {
  overflow: hidden;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.prediction-time {
  flex: 0 0 auto;
  padding: 4px 6px;
  border-radius: 5px;
  background: #edf1ee;
  color: #33423e;
  font-size: 10px;
  font-weight: 800;
}

.prediction-outcome {
  flex: 0 0 auto;
  padding: 5px 8px;
  border-radius: 999px;
  background: #f0f2f1;
  color: var(--muted);
  font-size: 9px;
  font-weight: 760;
}

.prediction-outcome.correct {
  background: var(--green-soft);
  color: var(--positive);
}

.prediction-outcome.missed {
  background: var(--red-soft);
  color: var(--negative);
}

.prediction-outcome.pending {
  background: var(--blue-soft);
  color: var(--blue);
}

.prediction-race-name {
  min-height: 43px;
  padding: 0 15px 12px 17px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.prediction-matchup {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) 22px minmax(0, .65fr);
  align-items: center;
  gap: 8px;
  padding: 14px 15px 15px 17px;
  border-top: 1px solid var(--line);
  background: #fafbfa;
}

.prediction-matchup>div {
  min-width: 0;
}

.prediction-matchup strong,
.prediction-matchup small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.prediction-matchup strong {
  margin-top: 6px;
  font-size: 13px;
}

.prediction-matchup small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 9px;
}

.prediction-versus {
  color: #96a19c;
  text-align: center;
}

.prediction-top-three {
  display: grid;
  gap: 4px;
  margin: 7px 0 0;
  padding: 0;
  list-style: none;
}

.prediction-top-three li {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  align-items: center;
  gap: 7px;
  min-width: 0;
  padding: 4px 6px 4px 4px;
  border-radius: 6px;
}

.prediction-top-three li>span {
  display: grid;
  width: 21px;
  height: 21px;
  place-items: center;
  border-radius: 5px;
  background: #e6ece9;
  color: #42514c;
  font-size: 9px;
  font-weight: 800;
}

.prediction-top-three li div {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  min-width: 0;
  gap: 6px;
}

.prediction-top-three li strong,
.prediction-top-three li small {
  margin: 0;
}

.prediction-top-three li strong {
  font-size: 11px;
}

.prediction-top-three li.actual-winner {
  background: var(--green-soft);
}

.prediction-top-three li.actual-winner>span {
  background: var(--positive);
  color: #fff;
}

@media (max-width: 820px) {
  .prediction-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .betting-option-row {
    grid-template-columns: 30px minmax(0, 1fr);
    align-items: start;
  }

  .betting-option-meta {
    grid-column: 2;
    justify-content: start;
    text-align: left;
  }

  .prediction-summary>div:nth-child(2n) {
    border-right: 0;
  }

  .prediction-summary>div:not(:nth-last-child(-n+2)) {
    border-bottom: 1px solid var(--line);
  }
}

@media (max-width: 520px) {
  .prediction-tile-grid {
    grid-template-columns: 1fr;
  }
}

.race-weather {
  margin: 10px 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  background: var(--surface-soft);
  font-size: 13px;
  line-height: 1.65;
  overflow-wrap: anywhere;
}

/* Mobile app shell: the bottom dock replaces desktop navigation. */
@media (max-width: 820px) {
  body {
    min-width: 320px;
    background: #f4f7f5;
  }

  .layout,
  .layout.sidebar-collapsed {
    display: block;
  }

  .sidebar,
  .layout.sidebar-collapsed .sidebar {
    display: none !important;
  }

  .workspace {
    width: 100%;
    min-width: 0;
  }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    min-height: 58px;
    padding: 8px 14px;
    border-bottom: 1px solid #dbe5e1;
    background: rgba(255, 255, 255, .96);
    box-shadow: 0 2px 12px rgba(16, 27, 26, .07);
  }

  .mobile-menu,
  .sidebar-collapse {
    display: none !important;
  }

  .topbar-left {
    flex: 1;
  }

  .topbar-right .pipeline-pill {
    display: none;
  }

  .account-pill {
    min-height: 38px;
    padding: 4px 8px;
    border: 0;
    background: transparent;
  }

  .topbar-right #logoutBtn {
    min-height: 38px;
    padding-inline: 8px;
  }

  .page {
    width: 100%;
    padding: 16px 12px 92px;
  }

  .hero-row {
    gap: 10px;
    margin-bottom: 14px;
  }

  .hero-row h1 {
    font-size: 24px;
  }

  .hero-row .actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
  }

  .hero-row .actions>* {
    width: 100%;
    min-width: 0;
  }

  .mobile-quick-nav {
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 0;
    padding: 0;
    margin: 0;
    display: grid;
  }

  .mobile-quick-nav a {
    display: grid;
  }
}

/* Shared phone and tablet layout. Keep wide data tables in their own scroller. */
.mobile-nav-close {
  display: none;
}

/* Final mobile app overrides: keep the bottom dock as the only navigation. */
@media (max-width: 820px) {

  html,
  body {
    width: 100%;
    min-width: 320px;
    overflow-x: hidden;
  }

  .layout,
  .layout.sidebar-collapsed {
    display: block !important;
    grid-template-columns: 1fr !important;
  }

  .layout .sidebar,
  .layout.sidebar-collapsed .sidebar,
  .mobile-menu,
  .sidebar-collapse,
  .mobile-nav-close {
    display: none !important;
  }

  .workspace {
    display: block !important;
    width: 100% !important;
    min-width: 0 !important;
  }

  .topbar {
    position: sticky !important;
    top: 0;
    z-index: 100;
    display: flex;
    min-height: 56px;
    padding: 8px 12px !important;
    background: #ffffff !important;
    border-bottom: 1px solid #dbe5e1;
    box-shadow: 0 2px 12px rgba(16, 27, 26, .08);
  }

  .topbar-left {
    flex: 1 1 auto;
  }

  .topbar-right {
    flex: 0 0 auto;
  }

  .page {
    width: 100% !important;
    max-width: none !important;
    padding: 14px 10px 0 !important;
  }

  .page>.card,
  .page>section.card,
  .bet-logger-app,
  #builderMain {
    border-radius: 12px;
  }

  .mobile-quick-nav {
    position: fixed !important;
    display: grid !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    z-index: 1000 !important;
    grid-template-columns: repeat(var(--mobile-nav-columns, 5), minmax(0, 1fr));
    grid-template-rows: repeat(var(--mobile-nav-rows, 1), minmax(0, 1fr));
    gap: 0;
    padding: 0 0 max(0px, env(safe-area-inset-bottom)) !important;
    border: 0;
    border-radius: 0;
    background: #f5efe3 !important;
    box-shadow: none;
    border-top: 1px solid #d7ceb5;
  }

  .mobile-quick-nav a {
    display: grid !important;
    place-items: center;
    min-height: 58px;
    border-radius: 0;
    color: #31504a;
    text-decoration: none;
    font-size: 16px;
    padding: 4px 2px 5px;
  }

  .mobile-quick-nav a small {
    display: block;
    max-width: 100%;
    overflow: visible;
    white-space: normal;
    text-overflow: clip;
    font-size: 10px;
    font-weight: 800;
    line-height: 1.12;
    color: #2d4d49;
  }

  .mobile-quick-nav a.central {
    min-height: 58px;
    margin-top: 0;
    color: #ffffff;
    background: var(--gold-deep);
    box-shadow: none;
  }

  .mobile-quick-nav a.active:not(.central) {
    color: #1f1b16;
    background: var(--accent);
  }
}

@media (max-width: 820px) {

  .layout,
  .layout.sidebar-collapsed {
    grid-template-columns: minmax(0, 1fr);
  }

  body.mobile-nav-open {
    overflow: hidden;
  }

  .sidebar,
  .layout.sidebar-collapsed .sidebar {
    width: min(288px, calc(100vw - 48px));
    height: 100dvh;
    overflow-y: auto;
    padding-bottom: max(24px, env(safe-area-inset-bottom));
  }

  .mobile-nav-close {
    display: block;
    align-self: flex-end;
    flex-shrink: 0;
    min-height: 34px;
    margin-bottom: 12px;
    padding: 6px 10px;
    border: 1px solid #68746f;
    border-radius: 8px;
    background: transparent;
    color: white;
    font-size: 12px;
  }

  .nav a {
    min-height: 34px;
  }

  .topbar {
    gap: 8px;
    flex-wrap: wrap;
    padding-block: 8px;
  }

  .topbar-left,
  .topbar-right {
    min-width: 0;
    gap: 6px;
  }

  .page-title {
    overflow-wrap: anywhere;
  }

  .mobile-menu {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
  }

  .btn,
  .btn-sm,
  .odds-filter-button,
  .agent-checkbox-row,
  .dashboard-chart-tab {
    min-height: 34px;
    height: auto;
    font-size: 12px;
  }

  .field input,
  .field select,
  .field textarea,
  .filterbar input,
  .filterbar select,
  .actions>input,
  .actions>select,
  .odds-control-group select,
  .agent-dropdown-button,
  .date-control {
    min-height: 34px;
    max-width: 100%;
    font-size: 13px;
  }

  .card-head,
  .selection-head,
  .course-head,
  .pagination {
    flex-wrap: wrap;
  }

  .slip-summary {
    position: static;
  }

  .table-wrap {
    overscroll-behavior-x: contain;
  }

  .prediction-tile-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .prediction-tile-head strong,
  .prediction-matchup strong,
  .prediction-matchup small {
    overflow: visible;
    text-overflow: clip;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .prediction-tile-head>div {
    flex-wrap: wrap;
  }

  .prediction-matchup {
    grid-template-columns: minmax(0, 1fr) 18px minmax(0, .8fr);
  }

  .metric-line {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .odds-control-group,
  .odds-agent-select {
    min-width: 0;
    max-width: 100%;
  }

  .agent-dropdown,
  .agent-dropdown-menu {
    min-width: 0;
    width: 100%;
  }

  dialog {
    max-width: calc(100vw - 24px);
    max-height: calc(100dvh - 24px);
    overflow: auto;
  }
}

@media (max-width: 520px) {
  .page {
    padding: 20px 12px max(32px, env(safe-area-inset-bottom));
  }

  .topbar {
    padding-inline: 12px;
  }

  .topbar-right .account-pill {
    display: none;
  }

  .hero-row h1 {
    font-size: 24px;
  }

  .prediction-summary {
    grid-template-columns: 1fr 1fr;
  }

  .prediction-summary>div {
    padding: 12px 10px;
  }

  .prediction-summary strong {
    font-size: 18px;
  }

  .hero-row .actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hero-row .actions>* {
    min-width: 0;
    width: 100%;
    white-space: normal;
  }

  .hero-row .actions>input,
  .hero-row .actions>select {
    grid-column: 1 / -1;
    white-space: nowrap;
  }

  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .kpi {
    padding: 16px 12px;
  }

  .kpi-value {
    font-size: clamp(20px, 6vw, 27px);
    overflow-wrap: anywhere;
  }

  .kpi-label,
  .kpi-meta {
    line-height: 1.4;
  }

  .odds-table-scroll {
    padding-inline: 0;
  }

  .dashboard-v4-predictions th:first-child,
  .dashboard-v4-predictions td:first-child {
    min-width: 120px;
    width: 120px;
    max-width: 120px;
    overflow-wrap: anywhere;
  }

  .dashboard-v4-predictions td:first-child {
    background: var(--surface);
  }

  .dialog-head,
  .dialog-foot {
    flex-wrap: wrap;
    gap: 10px;
  }

  .filterbar {
    flex-wrap: wrap;
  }

  .filterbar>* {
    min-width: 0;
    max-width: 100%;
  }

  .race-row {
    grid-template-columns: 48px minmax(0, 1fr) 64px;
    padding-inline: 10px;
  }

  .race-name,
  .runner-name {
    overflow-wrap: anywhere;
  }

  .runner-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .dashboard-race-grid,
  .runner-panel {
    padding-inline: 8px;
  }

  .odds-controls-inline {
    gap: 12px;
  }

  .odds-controls-inline>.odds-control-group {
    width: 100%;
  }

  .dashboard-chart-tabs {
    overflow-x: auto;
  }

  .dashboard-chart-tab {
    flex-shrink: 0;
  }

  .pagination {
    gap: 6px;
  }
}

@media (max-width: 820px) {
  .grid-3 {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Keep the page edge-to-edge with the dock flush to the viewport. */
html.mobile-app-mode .page {
  padding-bottom: 0 !important;
}

html.mobile-app-mode .mobile-quick-nav {
  display: grid !important;
  grid-template-columns: repeat(var(--mobile-nav-columns, 5), minmax(0, 1fr));
  grid-template-rows: repeat(var(--mobile-nav-rows, 1), minmax(0, 1fr));
  justify-content: stretch;
  align-content: center;
  overflow-x: hidden;
  overflow-y: hidden;
  padding: 0 !important;
  margin: 0 !important;
  background: #f3f5f1 !important;
  box-shadow: none !important;
}

html.mobile-app-mode .mobile-quick-nav a,
html.mobile-app-mode .mobile-quick-nav a.central {
  display: flex !important;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1 1 0;
  gap: 2px;
  box-sizing: border-box;
  min-width: 0;
  min-height: 58px !important;
  height: 58px;
  margin-top: 0;
  padding: 3px 2px;
  text-align: center;
  font-size: 11px !important;
}

html.mobile-app-mode .mobile-quick-nav .mobile-quick-nav-icon,
html.mobile-app-mode .mobile-quick-nav svg {
  display: block;
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
}

html.mobile-app-mode .mobile-quick-nav svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

html.mobile-app-mode .mobile-quick-nav a small {
  max-width: 100%;
  overflow: visible;
  text-overflow: clip;
  white-space: normal;
  font-size: 10px !important;
  line-height: 1.15;
  color: #2d4d49 !important;
}

/* Shared application header on every authenticated page. */
.topbar {
  flex-wrap: nowrap;
  color: #17312b;
}

.topbar-left {
  min-width: 0;
}

.topbar-right {
  flex: 0 0 auto;
}

html.mobile-app-mode .topbar {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  min-height: 56px;
  padding: 8px 12px !important;
}

html.mobile-app-mode .topbar-left {
  flex: 1 1 auto;
  min-width: 0;
}

html.mobile-app-mode .topbar .page-title {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow-wrap: normal;
  font-size: 14px;
}

html.mobile-app-mode .topbar-right {
  display: flex;
  flex: 0 0 auto;
  gap: 6px;
}

html.mobile-app-mode .topbar .pipeline-pill,
html.mobile-app-mode .topbar #adminUserLabel {
  display: none;
}

html.mobile-app-mode .topbar .account-pill {
  display: flex;
  align-items: center;
  min-height: 36px;
  padding: 3px;
  background: transparent;
}

html.mobile-app-mode .topbar #logoutBtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 5px 9px;
  border: 1px solid #dbe5e1;
  background: #fff;
  color: #17312b;
  white-space: nowrap;
  font-size: 12px;
}

/* Match page headings and their controls to the dashboard heading. */
body:not([data-page="dashboard"]) .page > .hero-row {
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

body:not([data-page="dashboard"]) .page > .hero-row h1 {
  color: #112638;
  font-size: clamp(18px, 1.4vw, 21px);
  font-weight: 690;
  line-height: 1.15;
  letter-spacing: -.035em;
}

body:not([data-page="dashboard"]) .page > .hero-row p {
  margin-top: 3px;
  color: #52615c;
  font-size: 11px;
}

body:not([data-page="dashboard"]) .page > .hero-row .actions,
body:not([data-page="dashboard"]) .page > .hero-row .filterbar {
  justify-content: flex-end;
  gap: 4px;
}

body:not([data-page="dashboard"]) .page > .hero-row .btn,
body:not([data-page="dashboard"]) .page > .hero-row .agent-dropdown-button,
body:not([data-page="dashboard"]) .page > .hero-row .actions > input:not([type="file"]),
body:not([data-page="dashboard"]) .page > .hero-row .actions > select,
body:not([data-page="dashboard"]) .page > .hero-row .filterbar > input,
body:not([data-page="dashboard"]) .page > .hero-row .filterbar > select {
  box-sizing: border-box;
  height: 34px;
  min-height: 34px;
  padding: 5px 7px;
  border-radius: 7px;
  font-size: 11px;
}

body:not([data-page="dashboard"]) .page > .hero-row .actions > input:not([type="file"]),
body:not([data-page="dashboard"]) .page > .hero-row .actions > select,
body:not([data-page="dashboard"]) .page > .hero-row .filterbar > input,
body:not([data-page="dashboard"]) .page > .hero-row .filterbar > select,
body:not([data-page="dashboard"]) .page > .hero-row .agent-dropdown-button {
  border: 1px solid #dce5e8;
  background: #fff;
  color: #132638;
}

body:not([data-page="dashboard"]) .page > .hero-row .btn-secondary {
  background: #fff;
  color: #122738;
}

body:not([data-page="dashboard"]) .page > .hero-row .btn-accent {
  border-color: #176a51;
  background: #176a51;
  color: #fff;
}

body:not([data-page="dashboard"]) .page > .hero-row .btn-export {
  border-color: #e98e2c;
  background: #e98e2c;
  color: #fff;
}

body:not([data-page="dashboard"]) .page > .hero-row .btn {
  font-size: 10px;
}

@media (max-width: 1380px) {
  body:not([data-page="dashboard"]) .page > .hero-row {
    flex-wrap: wrap;
  }
}

html.mobile-app-mode .page > .hero-row {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  margin-bottom: 12px;
}

html.mobile-app-mode .page > .hero-row .actions,
html.mobile-app-mode .page > .hero-row .filterbar {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  width: 100%;
}

html.mobile-app-mode .page > .hero-row .actions > *,
html.mobile-app-mode .page > .hero-row .filterbar > * {
  min-width: 0;
  max-width: none;
  width: 100%;
}

html.mobile-app-mode .page > .hero-row .btn,
html.mobile-app-mode .page > .hero-row .agent-dropdown-button,
html.mobile-app-mode .page > .hero-row .actions > input:not([type="file"]),
html.mobile-app-mode .page > .hero-row .actions > select,
html.mobile-app-mode .page > .hero-row .filterbar > input,
html.mobile-app-mode .page > .hero-row .filterbar > select {
  height: 44px;
  min-height: 44px !important;
  font-size: 12px !important;
}
