:root {
  color-scheme: light;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  background: #f6f8fb;
  color: #0f172a;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(14, 165, 233, 0.1), transparent 320px),
    #f6f8fb;
}

button,
input {
  font: inherit;
}

input[type="number"] {
  text-align: right;
}

.app {
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 28px 0 40px;
}

.toolbar,
.status-row,
.panel {
  border: 1px solid #d8e0ea;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 14px 36px rgba(15, 23, 42, 0.08);
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(260px, 0.95fr) minmax(360px, 1.3fr);
  gap: 24px;
  align-items: end;
  padding: 22px;
  border-radius: 8px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 26px;
  line-height: 1.2;
}

h2 {
  font-size: 17px;
  line-height: 1.25;
}

p,
.status-row,
td,
th,
.muted {
  color: #526174;
}

.toolbar p,
.panel-head p {
  margin-top: 6px;
  font-size: 13px;
}

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

input {
  min-width: 0;
  height: 44px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 0 13px;
  background: #ffffff;
  color: #0f172a;
  outline: none;
}

input:focus {
  border-color: #0284c7;
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.14);
}

button {
  height: 44px;
  border: 0;
  border-radius: 6px;
  padding: 0 14px;
  background: #0284c7;
  color: #ffffff;
  font-weight: 700;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.status-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin: 16px 0;
  padding: 12px 14px;
  border-radius: 8px;
  font-size: 13px;
}

.status-row button {
  height: 34px;
  background: #e2e8f0;
  color: #0f172a;
}

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.panel {
  min-width: 0;
  border-radius: 8px;
  padding: 18px;
}

.wide {
  margin-top: 16px;
}

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

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 68px;
  height: 26px;
  border-radius: 999px;
  padding: 0 10px;
  background: #eef2f7;
  color: #334155;
  font-size: 12px;
  white-space: nowrap;
}

.badge.ok {
  background: #dcfce7;
  color: #166534;
}

.badge.warn {
  background: #fef3c7;
  color: #92400e;
}

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

.metric {
  min-height: 72px;
  border: 1px solid #dbe4ef;
  border-radius: 6px;
  padding: 11px;
  background: #f8fafc;
}

.metric span {
  display: block;
  color: #64748b;
  font-size: 12px;
}

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 20px;
}

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

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th,
td {
  border-bottom: 1px solid #e2e8f0;
  padding: 10px 8px;
  text-align: right;
  vertical-align: top;
}

th:first-child,
td:first-child {
  text-align: left;
}

th {
  color: #1e293b;
  font-weight: 700;
}

.total-row td {
  color: #0f172a;
  font-weight: 800;
  background: #e0f2fe;
}

.bet-input {
  width: 92px;
  height: 34px;
  padding: 0 8px;
}

.sim-controls {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 12px;
}

.sim-controls label {
  display: grid;
  gap: 6px;
  color: #64748b;
  font-size: 12px;
}

.sim-controls input {
  width: 180px;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.best-box {
  margin-top: 14px;
  border: 1px solid #bae6fd;
  border-radius: 6px;
  padding: 14px;
  background: #f0f9ff;
}

.best-box h3 {
  margin: 0 0 6px;
  font-size: 15px;
}

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

.best-head button {
  height: 36px;
  background: #16a34a;
  white-space: nowrap;
}

.best-box p {
  margin-top: 8px;
  font-size: 13px;
}

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

.best-list div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid #dbe4ef;
  border-radius: 6px;
  padding: 10px;
  background: #ffffff;
}

.market-list {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
}

.market-card {
  border: 1px solid #dbe4ef;
  border-radius: 6px;
  padding: 10px;
  background: #f8fafc;
}

.market-card button {
  display: block;
  width: 100%;
  height: auto;
  min-height: 38px;
  margin-top: 8px;
  background: #e2e8f0;
  color: #0f172a;
  text-align: left;
}

.market-title {
  color: #0f172a;
  font-weight: 700;
}

.error {
  color: #dc2626;
}

@media (max-width: 820px) {
  .toolbar,
  .grid {
    grid-template-columns: 1fr;
  }

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

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