:root{
  --bg:#f6f7fb;
  --panel:#ffffff;
  --text:#111827;
  --muted:#6b7280;
  --line:#e5e7eb;
  --line-2:#d1d5db;
  --shadow:0 8px 24px rgba(15,23,42,0.08);
  --radius:16px;
}

*{box-sizing:border-box}
html,body{
  margin:0;
  padding:0;
  background:var(--bg);
  color:var(--text);
  font-family:"Nunito Sans",system-ui,-apple-system,Segoe UI,Roboto,Arial,sans-serif;
}

a{color:inherit;text-decoration:none}

.mb-page{
  max-width:1720px;
  margin:0 auto;
  padding:20px 14px 26px;
}

.mb-topbar{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:16px;
  margin-bottom:14px;
}

.mb-brand{
  display:flex;
  align-items:center;
  gap:12px;
}

.mb-logo{
  width:42px;
  height:42px;
  border-radius:12px;
  background:#ff1e00;
  color:#fff;
  display:flex;
  align-items:center;
  justify-content:center;
  font-weight:800;
  font-size:18px;
  flex:0 0 auto;
}

.mb-title{
  margin:0;
  font-size:18px;
  line-height:1.1;
  font-weight:800;
  letter-spacing:-0.02em;
}

.mb-subtitle{
  margin:4px 0 0;
  color:var(--muted);
  font-size:14px;
}

.mb-actions{
  display:flex;
  align-items:center;
  gap:10px;
  flex-wrap:wrap;
}

.mb-btn,
.mb-select,
.mb-input{
  height:40px;
  border:1px solid var(--line-2);
  background:#fff;
  color:var(--text);
  border-radius:12px;
  padding:0 12px;
}
.mb-select{
  font-size:14px;
  font-weight:600;
}

.mb-input{
  font-size:12px;
  font-weight:800;
  line-height:1.15;
}

.mb-input{
  min-height:40px;
  height:auto;
  padding:6px 12px;
}

.mb-btn{
  font-weight:700;
  cursor:pointer;
}

