#box_main {
  flex: 1;
  min-width: 0;
  min-height: 800px;
  padding-top: 14px;
  padding-left: 20px;
}

#box_title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

#box_filter {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

#btn_stock_select {
  height: 44px;
  padding: 0 32px 0 12px;
  outline: none;
  border: 1px solid var(--color-greyLight);
  border-radius: 10px;
  background: #ffffff url("/static/img/icon_arrow.png") no-repeat
    calc(100% - 10px) center / 12px;
  font-family: "Poppins", "Noto Sans TC", sans-serif;
  font-weight: 400;
  font-size: 14px;
  color: var(--color-black);
  cursor: pointer;
  text-align: left;
  flex: 2;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: border-color 0.15s ease;
}
#btn_stock_select:hover {
  border-color: var(--color-primary);
}

/* ── Range buttons ── */
#box_range {
  display: flex;
  gap: 6px;
  margin-bottom: 20px;
  overflow-x: auto;
  flex-wrap: nowrap;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
#box_range::-webkit-scrollbar {
  display: none;
}

.btn_range {
  height: 30px;
  padding: 0 12px;
  border: 1px solid var(--color-greyLight);
  border-radius: 8px;
  background: transparent;
  font-size: 12px;
  color: var(--color-greyDark);
  cursor: pointer;
  outline: none;
  flex-shrink: 0;
  white-space: nowrap;
  transition: all 0.15s ease;
}
.btn_range:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}
.btn_range.active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #ffffff;
}

/* ── Summary cards ── */
#box_summary {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.summary_card {
  flex: 1;
  min-width: 130px;
  background: #ffffff;
  border: 1px solid var(--color-greyLight);
  border-radius: 12px;
  padding: 14px 16px;
}
.summary_card .label {
  font-size: 11px;
  color: var(--color-greyMedium);
  margin-bottom: 2px;
}
.summary_card .sublabel {
  font-size: 10px;
  color: var(--color-greyLightMedium);
  margin-bottom: 4px;
}
.summary_card .value {
  font-size: 18px;
  font-variant-numeric: tabular-nums;
  color: var(--color-black);
}
.summary_card .value.green {
  color: var(--color-greenBlack);
}
.summary_card .value.red {
  color: var(--color-redBlack);
}

/* ── Chart cards ── */
.content_card {
  background: #ffffff;
  border: 1px solid var(--color-greyLight);
  border-radius: 16px;
  padding: 20px;
  margin-bottom: 16px;
}
.content_card h6 {
  font-size: 13px;
  color: var(--color-greyDark);
  margin-bottom: 16px;
}

#chart_daily {
  width: 100%;
  height: 320px;
  max-height: 400px;
}
#chart_cumul {
  width: 100%;
  height: 240px;
  max-height: 300px;
}

.loader_wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 48px 0;
  color: var(--color-greyMedium);
  font-size: 14px;
}

/* ── RWD ── */
@media (max-width: 1300px) {
  #box_title { display: none; }

  #box_container {
    padding-top: 60px !important;
  }
  #box_main {
    padding-left: 0px;
  }

  #box_summary {
    flex-direction: column;
    gap: 0;
    border: 1px solid var(--color-greyLight);
    border-radius: 12px;
    overflow: hidden;
    background: #ffffff;
    margin-bottom: 16px;
  }
  .summary_card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    border: none;
    border-radius: 0;
    border-bottom: 1px solid var(--color-greyLight);
    background: transparent;
    min-width: 0;
    flex: none;
  }
  .summary_card:last-child {
    border-bottom: none;
  }
  .summary_card .label,
  .summary_card .sublabel {
    margin-bottom: 0;
  }
  .summary_card .value {
    font-size: 15px;
  }
}

@media (max-width: 768px) {
  #btn_stock_select {
    flex: 0 0 100%;
  }
  #box_filter {
    flex-wrap: wrap;
  }
  .content_card {
    padding: 12px;
  }
  #chart_daily {
    height: 260px;
    max-height: 320px;
  }
  #chart_cumul {
    height: 200px;
    max-height: 260px;
  }
}
