:root {
  color-scheme: light;
  --ink: #18201f;
  --muted: #5f6964;
  --line: #dce4df;
  --paper: #fbfcfa;
  --panel: #ffffff;
  --green: #0f8a62;
  --mint: #d7f7e9;
  --red: #b73744;
  --yellow: #f5c84b;
  --blue: #2457c5;
  --teal: #23a7aa;
  --shadow: 0 14px 34px rgba(24, 32, 31, 0.09);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(35, 167, 170, 0.12), transparent 34%),
    linear-gradient(315deg, rgba(245, 200, 75, 0.16), transparent 38%),
    var(--paper);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  width: min(1480px, 100%);
  margin: 0 auto;
  padding: 22px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 76px;
}

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

.brand-mark {
  position: relative;
  width: 56px;
  height: 56px;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background:
    radial-gradient(circle at 72% 28%, var(--yellow) 0 9px, transparent 10px),
    linear-gradient(135deg, var(--teal) 0 45%, var(--green) 46% 100%);
  box-shadow: var(--shadow);
}

.brand-mark span {
  position: absolute;
  left: 12px;
  bottom: 12px;
  width: 29px;
  height: 5px;
  border-radius: 999px;
  background: #fff;
  transform: rotate(-28deg);
}

.eyebrow {
  margin: 0 0 3px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(1.55rem, 3vw, 2.35rem);
  line-height: 1;
}

.build-status {
  margin: 7px 0 0;
  color: var(--green);
  font-size: 0.86rem;
  font-weight: 900;
}

h2 {
  margin-bottom: 0;
  font-size: 1.22rem;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.icon-button,
.text-button,
.submit-button {
  border: 1px solid var(--ink);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  cursor: pointer;
  font-weight: 800;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
}

.icon-button svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

.text-button,
.submit-button {
  min-height: 44px;
  padding: 0 15px;
}

.submit-button {
  background: var(--ink);
  color: #fff;
}

.layout {
  display: grid;
  grid-template-columns: 296px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.control-panel {
  position: sticky;
  top: 16px;
  display: grid;
  gap: 14px;
}

.panel-section,
.match-card,
.scanner-band,
.editor-band {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.84);
  box-shadow: var(--shadow);
}

.panel-section {
  padding: 16px;
}

.panel-section h2 {
  margin-bottom: 13px;
}

.check-list,
.method-list {
  display: grid;
  gap: 10px;
}

.check-list label,
.method-list label,
.toggle {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 28px;
  color: var(--muted);
  font-weight: 700;
}

input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--green);
}

.field {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
  color: var(--muted);
  font-weight: 800;
}

.field input[type="number"],
.market-form input,
.market-form select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 11px;
  background: #fff;
  color: var(--ink);
}

.input-row {
  display: grid;
  grid-template-columns: 1fr 42px;
  align-items: center;
  gap: 10px;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--green);
}

output {
  color: var(--ink);
  text-align: right;
}

.workspace {
  display: grid;
  gap: 18px;
}

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

.stat {
  min-height: 106px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 15px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.stat span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.stat strong {
  display: block;
  margin-top: 12px;
  font-size: 2rem;
  line-height: 1;
}

.scanner-band,
.editor-band {
  padding: 18px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  min-width: 280px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f4f7f4;
}

.segmented button {
  min-height: 38px;
  border: 0;
  border-right: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 800;
}

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

.segmented button.active {
  background: var(--ink);
  color: #fff;
}

.alert-rail {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.market-preview {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

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

.preview-tile span {
  display: block;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 900;
  text-transform: uppercase;
}

.preview-tile strong {
  display: block;
  margin-top: 7px;
  line-height: 1.2;
}

.preview-tile small {
  display: block;
  margin-top: 6px;
  color: var(--green);
  font-weight: 900;
}

.source-note {
  display: grid;
  gap: 4px;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--blue);
  border-radius: 8px;
  padding: 12px 13px;
  background: #f5f8ff;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.source-note strong {
  color: var(--ink);
}

.alert-chip {
  min-height: 76px;
  border-left: 5px solid var(--green);
  border-radius: 8px;
  padding: 12px;
  background: var(--mint);
}

.alert-chip strong {
  display: block;
  margin-bottom: 5px;
}

.alert-chip span {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

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

.match-card {
  display: grid;
  gap: 15px;
  padding: 16px;
}

.card-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  min-height: 66px;
}

.league {
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.match-card h3 {
  margin-bottom: 0;
  font-size: 1.05rem;
  line-height: 1.25;
}

.badge {
  display: grid;
  place-items: center;
  flex: 0 0 62px;
  height: 32px;
  border-radius: 999px;
  background: #eef2f0;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 900;
}

.badge.hot {
  background: var(--ink);
  color: #fff;
}

.market-bars {
  display: grid;
  gap: 8px;
}

.market-bars > div:not(.bar-track),
.numbers {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.market-bars > div:not(.bar-track) {
  grid-template-columns: 1fr 1fr;
}

.market-bars span,
.numbers span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
}

.market-bars strong,
.numbers strong {
  display: block;
  margin-top: 4px;
}

.bar-track {
  position: relative;
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #edf1ee;
}

.bar-track span {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  border-radius: inherit;
}

.bar-model {
  background: var(--green);
}

.bar-market {
  background: rgba(36, 87, 197, 0.58);
  transform: translateY(6px);
}

.checks {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.check-pill {
  border-radius: 999px;
  padding: 5px 8px;
  background: #eef2f0;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 800;
}

.check-pill.pass {
  background: var(--mint);
  color: var(--green);
}

.check-pill.fail {
  background: #fbe7e9;
  color: var(--red);
}

.market-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.market-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.market-form .submit-button {
  align-self: end;
}

.empty {
  grid-column: 1 / -1;
  min-height: 160px;
  display: grid;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-weight: 800;
  text-align: center;
}

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

  .control-panel {
    position: static;
    grid-template-columns: repeat(3, 1fr);
  }

  .match-grid,
  .alert-rail {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

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

@media (max-width: 760px) {
  .app-shell {
    padding: 14px;
  }

  .topbar,
  .section-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .top-actions {
    justify-content: space-between;
  }

  .control-panel,
  .stats-grid,
  .match-grid,
  .alert-rail,
  .market-preview,
  .market-form {
    grid-template-columns: 1fr;
  }

  .segmented {
    min-width: 0;
    width: 100%;
  }
}
