:root {
  color-scheme: light;
  --ink: #111827;
  --muted: #667085;
  --line: #d7dde8;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --good: #087443;
  --warn: #b45309;
  --bad: #b42318;
  --accent: #0f766e;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.45 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.shell {
  width: min(1440px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 24px 0 48px;
}

.topbar,
.controls,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 26px;
  letter-spacing: 0;
}

h2 {
  font-size: 17px;
}

.topbar p,
.muted {
  color: var(--muted);
}

.status {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  max-width: 560px;
}

.pill {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px;
  white-space: nowrap;
}

.pill.ok {
  color: var(--good);
}

.pill.bad {
  color: var(--bad);
}

.controls {
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr)) auto auto auto;
  gap: 10px;
  align-items: end;
  margin: 14px 0;
  padding: 14px;
}

label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
}

input,
select,
button {
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

input,
select {
  padding: 0 10px;
  min-width: 0;
}

button {
  padding: 0 14px;
  cursor: pointer;
  font-weight: 650;
}

button:hover {
  border-color: var(--accent);
}

.check {
  display: flex;
  align-items: center;
  height: 38px;
  gap: 8px;
}

.check input {
  height: 18px;
  width: 18px;
}

.grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 14px;
}

.panel {
  padding: 16px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.opportunities {
  display: grid;
  gap: 10px;
}

.opp {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fff;
}

.opp-top,
.legs,
.row {
  display: flex;
  gap: 10px;
  justify-content: space-between;
}

.opp-top {
  align-items: start;
}

.event {
  font-size: 16px;
  font-weight: 750;
}

.profit {
  color: var(--good);
  font-size: 20px;
  font-weight: 800;
  white-space: nowrap;
}

.legs {
  margin: 12px 0;
}

.leg {
  flex: 1;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
  min-width: 0;
}

.leg b {
  display: block;
  margin-bottom: 5px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.actions a {
  display: inline-grid;
  place-items: center;
  height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 650;
}

.side {
  display: grid;
  align-content: start;
  gap: 14px;
}

.calc-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 12px 0;
}

.calc-result,
.paused-item {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px;
}

.calc-result.good {
  border-color: #95d5b2;
  background: #f0fdf4;
}

.calc-result.bad {
  border-color: #fecdca;
  background: #fff5f5;
}

.paused {
  display: grid;
  gap: 8px;
}

@media (max-width: 1100px) {
  .controls {
    grid-template-columns: repeat(3, 1fr);
  }

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

@media (max-width: 720px) {
  .shell {
    width: min(100vw - 20px, 720px);
    padding-top: 10px;
  }

  .topbar,
  .opp-top,
  .legs {
    display: grid;
  }

  .controls,
  .calc-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (min-width: 721px) {
  .candidate {
    grid-template-columns: minmax(280px, 1fr) 90px 100px 260px !important;
  }

  .candidate-actions {
    grid-column: 4;
  }
}

@media (min-width: 721px) {
  .candidate {
    grid-template-columns: minmax(280px, 1fr) 90px 100px 230px;
  }
}

/* Forker X layout */
.shell,
.topbar,
.controls,
.grid {
  display: none;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  background: #030507;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  padding: 14px 12px;
  background: #0b1017;
  border-right: 1px solid #1a2330;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  margin-bottom: 18px;
}

.brand h1 {
  font-size: 17px;
  line-height: 1;
}

.brand p {
  margin-top: 4px;
  color: var(--good);
  font-size: 11px;
}

.bolt {
  color: var(--good);
  font-size: 18px;
}

.side-block {
  display: grid;
  gap: 9px;
  padding: 12px 0;
  border-top: 1px solid #171f2c;
}

.side-block h2 {
  color: #cad5e4;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

.primary {
  border-color: rgba(45, 212, 191, 0.45);
  background: linear-gradient(180deg, #12d99f, #079669);
  color: #00120d;
}

.ghost {
  height: 28px;
  padding: 0 9px;
  color: var(--muted);
  background: #0a1018;
}

.workspace {
  min-width: 0;
  padding: 0 0 48px;
}

.desk-top {
  position: sticky;
  top: 0;
  z-index: 6;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 60px;
  padding: 12px 18px;
  background: rgba(7, 10, 15, 0.92);
  border-bottom: 1px solid #182131;
  backdrop-filter: blur(14px);
}

.desk-top h2 {
  font-size: 18px;
}

.mode-tabs {
  display: flex;
  gap: 6px;
  padding: 4px;
  background: #0d131c;
  border: 1px solid #1d2735;
  border-radius: 999px;
}

.mode-tabs span {
  padding: 6px 10px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.mode-tabs .active {
  background: #7c3aed;
  color: #fff;
}

.workspace .metrics {
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  padding: 12px 18px 0;
}

.feed {
  padding: 12px 18px;
}

.feed-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 14px 0 8px;
}

.feed-head h2 {
  color: #cbd5e1;
  font-size: 13px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.opportunities {
  gap: 8px;
}

.opp {
  grid-template-columns: 92px minmax(240px, 1fr) minmax(360px, 42%) auto;
  min-height: 86px;
  padding: 12px 14px;
}

.opp-top > div:first-child {
  grid-column: 2;
}

.legs {
  grid-column: 3;
  grid-row: 1 / span 3;
  margin: 0;
}

.row {
  grid-column: 2;
  justify-content: flex-start;
  gap: 18px;
}

.actions {
  grid-column: 4;
  grid-row: 1 / span 3;
  align-content: center;
  justify-content: flex-end;
  max-width: 140px;
}

.actions a {
  min-width: 112px;
}

.candidate {
  grid-template-columns: minmax(260px, 1fr) 90px 100px 230px;
}

.candidate-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 7px;
}

.book-link,
.candidate-actions button {
  display: inline-grid;
  place-items: center;
  min-width: 72px;
  height: 30px;
  padding: 0 10px;
  border: 1px solid #2a384b;
  border-radius: 7px;
  background: #0a111a;
  color: #e5eefb;
  text-decoration: none;
  font-size: 11px;
  font-weight: 900;
}

.fonbet-link {
  border-color: rgba(251, 113, 133, 0.6);
  background: linear-gradient(180deg, rgba(127, 29, 29, 0.8), rgba(69, 10, 10, 0.9));
  color: #ffd7df;
}

.poly-link {
  border-color: rgba(56, 189, 248, 0.55);
  background: linear-gradient(180deg, rgba(12, 74, 110, 0.8), rgba(8, 47, 73, 0.9));
  color: #d7f4ff;
}

.sample-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  margin-top: 7px;
  color: var(--muted);
}

.sample-line span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.calc-windows {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 20;
  display: flex;
  flex-direction: column-reverse;
  align-items: flex-end;
  gap: 12px;
  max-height: calc(100vh - 36px);
  overflow: auto;
  pointer-events: none;
}

.calc-window {
  width: min(520px, calc(100vw - 28px));
  padding: 14px;
  pointer-events: auto;
  background: rgba(8, 12, 18, 0.98);
  border: 1px solid rgba(56, 189, 248, 0.22);
  border-radius: 12px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55);
}

.calc-title {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.calc-title b {
  display: block;
  color: #f8fafc;
}

.calc-title span {
  color: var(--muted);
  font-size: 12px;
}

.calc-window .calc-grid {
  grid-template-columns: repeat(3, 1fr);
}

.stake-on {
  color: #e8fff9;
}

.calc-summary {
  display: grid;
  gap: 6px;
  padding-bottom: 10px;
  margin-bottom: 10px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.18);
}

.outcomes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 10px 0;
}

.outcome {
  display: grid;
  gap: 5px;
  min-width: 0;
  padding: 10px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
}

.outcome b {
  color: #f8fafc;
}

.outcome span {
  color: #cbd5e1;
}

.calc-page {
  min-height: 100vh;
  background: radial-gradient(circle at 20% 0%, rgba(16, 185, 129, 0.16), transparent 34%), #05070b;
}

.calc-standalone {
  width: min(100vw - 24px, 560px);
  margin: 0 auto;
  padding: 18px 0 28px;
}

.calc-page-head,
.calc-event {
  background: rgba(12, 18, 27, 0.96);
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 12px;
}

.calc-page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.calc-page-head h1 {
  color: #f8fafc;
  font-size: 18px;
}

.calc-page-head p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.calc-standalone > .calc-grid,
.calc-standalone > .calc-result {
  background: rgba(12, 18, 27, 0.96);
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 12px;
  padding: 14px;
}

.calc-standalone > .primary {
  width: 100%;
  margin: 12px 0 0;
}

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

  .sidebar {
    position: relative;
    height: auto;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .brand {
    grid-column: 1 / -1;
  }

  .workspace .metrics,
  .opp,
  .candidate {
    grid-template-columns: 1fr;
  }

  .profit,
  .opp-top > div:first-child,
  .legs,
  .row,
  .actions {
    grid-column: auto;
    grid-row: auto;
  }

  .actions {
    max-width: none;
    justify-content: flex-start;
  }
}

@media (max-width: 720px) {
  .sidebar,
  .workspace .metrics,
  .samples,
  .calc-window .calc-grid,
  .outcomes {
    grid-template-columns: 1fr;
  }

  .desk-top {
    display: grid;
  }
}

/* Live trading desk skin */
:root {
  color-scheme: dark;
  --ink: #e6edf3;
  --muted: #8b98a8;
  --line: #263244;
  --bg: #080c12;
  --panel: #111820;
  --panel-2: #0d131b;
  --good: #2dd4bf;
  --warn: #fbbf24;
  --bad: #fb7185;
  --accent: #38bdf8;
}

body {
  background:
    radial-gradient(circle at 12% 0%, rgba(56, 189, 248, 0.14), transparent 30%),
    linear-gradient(180deg, #090d14 0%, #080c12 58%, #05070b 100%);
  color: var(--ink);
}

.shell {
  width: min(1500px, calc(100vw - 28px));
}

.topbar,
.controls,
.panel,
.metric {
  background: rgba(17, 24, 32, 0.92);
  border-color: rgba(148, 163, 184, 0.18);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.24);
}

.topbar {
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 5;
  backdrop-filter: blur(16px);
}

h1 {
  font-size: 32px;
  font-weight: 900;
}

.livebox {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 38px;
  border: 1px solid rgba(45, 212, 191, 0.35);
  border-radius: 999px;
  padding: 0 13px;
  background: rgba(20, 184, 166, 0.09);
  color: #b6fff6;
  font-weight: 750;
  white-space: nowrap;
}

.live-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--good);
  box-shadow: 0 0 0 0 rgba(45, 212, 191, 0.85);
  animation: pulse 1.25s infinite;
}