.mb-btn:hover{background:#f9fafb}

.mb-panel{
  background:var(--panel);
  border:1px solid var(--line);
  border-radius:var(--radius);
  box-shadow:var(--shadow);
}

.mb-controls{
  padding:14px;
  display:grid;
  grid-template-columns: 1.1fr 0.8fr 0.8fr 0.9fr;
  gap:10px;
  align-items:end;
  margin-bottom:12px;
}

.mb-controls--4{
  grid-template-columns: 1.1fr 0.8fr 0.8fr 0.9fr;
}

.mb-field{
  display:flex;
  flex-direction:column;
  gap:6px;
}

.mb-label{
  font-size:12px;
  font-weight:800;
  color:var(--muted);
  text-transform:uppercase;
  letter-spacing:.04em;
}

.mb-stats{
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:10px;
  margin-bottom:12px;
}

.mb-stat{
  padding:13px;
}

.mb-stat-k{
  color:var(--muted);
  font-size:11px;
  font-weight:800;
  text-transform:uppercase;
  letter-spacing:.04em;
  margin-bottom:6px;
}

.mb-stat-v{
  font-size:18px;
  font-weight:800;
  line-height:1;
}

.mb-stat-s{
  margin-top:6px;
  font-size:12px;
  color:var(--muted);
}

.mb-table-wrap{
  overflow:auto;
  border-radius:var(--radius);
}

.mb-table{
  width:100%;
  border-collapse:separate;
  border-spacing:0;
  min-width:1480px;
}

.mb-table thead th{
  position:sticky;
  top:0;
  z-index:5;
  background:#111827;
  color:#fff;
  font-size:10px;
  line-height:1.15;
  text-transform:uppercase;
  letter-spacing:.02em;
  font-weight:800;
  padding:9px 6px;
  border-right:1px solid rgba(255,255,255,0.08);
  white-space:nowrap;
}

.mb-table thead th:first-child{border-top-left-radius:16px}
.mb-table thead th:last-child{
  border-top-right-radius:16px;
  border-right:none;
}

.mb-table tbody td{
  padding:7px 6px;
  border-bottom:1px solid var(--line);
  border-right:1px solid var(--line);
  background:#fff;
  text-align:center;
  font-size:12px;
  white-space:nowrap;
}

.mb-table tbody tr:hover td{
  filter:brightness(0.99);
}

.mb-table tbody td:first-child,
.mb-table tbody td:nth-child(2){
  position:sticky;
  left:0;
  z-index:2;
  background:#fff;
}

.mb-table tbody td:nth-child(2){
  left:82px;
}

.mb-table thead th.sticky-1{
  position:sticky;
  left:0;
  z-index:7;
}

.mb-table thead th.sticky-2{
  position:sticky;
  left:82px;
  z-index:7;
}

.mb-table thead th.mb-cluster-start,
.mb-table tbody td.mb-cluster-start{
  border-left: 12px solid #f6f7fb !important;
}

.mb-col-date{min-width:82px; width:82px}
.mb-col-market{min-width:82px; width:82px}

.mb-date{
  font-weight:700;
  color:#1f2937;
}

.mb-market{
  font-weight:800;
  color:#111827;
}

.mb-sort{
  cursor:pointer;
  user-select:none;
}

.mb-sort span{
  opacity:.7;
  margin-left:3px;
  font-size:9px;
}


.mb-foot{
  display:flex;
  justify-content:space-between;
  gap:12px;
  align-items:center;
  color:var(--muted);
  font-size:12px;
  padding:10px 4px 0;
}

.mb-legend{
  display:flex;
  flex-direction:column;
  gap:6px;
  padding:10px 12px;
  background:#fff;
  border:1px solid var(--line);
  border-radius:12px;
  box-shadow:var(--shadow);
}



.mb-chip{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-height:24px;
  padding:4px 8px;
  border-radius:999px;
  font-size:11px;
  font-weight:800;
  white-space:nowrap;
  border:1px solid rgba(15,23,42,0.06);
}

.mb-chip-g0{ background:#ecfdf5; color:#166534; }
.mb-chip-g1{ background:#bbf7d0; color:#166534; }
.mb-chip-g2{ background:#15803d; color:#dcfce7; }
.mb-chip-g3{ background:#166534; color:#dcfce7; }
.mb-chip-g4{ background:#14532d; color:#dcfce7; }

.mb-chip-r0{ background:#fef2f2; color:#991b1b; }
.mb-chip-r1{ background:#fecaca; color:#991b1b; }
.mb-chip-r2{ background:#b91c1c; color:#fee2e2; }
.mb-chip-r3{ background:#991b1b; color:#fee2e2; }
.mb-chip-r4{ background:#7f1d1d; color:#fee2e2; }

.mb-muted{
  color:var(--muted);
}

.mb-empty,
.mb-loading,
.mb-error{
  padding:28px;
  text-align:center;
  font-size:15px;
}

.mb-error{
  color:#b91c1c;
}

.mb-controls--top {
  display: grid;
  grid-template-columns: 220px 260px minmax(700px, 1fr);
  gap: 12px;
  align-items: end;
}

.mb-field--legend {
  min-width: 0;
  width: 100%;
}

.mb-legend--inline {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  align-content: center;
  justify-content: flex-start;
  width: 100%;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.mb-field--legend .mb-label {
  text-align: left;
}

@media (max-width: 999px){
  .mb-page{
    padding:14px 10px 18px;
  }
  .mb-title{
    font-size:22px;
  }
  .mb-stats{
    grid-template-columns:1fr;
  }

  .mb-controls,
  .mb-controls--4{
    grid-template-columns:1fr 1fr;
  }

.mb-controls--top{
  grid-template-columns: 1fr;
  align-items: stretch;
}

.mb-controls--top .mb-legend--inline{
  justify-content: flex-start;
}

  .mb-stats{
    grid-template-columns:1fr 1fr;
  }

  .mb-topbar{
    flex-direction:column;
    align-items:stretch;
  }
  
}