@keyframes pulse {
  70% { box-shadow: 0 0 0 9px rgba(45, 212, 191, 0); }
  100% { box-shadow: 0 0 0 0 rgba(45, 212, 191, 0); }
}

.pill {
  background: rgba(255, 255, 255, 0.04);
}

.controls {
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  position: sticky;
  top: 86px;
  z-index: 4;
  backdrop-filter: blur(16px);
}

input,
select,
button,
.actions a {
  background: #0a111a;
  border-color: #2a384b;
  color: var(--ink);
}

button,
.actions a {
  background: linear-gradient(180deg, #162233, #0d1622);
}

button:hover,
.actions a:hover {
  border-color: var(--accent);
  color: #ffffff;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.metric {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px 14px;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.metric strong {
  display: block;
  margin-top: 5px;
  font-size: 22px;
  line-height: 1;
}

.grid {
  grid-template-columns: minmax(0, 1fr) 410px;
}

.opp,
.leg,
.paused-item,
.candidate,
.sample-card,
.calc-result {
  background: var(--panel-2);
  border-color: rgba(148, 163, 184, 0.18);
}

.opp {
  position: relative;
  overflow: hidden;
}

.opp::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 2px;
  background: linear-gradient(90deg, var(--good), var(--accent));
}

.profit {
  color: var(--good);
  font-variant-numeric: tabular-nums;
}

.row,
.leg,
.candidate,
.metric strong {
  font-variant-numeric: tabular-nums;
}

.subhead {
  margin-top: 22px;
}

.candidates,
.samples {
  display: grid;
  gap: 8px;
}

.candidate {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 100px 120px;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
}

.candidate-title {
  min-width: 0;
}

.candidate-title b,
.sample-card b {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mini-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 7px;
}

.mini-links a,
.mini-links button {
  height: 26px;
  color: #8ee8ff;
  text-decoration: none;
  border: 1px solid rgba(56, 189, 248, 0.24);
  border-radius: 999px;
  padding: 3px 8px;
  background: #08111b;
  font-size: 11px;
}

.mini-links a:first-child {
  color: #ff9db0;
  border-color: rgba(251, 113, 133, 0.45);
}

.mini-links a:hover,
.mini-links button:hover {
  color: #ffffff;
  border-color: var(--accent);
}

.main-panel {
  background: #05070a;
  border-color: rgba(148, 163, 184, 0.12);
}

.opp {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 18px;
  align-items: center;
  min-height: 92px;
  background: linear-gradient(180deg, #111821 0%, #0a0f16 100%);
  border-color: #1d2735;
}

.opp-top {
  display: contents;
}

.opp-top > div:first-child {
  grid-column: 2;
}

.profit {
  grid-column: 1;
  grid-row: 1 / span 3;
  justify-self: center;
  font-size: 30px;
  line-height: 0.9;
}

.profit::after {
  content: "ARB";
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.12em;
}

.legs {
  grid-column: 2;
  margin: 10px 0;
}

.leg {
  background: #0b121b;
  border-radius: 8px;
}

.leg:first-child {
  border-color: rgba(244, 63, 94, 0.32);
}

.leg:nth-child(2) {
  border-color: rgba(56, 189, 248, 0.32);
}

.row,
.actions {
  grid-column: 2;
}

.actions a,
.actions button {
  height: 30px;
  font-size: 12px;
}

.edge {
  text-align: right;
  font-weight: 850;
}

.edge.good {
  color: var(--good);
}

.edge.bad {
  color: var(--bad);
}

.tag {
  justify-self: end;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 9px;
  color: var(--muted);
  font-size: 12px;
}

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

.sample-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
}

.calc-result.good {
  background: rgba(20, 184, 166, 0.1);
  border-color: rgba(45, 212, 191, 0.42);
}

.calc-result.bad {
  background: rgba(244, 63, 94, 0.09);
  border-color: rgba(251, 113, 133, 0.4);
}

@media (max-width: 1200px) {
  .metrics {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 720px) {
  .metrics,
  .samples,
  .candidate {
    grid-template-columns: 1fr;
  }

  .controls {
    top: 0;
    position: relative;
  }

  .livebox {
    justify-content: center;
  }

  .edge,
  .tag {
    justify-self: start;
    text-align: left;
  }
}

@media (min-width: 721px) {
  .candidate {
    grid-template-columns: minmax(280px, 1fr) 90px 100px 260px !important;
  }

  .candidate-actions {
    grid-column: 4;
  }
}
